Merge branch 'develop' into bug/JAL-98consensusMemory
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Sep 2016 13:23:46 +0000 (14:23 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Sep 2016 13:23:46 +0000 (14:23 +0100)
48 files changed:
examples/exampleFeatures.txt
examples/groovy/featureCounter.groovy
examples/plantfdx.fa
examples/plantfdx.features
examples/uniref50.fa
help/help.jhm
help/helpTOC.xml
help/html/calculations/consensus.html
help/html/calculations/structureconsensus.html
help/html/features/featuresettings.html
help/html/features/groovy.html
help/html/features/siftsmapping.html
help/html/features/uniprotsequencefetcher.html
help/html/features/viewingpdbs.html
help/html/groovy/featureCounter.html [new file with mode: 0644]
help/html/menus/alwannotation.html
help/html/menus/alwannotationpanel.html
help/html/menus/index.html
help/html/menus/popupMenu.html
help/html/na/index.html
help/html/releases.html
help/html/whatsNew.html
resources/fts/pdb_data_columns.txt
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
src/jalview/analysis/AlignmentUtils.java
src/jalview/analysis/Rna.java
src/jalview/appletgui/AnnotationColourChooser.java
src/jalview/appletgui/AnnotationColumnChooser.java
src/jalview/appletgui/AnnotationRowFilter.java
src/jalview/appletgui/AppletJmol.java
src/jalview/bin/Cache.java
src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/ext/jmol/JmolParser.java
src/jalview/gui/AnnotationColourChooser.java
src/jalview/gui/AnnotationColumnChooser.java
src/jalview/gui/AnnotationRowFilter.java
src/jalview/gui/AppJmol.java
src/jalview/gui/StructureChooser.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/PDBFeatureSettings.java
src/jalview/jbgui/GStructureChooser.java
src/jalview/schemes/TCoffeeColourScheme.java
src/jalview/ws/DBRefFetcher.java
src/jalview/ws/dbsources/Pdb.java
test/jalview/analysis/AlignmentUtilsTests.java
test/jalview/gui/StructureChooserTest.java

index c0098a9..2de9817 100755 (executable)
@@ -79,12 +79,12 @@ 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.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.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
+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>Fer2 Status: True Positive <a href="http://pfam.xfam.org/family/PF00111">Pfam 60_13</a></html>   FER1_ARATH      -1      60      135     Pfam
+Ferredoxin_fold Status: True Positive  FER1_ARATH      -1      50      145     Cath
 <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
@@ -127,13 +127,13 @@ STARTGROUP        netphos
 <html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 112_11</a></html>     FER1_SPIOL      -1      112     112     PHOSPHORYLATION (S)
 <html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&amp;service=NetPhos-2.0">PHOSPHORYLATION (T) 139_13</a></html>     FER1_SPIOL      -1      139     139     PHOSPHORYLATION (T)
 <html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00221&amp;service=NetPhos-2.0">PHOSPHORYLATION (Y) 73_7</a></html>       FER1_SPIOL      -1      73      73      PHOSPHORYLATION (Y)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html>   FER1_ARATH      -1      19      19      PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html>   FER1_ARATH      -1      24      24      PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html>   FER1_ARATH      -1      90      90      PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER1_ARATH      -1      107     107     PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER1_ARATH      -1      114     114     PHOSPHORYLATION (S)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER1_ARATH      -1      141     141     PHOSPHORYLATION (T)
-<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER1_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html>   FER1_ARATH      -1      75      75      PHOSPHORYLATION (Y)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 19_1</a></html>   FER2_ARATH      -1      19      19      PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 24_2</a></html>   FER2_ARATH      -1      24      24      PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 90_9</a></html>   FER2_ARATH      -1      90      90      PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 107_10</a></html> FER2_ARATH      -1      107     107     PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 114_11</a></html> FER2_ARATH      -1      114     114     PHOSPHORYLATION (S)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (T) 141_14</a></html> FER2_ARATH      -1      141     141     PHOSPHORYLATION (T)
+<html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=FER2_ARATH&amp;service=NetPhos-2.0">PHOSPHORYLATION (Y) 75_7</a></html>   FER2_ARATH      -1      75      75      PHOSPHORYLATION (Y)
 <html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 38_3</a></html>       FER_BRANA       -1      38      38      PHOSPHORYLATION (S)
 <html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&amp;service=NetPhos-2.0">PHOSPHORYLATION (S) 62_6</a></html>       FER_BRANA       -1      62      62      PHOSPHORYLATION (S)
 <html>High confidence server. Only hits with scores over 0.8 are reported. <a href="http://www.cbs.dtu.dk/cgi-bin/proview/webface-link?seqid=P00227&amp;service=NetPhos-2.0">PHOSPHORYLATION (T) 89_8</a></html>       FER_BRANA       -1      89      89      PHOSPHORYLATION (T)
index a16d8bb..9059dd0 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * 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.
+ */
 import jalview.workers.FeatureCounterI;
 import jalview.workers.AlignmentAnnotationFactory;
 
index 1412a5a..f314c85 100644 (file)
@@ -35,17 +35,17 @@ IETHKEEELTA-
 EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDDQIAEGFVLTCAAYPTSDVT
 IETHREEDMV--
 >FER1_ARATH/1-148
-----MASTALSSAIVGTSFIRRSPAPISLRSLPSANT-QSLFGLKS-GTARGGRVTAMATYKVKFITPEGEL
-EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDVT
-IETHKEEDIV--
+----MASTALSSAIVSTSFLRRQQTPISLRSLPFANT-QSLFGLKS-STARGGRVTAMATYKVKFITPEGEQ
+EVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDVV
+IETHKEEAIM--
 >FER_BRANA/1-96
 ----------------------------------------------------------ATYKVKFITPEGEQ
 EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDESFLDDDQIAEGFVLTCAAYPTSDVT
 IETHKEEELV--
 >FER2_ARATH/1-148
-----MASTALSSAIVSTSFLRRQQTPISLRSLPFANT-QSLFGLKS-STARGGRVTAMATYKVKFITPEGEQ
-EVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDVV
-IETHKEEAIM--
+----MASTALSSAIVGTSFIRRSPAPISLRSLPSANT-QSLFGLKS-GTARGGRVTAMATYKVKFITPEGEL
+EVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDVT
+IETHKEEDIV--
 >Q93Z60_ARATH/1-118
 ----MASTALSSAIVSTSFLRRQQTPISLRSLPFANT-QSLFGLKS-STARGGRVTAMATYKVKFITPEGEQ
 EVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDD--------------------
index 872dadc..6a2e058 100644 (file)
@@ -78,23 +78,23 @@ 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.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.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.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.xfam.org/family/PF00111">Pfam 60_135</a></html>     FER2_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.xfam.org/family/PF00111">Pfam 8_83</a></html>       FER_BRANA       -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.xfam.org/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_118</a></html>     Q93Z60_ARATH    -1      60      118     Pfam
 Chloroplast    FER1_MAIZE      -1      1       52      TRANSIT
 STRAND FER1_MAIZE      -1      57      59      STRAND
index 72c062d..4bdbfb4 100755 (executable)
@@ -35,17 +35,17 @@ TIETHKEEELTA-
 QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDDQIAEGFVLTCAAYPTSDV
 TIETHREEDMV--
 >FER1_ARATH Ferredoxin-1, chloroplast precursor
-MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMATYKVKFITPEGE
-LEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDV
-TIETHKEEDIV--
+MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE
+QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDV
+VIETHKEEAIM--
 >FER_BRANA Ferredoxin
 -----------------------------------------------------------ATYKVKFITPEGE
 QEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGFVDQSDESFLDDDQIAEGFVLTCAAYPTSDV
 TIETHKEEELV--
 >FER2_ARATH Ferredoxin-2, chloroplast precursor
-MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE
-QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDDEQMSEGYVLTCVAYPTSDV
-VIETHKEEAIM--
+MAST----ALSSAIVGTSFIRRSPAPISLRSLPSANTQ--SLFGLKS-GTARGGRVTAMATYKVKFITPEGE
+LEVECDDDVYVLDAAEEAGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSFLDDEQIGEGFVLTCAAYPTSDV
+TIETHKEEDIV--
 >Q93Z60_ARATH At1g10960/T19D16_12
 MAST----ALSSAIVSTSFLRRQQTPISLRSLPFANTQ--SLFGLKS-STARGGRVTAMATYKVKFITPEGE
 QEVECEEDVYVLDAAEEAGLDLPYSCRAGSCSSCAGKVVSGSIDQSDQSFLDD-------------------
index 53b09e5..7e14204 100755 (executable)
    
    <mapID target="memory" url="html/memory.html" />
    <mapID target="groovy" url="html/features/groovy.html" />
+   <mapID target="groovy.featurecounter" url="html/groovy/featureCounter.html" />
    <mapID target="privacy" url="html/privacy.html" />
    <mapID target="vamsas" url="html/vamsas/index.html"/>
    <mapID target="aminoAcids" url="html/misc/aminoAcids.html" />
    
    <mapID target="biojson" url="html/features/bioJsonFormat.html" />
    <mapID target="pdbfetcher" url="html/features/pdbsequencefetcher.html" />
+   <mapID target="siftsmapping" url="html/features/siftsmapping.html" />
    <mapID target="pdbchooser" url="html/features/structurechooser.html" />
    <mapID target="selectcolbyannot" url="html/features/columnFilterByAnnotation.html" />
    <mapID target="biojsmsa" url="html/features/biojsmsa.html" />
index c4476fd..bf1710c 100755 (executable)
@@ -25,7 +25,7 @@
                        <tocitem text="What's new" target="new" expand="true">
                                <tocitem text="Retrieval from ENSEMBL" target="ensemblfetch" />
                                <tocitem text="UniProt Free Text Search" target="uniprotfetcher" />
-                               
+                               <tocitem text="SIFTS for mapping PDB structures to UniProt" target="siftsmapping" />
                                <tocitem text="Latest Release Notes" target="release"/>
                </tocitem>
                
                </tocitem>
                <tocitem text="Preferences" target="preferences" />
                <tocitem text="Memory Settings" target="memory" expand="false"/>
+               <tocitem text="Scripting with Groovy" target="groovy">
+                       <tocitem text="Groovy Feature Counter example" target="groovy.featurecounter"/>
+               </tocitem>
                <tocitem text="Command Line" target="commandline" expand="false">
                        <tocitem text="Command Line Arguments" target="clarguments" />
-                       <tocitem text="Groovy Shell" target="groovy" />
                </tocitem>
                <tocitem text="Privacy" target="privacy" />
        </tocitem>
index c870887..2ade2e0 100644 (file)
@@ -43,7 +43,7 @@
     entry from the consensus annotation label to copy the alignment's
     consensus sequence to the clipboard.
   <p>
-    <strong>Sequence logo</strong>
+    <a name="logo"><strong>Sequence logo</strong></a>
   </p>
   By clicking on the label you can also activate the sequence logo. It
   indicates the relative amount of residues per column which can be
index 756e6e9..c194a53 100755 (executable)
     <strong>Alignment RNA Structure Consensus Annotation</strong>
   </p>
 
-  <p>The RNA structure consensus displayed below the alignment gives
-    the percentage of valid base pairs per column for the first
-    secondary structure annotation shown on the annotation panel. The
-    symbol below each histogram indicates whether the majority of base
-    pairs are:
-  <ul>
-    <li>'(' - Watson-Crick (A:C, G:T)</li>
-    <li>'[' - Canonical Pairs (A:C, G:U, A:U)</li>
-    <li>'{' - Invalid Pairs (the rest)</li>
+  <p>The RNA structure consensus displayed below the alignment gives the
+    percentage of valid base pairs per column for the first secondary
+    structure annotation shown on the annotation panel. These values are
+    shown as a histogram labeled &quot;StrucConsensus&quot;, where a
+    symbol below each bar indicates whether the majority of base pairs
+    are:<ul>
+    <li>'(' - Watson-Crick (C:G, A:U/T)</li>
+    <li>'[' - Non-canonical (a.ka. wobble) (G:U/T)</li>
+    <li>'{' - Invalid (a.k.a. tertiary) (the rest)</li>
   </ul>
-  <p>Mousing over the column gives the fraction of pairs classified as Watson-Crick, Canonical or Invalid.</p>
-  
-<p>By default
+  <p>Mousing over the column gives the fraction of pairs classified
+    as Watson-Crick, Canonical or Invalid.</p>
+
+  <p>By default
     this calculation includes gaps in columns. You can choose to ignore
     gaps in the calculation by right clicking on the label
-    &quot;StrConsensus&quot; to the left of the structure consensus bar
+    &quot;StrucConsensus&quot; to the left of the structure consensus bar
     chart.<br>
+  
   <p>
-    <strong>Structure logo</strong>
-  </p>
-  Right-clicking on the label allows you to enable the structure logo.
-  It is very similar to a sequence logo but instead shows the
-  distribution of base pairs. There are two residues per column, the
-  actual column and the interacting base. The opening bracket is always
-  the one on the left side.
-  <br> Like sequence logos the relative amount of a specific base pair
-  can be estimated by its size in the logo. When the logo is displayed,
-  the tool tip of a column gives the exact numbers for all occurring
-  valid base pairs.
+    <strong>RNA Structure logo</strong><br /> Right-clicking on the
+    label allows you to enable the structure logo. It is very similar to
+    a sequence logo but instead shows the distribution of base pairs.
+    There are two residues per column, the actual column and the
+    interacting base. The opening bracket is always the one on the left
+    side. <br> Like <a href="consensus.html#logo">sequence
+      logos</a>, the relative amount of a specific base pair can be
+    estimated by its size in the logo, and this can be made more obvious
+    by <em>normalising</em> the logo (enabled via the popup menu). When
+    the logo is displayed, the tool tip for a column gives the exact
+    percentages for all base pairs at that position.
   </p>
 </body>
 </html>
index 200fc8f..b7738cd 100755 (executable)
   </p>
   <p>
     <strong><em>Feature settings pop-up menu</em></strong><br> <strong>Right-click</strong>
-    on a feature to open a pop-up menu that allows you to sort the
-    alignment or current selection using that feature type (see below),
-    or toggle the type of colouring used for the feature. Features may
-    be highlighted with either a single colour or a <a
-      href="featureschemes.html"
-    >feature colourscheme</a> based on either the scores associated with
-    that feature or from the feature's description (e.g. to distinguish
+    on a feature to open a pop-up menu that allows you to<ul><li>Hide, show and
+    select columns containing that feature</li><li>Sort the alignment or
+    current selection using that feature type (see below)</li><li>Toggle the
+    type of colouring used for the feature</li></ul><p>Features may be highlighted
+    with either a single colour or a <a href="featureschemes.html">feature
+      colourscheme</a> based on either the scores associated with that
+    feature or from the feature's description (e.g. to distinguish
     different names associated with a DOMAIN feature).
   </p>
   <p>
index a2bc627..079cf9e 100644 (file)
     <strong>The Groovy Shell</strong>
   </p>
   <p>
-    <a href="http://www.groovy-lang.org/">Groovy</a> is an &quot;<em>agile
-      and dynamic language for the Java platform</em>&quot;. The groovy
-    scripting language makes it extremely easy to programmatically
-    interact with Java programs, in much the same way that Javascript is
-    used to generate and interact with applets and other objects on the
-    page.
+    Groovy (<a href="http://www.groovy-lang.org/">www.groovy-lang.org</a>)
+    is an &quot;<em>agile and dynamic language for the Java
+      platform</em>&quot;. The groovy scripting language makes it extremely
+    easy to programmatically interact with Java programs, in much the
+    same way that Javascript is used to generate and interact with
+    applets and other objects on the page.
   </p>
   <p>
-    <strong><em>Getting Groovy...</em> </strong><br> Jalview comes with
-    an embedded installation of Groovy. All you need is to select <strong>Tools&#8594;Groovy
-      Console...</strong> menu option from the Jalview Desktop's
-    drop-down menu. After a short pause, you should then see the <a
-      href="http://groovy-lang.org/groovyconsole.html"
-    >Groovy Console</a> appear. This allows you to interactively execute Groovy
-    scripts within the Jalview run-time environment.
+    <em>Getting Groovy...</em><br> Jalview comes with an embedded
+    installation of Groovy. Just select <strong>Tools&#8594;Groovy
+      Console...</strong> from the Jalview Desktop's drop-down menu. After a
+    short pause, you should then see the <a
+      href="http://groovy-lang.org/groovyconsole.html">Groovy
+      Console</a> appear. This allows you to interactively execute Groovy
+    scripts whilst Jalview is running. We've also provided a <strong>Calculations&#8594;Execute
+      Groovy Script</strong> button so you can execute the currently loaded
+    groovy script whilst viewing an alignment.
   </p>
   <p>
     <strong>Executing groovy scripts on Jalview startup</strong><br>
     </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
-    called from Groovy scripts. The access point for this is the <strong>Jalview</strong>
-    object defined in the groovy environment which corresponds to the
-  <pre>jalview.gui.Desktop</pre>
-  object which manages all the Jalview windows. Here's an example to get
-  you started:
-  <br>
+    The scripting interface to Jalview is still a work in progress, so
+    we recommend you also take a look at Jalview's source, since all the
+    public methods of the jalview class hierarchy can be called from
+    Groovy scripts. In addition, the following objects are also defined:
+
+  
+  <ul>
+    <li><strong>Jalview</strong> - this is bound to <code>jalview.bin.Jalview</code>.<br />Useful
+      methods include:
+      <ul>
+        <li>Jalview.getAlignFrames() - returns a list of
+          jalview.gui.AlignFrame objects</li>
+        <li>Jalview.getCurrentAlignFrame() - returns the alignment
+          window which is currently being looked at by the user</li>
+      </ul></li>
+    <li><strong>currentAlFrame</strong> - this is only defined when
+      running a Groovy script via the -groovy command line argument. It
+      returns the first alignment window created after acting on the
+      other arguments passed on the command line.</li>
+  </ul>
+  <p>
+    <em>A simple script</em><br />
   <ul>
     <li>Getting the title, alignment and first sequence from the
       current alignFrame<br> <pre>
@@ -77,13 +90,26 @@ def alignment = alf[0].viewport.alignment;
 def seq = alignment.getSequenceAt(0);
 </pre>
     </li>
-    <li>When running a groovy script from the command line, the
-      alignment that was just loaded can be referred to like so:<br>
-    <pre>
+    <li>If you wanted to do the same thing from the command line, you can refer to
+      alignment that was just loaded with currentAlFrame:<br>
+      <pre>
 print currentAlFrame.getTitle();</pre>
   </ul>
-  If you have downloaded the InstallAnywhere version of Jalview, you can
-  find additional groovy scripts in the examples/groovy subfolder of the
-  installation directory.
+  <p>
+    <em>Example scripts</em><br />If you have downloaded the
+    InstallAnywhere version of Jalview, you can find additional groovy
+    scripts in the examples/groovy subfolder of the installation
+    directory. The examples are also available at <a
+      href="http://www.jalview.org/examples/groovy">http://www.jalview.org/examples/groovy</a>.
+  </p>
+  <p>
+    <em>Using Groovy to add new Alignment Calculations</em><br />We've
+    simplified the alignment analysis programming interface in Jalview
+    2.10 to make it easy for you to add your own dynamic annotation
+    tracks with Groovy. Have a look at the <a
+      href="../groovy/featureCounter.html">featureCounter.groovy</a>
+    example for more information.
+  </p>
+
 </body>
 </html>
index 80c0294..9492d70 100644 (file)
     record and use that information to construct a mapping between the
     sequence and downloaded structure.</p>
   <p>If, for some reason, no SIFTS mapping data exists, then Jalview
-    will generate a mapping using its built-in Needleman and Wunsch
-    global alignment algorithm. This method of mapping was used for all
-    structures prior to version 2.10.
-  <p>
-    <strong>Controlling and troubleshooting SIFTS mappings</strong> <br />
+    will generate a mapping using the built-in Needleman and Wunsch
+    global alignment algorithm. This is how sequence-structure mappings
+    were created before version 2.10.</p>
+  <p><strong>Controlling and troubleshooting SIFTS mappings</strong> <br />
     Configuration options controlling whether SIFTS mappings are used
     can be found in the <strong>Tools &rarr; Preferences &rarr;
       Structure tab</strong>, under 'Sequence &harr; Structure method'.<br /> <em>Note:</em>
     <strong>Multi-Chain Mappings</strong> <br />SIFTS gives Jalview the
     ability to display multi-chain mappings between UniProt sequences
     and PDB structure data. This is important when working with
-    multimeric proteins, since the biological unit will contain several
+    multimeric proteins, when the biological assembly can contain several
     structures for the same protein sequence. Multi-chain mapping allows
     all residues in a structure to be located in the alignment, and
     also, when shading the structure by sequence colours, enables
     conservation patterns between oligomer interfaces to be explored.
   </p>
-  <p>To see this in action, load uniprot sequence for FER1_MAIZE
-    then veiw PDB structure for 3B2F, you will notice that mousing over
+  <p>To see this in action, Retrieve the UniProt sequence
+    FER1_MAIZE, and then view one of its structures: 3B2F. Mousing over
     the sequence results to two positions being highlighted in the
-    structure, also colouring the sequence transfers the color to all
+    structure, and colouring the alignment transfers the color to all
     the mapped chains in the structure.</p>
 
   <p>
     <Strong>Viewing Mapping Output</Strong> <br /> The mapping provided
     by the SIFTS record is accessible via <strong>File &rarr;
       View mapping</strong> menu of the structure viewers. The screenshot below
-    is the mapping output for the <Strong>{FER1_MAIZE &harr;
-      3B2F}</Strong> example described above, and confirms that all two chains
-    were mapped. The mapping method used can be seen within the area
-    highlighted with red boarder.
+    shows the mapping created between UniProt sequence FER1_MAIZE and proteins in PDB 3B2F, which reports thattwo chains
+    were mapped. The mapping method is also reported (highlighted with red border).
   <p>
 
     &emsp;<img src="sifts_mapping_output.png" align="left"
       alt="SIFTS mapping output" />
+      <br/>
   <p>
     <em>SIFTS Mapping integration was added in Jalview 2.10</em>
   </p>
index ed7cbb7..b4b1d86 100644 (file)
@@ -48,7 +48,7 @@
   </p>
   <p>
     To search UniProt, simply begin typing in the text box. After a
-    short delay (uabout 1.5 seconds), results will be shown in the table
+    short delay (about 1.5 seconds), results will be shown in the table
     below. You can sort results by clicking on 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
index edb3762..9cead2d 100755 (executable)
             Entries</strong> option from the drop down menu at the top of the
           dialog box.</li>
       </ul></li>
-    <li>To view selected structures, click the <strong>"View"</strong>
-      button.
-    </li>
+    <li><strong>To view selected structures, click the <strong>"View"</strong>
+      button.</strong><br />
+      <ul>
+        <li>Additional structure data will be downloaded with the
+          EMBL-EBI's dbfetch service</li>
+        <li><a href="siftsmapping.html">SIFTS</a> records will also
+          be downloaded for mapping UniProt protein sequence data to PDB
+          coordinates.</li>
+      </ul></li>
   </ol>
 
   The
diff --git a/help/html/groovy/featureCounter.html b/help/html/groovy/featureCounter.html
new file mode 100644 (file)
index 0000000..fe848a9
--- /dev/null
@@ -0,0 +1,262 @@
+<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>Extending Jalview with Groovy - Feature Counter Example</title>
+</head>
+<body>
+  <p>
+    <strong>Extending Jalview with Groovy - A customisable
+      feature counter</strong><br /> 
+    <br />The groovy script below shows how to add a new calculation
+    track to a Jalview alignment window.</p><p>As currently written, it will
+    add two tracks to a protein alignment view which count Pfam features
+    in each column, and ones where a charge residue also occur.</p><p>To try
+    it for yourself:</p><ol><li>Copy and paste it into the groovy script
+    console</li><li>Load the example Feredoxin project (the one that opens
+    by default when you first launched Jalview)</li><li>Select <strong>Calculations&#8594;Execute
+      Groovy Script</strong> from the alignment window's menu bar to run the script on
+    the current view.</li></ol>
+  <em><a
+      href="http://www.jalview.org/examples/groovy/featureCounter.groovy">http://www.jalview.org/examples/groovy/featureCounter.groovy</a> - rendered with <a href="http://hilite.me">hilite.me</a></em>
+  <!-- HTML generated using hilite.me -->
+  <div
+    style="background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;">
+    <pre style="margin: 0; line-height: 125%">
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * Jalview - A Sequence Alignment Editor and Viewer (Version 2.10)</span>
+<span style="color: #888888"> * Copyright (C) 2016 The Jalview Authors</span>
+<span style="color: #888888"> * </span>
+<span style="color: #888888"> * This file is part of Jalview.</span>
+<span style="color: #888888"> * </span>
+<span style="color: #888888"> * Jalview is free software: you can redistribute it and/or</span>
+<span style="color: #888888"> * modify it under the terms of the GNU General Public License </span>
+<span style="color: #888888"> * as published by the Free Software Foundation, either version 3</span>
+<span style="color: #888888"> * of the License, or (at your option) any later version.</span>
+<span style="color: #888888"> *  </span>
+<span style="color: #888888"> * Jalview is distributed in the hope that it will be useful, but </span>
+<span style="color: #888888"> * WITHOUT ANY WARRANTY; without even the implied warranty </span>
+<span style="color: #888888"> * of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span>
+<span style="color: #888888"> * PURPOSE.  See the GNU General Public License for more details.</span>
+<span style="color: #888888"> * </span>
+<span style="color: #888888"> * You should have received a copy of the GNU General Public License</span>
+<span style="color: #888888"> * along with Jalview.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
+<span style="color: #888888"> * The Jalview Authors are detailed in the &#39;AUTHORS&#39; file.</span>
+<span style="color: #888888"> */</span>
+<span style="color: #008800; font-weight: bold">import</span> <span
+        style="color: #0e84b5; font-weight: bold">jalview.workers.FeatureCounterI</span><span
+        style="color: #333333">;</span>
+<span style="color: #008800; font-weight: bold">import</span> <span
+        style="color: #0e84b5; font-weight: bold">jalview.workers.AlignmentAnnotationFactory</span><span
+        style="color: #333333">;</span>
+
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * Example script that registers two alignment annotation calculators</span>
+<span style="color: #888888"> * - one that counts residues in a column with Pfam annotation</span>
+<span style="color: #888888"> * - one that counts only charged residues with Pfam annotation</span>
+<span style="color: #888888"> *</span>
+<span style="color: #888888"> * To try:</span>
+<span style="color: #888888"> * 1. load uniref50.fa from the examples folder</span>
+<span style="color: #888888"> * 2. load features onto it from from examples/exampleFeatures.txt</span>
+<span style="color: #888888"> * 3. Open this script in the Groovy console.</span>
+<span style="color: #888888"> * 4. Either execute this script from the console, or via Calculate-&gt;Run Groovy Script</span>
+<span style="color: #888888"> </span>
+<span style="color: #888888"> * To explore further, try changing this script to count other kinds of occurrences of </span>
+<span style="color: #888888"> * residue and sequence features at columns in an alignment.</span>
+<span style="color: #888888"> */</span>
+
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * A closure that returns true for any Charged residue</span>
+<span style="color: #888888"> */</span>
+<span style="color: #333399; font-weight: bold">def</span> isCharged <span
+        style="color: #333333">=</span> <span style="color: #333333">{</span> residue <span
+        style="color: #333333">-&gt;</span>
+    <span style="color: #008800; font-weight: bold">switch</span><span
+        style="color: #333333">(</span>residue<span
+        style="color: #333333">)</span> <span style="color: #333333">{</span>
+        <span style="color: #008800; font-weight: bold">case</span> <span
+        style="color: #333333">[</span><span
+        style="background-color: #fff0f0">&#39;D&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;d&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;E&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;e&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;H&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;h&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;K&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;k&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;R&#39;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&#39;r&#39;</span><span
+        style="color: #333333">]:</span>
+            <span style="color: #008800; font-weight: bold">return</span> <span
+        style="color: #008800; font-weight: bold">true</span>
+    <span style="color: #333333">}</span>
+    <span style="color: #008800; font-weight: bold">false</span>
+<span style="color: #333333">}</span> 
+
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * A closure that returns 1 if sequence features include type &#39;Pfam&#39;, else 0</span>
+<span style="color: #888888"> * Argument should be a list of SequenceFeature </span>
+<span style="color: #888888"> */</span>
+<span style="color: #333399; font-weight: bold">def</span> hasPfam <span
+        style="color: #333333">=</span> <span style="color: #333333">{</span> features <span
+        style="color: #333333">-&gt;</span> 
+    <span style="color: #008800; font-weight: bold">for</span> <span
+        style="color: #333333">(</span>sf <span
+        style="color: #008800; font-weight: bold">in</span> features<span
+        style="color: #333333">)</span>
+    <span style="color: #333333">{</span>
+        <span style="color: #888888">/*</span>
+<span style="color: #888888">         * Here we inspect the type of the sequence feature.</span>
+<span style="color: #888888">         * You can also test sf.description, sf.score, sf.featureGroup,</span>
+<span style="color: #888888">         * sf.strand, sf.phase, sf.begin, sf.end</span>
+<span style="color: #888888">         * or sf.getValue(attributeName) for GFF &#39;column 9&#39; properties</span>
+<span style="color: #888888">         */</span>
+        <span style="color: #008800; font-weight: bold">if</span> <span
+        style="color: #333333">(</span><span
+        style="background-color: #fff0f0">&quot;Pfam&quot;</span><span
+        style="color: #333333">.</span><span style="color: #0000CC">equals</span><span
+        style="color: #333333">(</span>sf<span style="color: #333333">.</span><span
+        style="color: #0000CC">type</span><span style="color: #333333">))</span>
+        <span style="color: #333333">{</span>
+            <span style="color: #008800; font-weight: bold">return</span> <span
+        style="color: #008800; font-weight: bold">true</span>
+        <span style="color: #333333">}</span>
+    <span style="color: #333333">}</span>
+    <span style="color: #008800; font-weight: bold">false</span>
+<span style="color: #333333">}</span>
+
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * Closure that computes an annotation based on </span>
+<span style="color: #888888"> * presence of particular residues and features</span>
+<span style="color: #888888"> * Parameters are</span>
+<span style="color: #888888"> * - the name (label) for the alignment annotation</span>
+<span style="color: #888888"> * - the description (tooltip) for the annotation</span>
+<span style="color: #888888"> * - a closure (groovy function) that tests whether to include a residue</span>
+<span style="color: #888888"> * - a closure that tests whether to increment count based on sequence features  </span>
+<span style="color: #888888"> */</span>
+<span style="color: #333399; font-weight: bold">def</span> getColumnCounter <span
+        style="color: #333333">=</span> <span style="color: #333333">{</span> name<span
+        style="color: #333333">,</span> desc<span style="color: #333333">,</span> acceptResidue<span
+        style="color: #333333">,</span> acceptFeatures <span
+        style="color: #333333">-&gt;</span>
+    <span style="color: #333333">[</span>
+     <span style="color: #997700; font-weight: bold">getName:</span> <span
+        style="color: #333333">{</span> name <span
+        style="color: #333333">},</span> 
+     <span style="color: #997700; font-weight: bold">getDescription:</span> <span
+        style="color: #333333">{</span> desc <span
+        style="color: #333333">},</span>
+     <span style="color: #997700; font-weight: bold">getMinColour:</span> <span
+        style="color: #333333">{</span> <span style="color: #333333">[</span><span
+        style="color: #0000DD; font-weight: bold">0</span><span
+        style="color: #333333">,</span> <span
+        style="color: #0000DD; font-weight: bold">255</span><span
+        style="color: #333333">,</span> <span
+        style="color: #0000DD; font-weight: bold">255</span><span
+        style="color: #333333">]</span> <span style="color: #333333">},</span> <span
+        style="color: #888888">// cyan</span>
+     <span style="color: #997700; font-weight: bold">getMaxColour:</span> <span
+        style="color: #333333">{</span> <span style="color: #333333">[</span><span
+        style="color: #0000DD; font-weight: bold">0</span><span
+        style="color: #333333">,</span> <span
+        style="color: #0000DD; font-weight: bold">0</span><span
+        style="color: #333333">,</span> <span
+        style="color: #0000DD; font-weight: bold">255</span><span
+        style="color: #333333">]</span> <span style="color: #333333">},</span> <span
+        style="color: #888888">// blue</span>
+     <span style="color: #997700; font-weight: bold">count:</span> 
+         <span style="color: #333333">{</span> res<span
+        style="color: #333333">,</span> feats <span
+        style="color: #333333">-&gt;</span> 
+            <span style="color: #333399; font-weight: bold">def</span> c <span
+        style="color: #333333">=</span> <span
+        style="color: #0000DD; font-weight: bold">0</span>
+            <span style="color: #008800; font-weight: bold">if</span> <span
+        style="color: #333333">(</span>acceptResidue<span
+        style="color: #333333">.</span><span style="color: #0000CC">call</span><span
+        style="color: #333333">(</span>res<span style="color: #333333">))</span>
+            <span style="color: #333333">{</span>
+                <span style="color: #008800; font-weight: bold">if</span> <span
+        style="color: #333333">(</span>acceptFeatures<span
+        style="color: #333333">.</span><span style="color: #0000CC">call</span><span
+        style="color: #333333">(</span>feats<span style="color: #333333">))</span>
+                <span style="color: #333333">{</span>
+                    c<span style="color: #333333">++</span>
+                <span style="color: #333333">}</span>
+            <span style="color: #333333">}</span>
+            c
+         <span style="color: #333333">}</span>
+     <span style="color: #333333">]</span> <span
+        style="color: #008800; font-weight: bold">as</span> FeatureCounterI
+<span style="color: #333333">}</span>
+
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * Define an annotation row that counts any residue with Pfam domain annotation</span>
+<span style="color: #888888"> */</span>
+<span style="color: #333399; font-weight: bold">def</span> pfamAnnotation <span
+        style="color: #333333">=</span> getColumnCounter<span
+        style="color: #333333">(</span><span
+        style="background-color: #fff0f0">&quot;Pfam&quot;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&quot;Count of residues with Pfam domain annotation&quot;</span><span
+        style="color: #333333">,</span> <span style="color: #333333">{</span><span
+        style="color: #008800; font-weight: bold">true</span><span
+        style="color: #333333">},</span> hasPfam<span
+        style="color: #333333">)</span>
+
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * Define an annotation row that counts charged residues with Pfam domain annotation</span>
+<span style="color: #888888"> */</span>
+<span style="color: #333399; font-weight: bold">def</span> chargedPfamAnnotation <span
+        style="color: #333333">=</span> getColumnCounter<span
+        style="color: #333333">(</span><span
+        style="background-color: #fff0f0">&quot;Pfam charged&quot;</span><span
+        style="color: #333333">,</span> <span
+        style="background-color: #fff0f0">&quot;Count of charged residues with Pfam domain annotation&quot;</span><span
+        style="color: #333333">,</span> isCharged<span
+        style="color: #333333">,</span> hasPfam<span
+        style="color: #333333">)</span>
+
+<span style="color: #888888">/*</span>
+<span style="color: #888888"> * Register the annotations</span>
+<span style="color: #888888"> */</span>
+AlignmentAnnotationFactory<span style="color: #333333">.</span><span
+        style="color: #0000CC">newCalculator</span><span
+        style="color: #333333">(</span>pfamAnnotation<span
+        style="color: #333333">)</span> 
+AlignmentAnnotationFactory<span style="color: #333333">.</span><span
+        style="color: #0000CC">newCalculator</span><span
+        style="color: #333333">(</span>chargedPfamAnnotation<span
+        style="color: #333333">)</span>
+</pre>
+  </div>
+</body>
+</html>
index f8f4889..6f91d2f 100755 (executable)
@@ -25,8 +25,8 @@
 
 <body>
   <p>
-    <strong>Alignment Window Annotations Menu</strong> (Since Jalview
-    2.8.2)
+    <strong>Alignment Window Annotations Menu</strong> <em>Since Jalview
+    2.8.2</em>
   </p>
   <ul>
     <li><strong>Show Alignment Related</strong><em><br>
index ad9596a..7d07595 100755 (executable)
     <li><strong>Annotation Label Popup Menu</strong><br> <em>This
         menu is opened by clicking anywhere on the annotation row labels
         area (below the sequence ID area).</em>
+        <br/><em><strong>Mac Users:</strong> pressing CTRL whilst clicking
+      the mouse/track pad is the same as a right-click. See your
+      system's settings to configure your track-pad's corners to
+      generate right-clicks.</em>
       <ul>
         <li><strong>Add New Row</strong><br> <em>Adds a
             new, named annotation row (a dialog box will pop up for you
index cbc4217..fcfcdae 100755 (executable)
   <p>
     The <a href="popupMenu.html">Popup Menus</a> are opened by clicking
     with the right mouse button in the alignment display area or on a
-    sequence label in the alignment window.
+    sequence label in the alignment window.<br />
+    <em><strong>Mac Users:</strong> pressing CTRL whilst clicking
+      the mouse/track pad is the same as a right-click. See your
+      system's settings to configure your track-pad's corners to
+      generate right-clicks.</em>
   </p>
   <p>
     The <a href="alwannotationpanel.html">Annotations Menu</a> is opened
index 353fb41..79e7ada 100755 (executable)
 
 <body>
   <p>
-    <strong>Popup Menu</strong><br> <em>This menu is visible
-      when right clicking either within a selected region on the
-      alignment or on a selected sequence name. It may not be accessible
-      when in 'Cursor Mode' (toggled with the F2 key).</em>
+    <strong>Popup Menu</strong><br> <em>This menu is visible when
+      right clicking either within a selected region on the alignment or
+      on a selected sequence name. It may not be accessible when in
+      'Cursor Mode' (toggled with the F2 key).</em><br /> <em><strong>Mac Users:</strong> pressing CTRL whilst clicking
+        the mouse/track pad is the same as a right-click. See your
+        system's settings to configure your track-pad's corners to
+        generate right-clicks.</em>
   </p>
   <ul>
     <li><strong>Selection</strong>
       </ul></li>
     <li><strong>3D Structure Data...</strong> </strong><em>This menu is
         visible when you right-click on a sequence name. When this
-        option is clicked, Jalview will open a <a
-        href="../features/structurechooser.html"
-      >'Structure Chooser' </a> dialogue with options to select the
-        structure which will eventually be opened in a 3D interactive
-        view.<br> These entries will only be present if the
-        sequence has <a href="../features/viewingpdbs.html">associated
-          PDB structures</a>.
+        option is clicked, Jalview will open the <a
+        href="../features/structurechooser.html">'Structure
+          Chooser' </a>, which allows you to discover and view 3D structures
+        for the current selection. For more info, see <a
+        href="../features/viewingpdbs.html">viewing PDB structures</a>.
     </em></li>
     <li><strong>VARNA 2D Structure</strong><br />
     <em> If the sequence or alignment has RNA structure, then <strong>VARNA
index 22ea27e..1d17058 100644 (file)
@@ -79,7 +79,7 @@ td {
     the alignment will have a secondary structure line shown below it,
     and a number of additional options become available:
   <ul>
-    <li><a href="../colourschemes/rnahelicesColouring.html">RNA
+    <li><a href="../colourSchemes/rnahelicesColouring.html">RNA
         Helix colouring</a> - highlights columns of alignment involved in
       particular RNA helices, Uses the first displayed secondary
       structure annotation.</li>
index 51f86e1..dcf04c5 100755 (executable)
@@ -47,7 +47,7 @@
     <tr>
       <td width="60" nowrap>
         <div align="center">
-          <strong><a name="Jalview.2.10.0">2.10.0</a><br /> <em>20/9/2016</em></strong>
+          <strong><a name="Jalview.2.10.0">2.10.0</a><br /> <em>27/9/2016</em></strong>
         </div>
       </td>
       <td><em>General</em>
             <li><!-- JAL-2202 -->Position/residue shown in status bar when mousing over sequence associated annotation</li>
             <li><!-- JAL-2171 -->Default RNA SS symbol to 'matching bracket' for manual entry</li>
             <li><!-- JAL-2214 -->RNA Structure consensus indicates wc-only '()', canonical '[]' and invalid '{}' base pair populations for each column</li>
+            <li><!-- JAL-2092 -->Feature settings popup menu options for showing or hiding columns containing a feature</li>
+            <li><!-- JAL-1557 -->Edit selected group by double clicking on group and sequence associated annotation labels</li>
         </ul> <em>Application</em>
         <ul>
             <li><!-- JAL---></li>
             <li><!-- JAL---></li>
             <li><!-- JAL---></li>
             <li><!-- JAL---></li>
-            <li><!-- JAL---></li>
+            <li><!--  JAL-1957, JAL-1479 JAL-1491 -->UniProt - PDB protein structure mappings with the EMBL-EBI PDBe SIFTS database</li>          
             <li><!-- JAL-2079 -->Updated download sites used for Rfam and Pfam sources to xfam.org</li>
             <li><!-- JAL-2084 -->Disabled Rfam(Full) in the sequence fetcher</li>
             <li><!-- JAL-2123 -->Show residue labels in Chimera when mousing over sequences in Jalview</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-2027 -->Support for ENA CDS records with reverse complement operator</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-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-2068 -->Support for creating new alignment calculation workers from groovy scripts</li>
             <li><!-- JAL-1369 --->Store/restore reference sequence in Jalview projects</li>
-            <li><!-- JAL-1803-->Chain codes for a sequence's PDB associations are now saved/restored from project</li>
-            <li><!-- JAL-2183-->Double click on an entry in Jalview's database chooser opens a sequence fetcher</li>
-            <li><!-- JAL-1563-->Free-text search client for UniProt using the UniProt REST API</li>
-            
+            <li><!-- JAL-1803 -->Chain codes for a sequence's PDB associations are now saved/restored from project</li>
+            <li><!-- JAL-2183 -->Double click on an entry in Jalview's database chooser opens a sequence fetcher</li>
+            <li><!-- JAL-1563 -->Free-text search client for UniProt using the UniProt REST API</li>
+            <li><!-- JAL-2168 -->-nonews command line parameter to prevent the news reader opening</li>
+                    
              
         </ul> <em>Applet</em>
         <ul>
             <li><!--  JAL-1577 -->Colour by RNA Helices not enabled when user created annotation added to alignment</li>
             <li><!-- JAL-1841 -->RNA Structure consensus only computed for '()' base pair annotation</li>
             <li><!-- JAL-2215, JAL-1841 -->Enabling 'Ignore Gaps' results in zero scores for all base pairs in RNA Structure Consensus</li>
-            
+            <li><!-- JAL-2174-->Extend selection with columns containing feature not working</li>
+            <li><!-- JAL-2275 -->Pfam format writer puts extra space at beginning of sequence</li>            
+            <li><!-- JAL-1827 -->Incomplete sequence extracted from pdb entry 3a6s </li>
             
           </ul>
           <em>Application</em>
             <li><!--  JAL-1989  -->Hide columns not mirrored in complement view in a cDNA/Protein splitframe</li>
             <li><!--  JAL-1369 -->Cannot save/restore representative sequence from project when only one sequence is represented</li>
             <li><!-- JAL-2002 -->Disabled 'Best Uniprot Coverage' option in Structure Chooser</li>
-            <li><!-- JAL-2215 -->Modifying 'Ignore Gaps' on consensus or structure consensus didn't refresh annotation panel</li>            
+            <li><!-- JAL-2215 -->Modifying 'Ignore Gaps' on consensus or structure consensus didn't refresh annotation panel</li>
+            <li><!-- JAL-1962 -->View mapping in structure view shows mappings between sequence and all chains in a PDB file</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><!-- JAL-2151 -->Incorrect columns are selected when hidden columns present before start of sequence</li>
           </ul>
         </div>
       </td>
index ac48313..e1b00c4 100755 (executable)
       <ul>
         <li><strong>More accurate structure mappings.</strong>
           Jalview now utilises the PDBe's SIFTS database (at EMBL-EBI)
-          to match structures to UniProt sequences, even for structures
-          containing multiple copies of a sequence.</li>
+          to <a href="features/siftsmapping.html">match structures
+            to UniProt sequences</a>, even for structures containing
+          multiple copies of a sequence.</li>
         <li><strong>Import structures as mmCIF</strong>. Jalview
-          now downloads data from the EMBL-EBI's PDBe site as mmCIF.
-          mmCIF files allow Jalview to handle very large structures,
-          such as the HIV virus capsid assembly.</li>
+          now downloads data from the EMBL-EBI's PDBe site as <a href="features/mmcif.html">mmCIF</a>.
+          This allows very large structures to be imported, such as the HIV virus capsid assembly.</li>
       </ul></li>
     <li><strong>UniProt Free Text Search</strong>. The new search
       dialog for UniProt allows you to browse and retrieve sequences
index 5ac50bb..278b86e 100644 (file)
@@ -44,7 +44,7 @@ _data_column.preferred_col_width
 _data_column.is_shown_by_default
 _data_column.is_searchable
 PDB Id;pdb_id;String;g2;40;60;45;true;true
-Title;title;String;g6;300;1500;400;true;false
+Title;title;String;g6;50;1500;400;true;false
 Molecule;molecule_name;String;g3;50;400;95;false;true
 Molecule Type;molecule_type;String;g3;50;400;95;false;true
 Sequence;molecule_sequence;String;g6;50;400;95;false;false
@@ -111,7 +111,7 @@ 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
-Data Scalling Software;data_scaling_software;String;g4;50;400;95;false;false
+Data Scaling Software;data_scaling_software;String;g4;50;400;95;false;false
 Detector;detector;String;g6;50;400;95;false;false
 Detector Type;detector_type;String;g6;50;400;95;false;false
 Modified Residue Flag;modified_residue_flag;String;g6;50;400;95;false;false
index f5b4f7a..378fb64 100644 (file)
@@ -729,8 +729,8 @@ label.move_url_down = Move URL Down
 label.add_sbrs_definition = Add a SBRS Definition
 label.edit_sbrs_definition = Edit SBRS Definition
 label.delete_sbrs_definition = Delete SBRS Definition
-label.your_sequences_have_been_verified = Your sequences have been verified against known sequence databases. Some of the ids have been\n altered, most likely the start/end residue will have been updated.\n Save your alignment to maintain the updated id.\n\n
-label.sequence_names_updated = Sequence names updated
+label.your_sequences_have_been_verified = Your sequences have been verified against known sequence databases.\n(Use Calculate | Show flanking regions to show enclosing sequence.)\nTo preserve data changes, save your alignment.\n\n
+label.sequences_updated = Sequences updated
 label.dbref_search_completed = DBRef search completed
 label.show_all_chains = Show all chains
 label.fetch_all_param = Fetch all {0}
index 87538be..7bea515 100644 (file)
@@ -674,8 +674,8 @@ label.move_url_down = Mover la URL hacia abajo
 label.add_sbrs_definition = Añadir una definición SBRS 
 label.edit_sbrs_definition = Editar una definición SBRS 
 label.delete_sbrs_definition = Borrar una definición SBRS 
-label.your_sequences_have_been_verified = Sus secuencias has sido verificadas en una base de datos de secuencias conocidas. Algunos de sus ID se han alterado y\n, probablemente, el residuo de inicio/fin se haya actualizado.\nGuarde su alineamiento para mantener el ID actualizado.\n\n 
-label.sequence_names_updated = Nombres de secuencia actualizados
+label.your_sequences_have_been_verified = Sus secuencias has sido verificadas en una base de datos de secuencias conocidas.\n(Usar Calcular | Mostrar flancos para ver ampliación.)\nPara mantener los datos actualizados, guarde su alineamiento.\n\n 
+label.sequences_updated = Secuencias actualizadas
 label.dbref_search_completed = Búsqueda de DBRef terminada
 label.show_all_chains = Mostrar todas las cadenas
 label.fetch_all_param = Recuperar todas {0}
index c0c7c46..fdcf34f 100644 (file)
@@ -27,6 +27,10 @@ import ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads;
  */
 public class ChimeraManager
 {
+  private static final int REST_REPLY_TIMEOUT_MS = 15000;
+
+  private static final int CONNECTION_TIMEOUT_MS = 100;
+
   private static final boolean debug = false;
 
   private int chimeraRestPort;
@@ -782,8 +786,8 @@ public class ChimeraManager
     BufferedReader response = null;
     try
     {
-      response = HttpClientUtils
-              .doHttpUrlPost(restUrl, commands, 100, 5000);
+      response = HttpClientUtils.doHttpUrlPost(restUrl, commands, CONNECTION_TIMEOUT_MS,
+              REST_REPLY_TIMEOUT_MS);
       String line = "";
       while ((line = response.readLine()) != null)
       {
index ea330d8..c521d9b 100644 (file)
@@ -1731,8 +1731,7 @@ public class AlignmentUtils
            */
           AlignedCodonFrame dnaToCdsMapping = new AlignedCodonFrame();
           MapList dnaToCdsMap = new MapList(mapList.getFromRanges(),
-                  cdsRange, 1,
-                  1);
+                  cdsRange, 1, 1);
           dnaToCdsMapping.addMap(dnaSeq.getDatasetSequence(), cdsSeqDss,
                   dnaToCdsMap);
           if (!mappings.contains(dnaToCdsMapping))
@@ -1786,7 +1785,7 @@ public class AlignmentUtils
           /*
            * transfer any features on dna that overlap the CDS
            */
-          transferFeatures(dnaSeq, cdsSeq, cdsToProteinMap, null,
+          transferFeatures(dnaSeq, cdsSeq, dnaToCdsMap, null,
                   SequenceOntologyI.CDS);
         }
       }
index 7c07708..41324d9 100644 (file)
@@ -359,8 +359,8 @@ public class Rna
   }
 
   /**
-   * Answers true if the base-pair is either a canonical (A-T/U, C-G) or a
-   * wobble (G-T/U) pair (either way round), else false
+   * Answers true if the base-pair is either a Watson-Crick (A:T/U, C:G) or a
+   * wobble (G:T/U) pair (either way round), else false
    * 
    * @param first
    * @param second
@@ -416,6 +416,14 @@ public class Rna
     return false;
   }
 
+  /**
+   * Answers true if the base-pair is Watson-Crick - (A:T/U or C:G, either way
+   * round), else false
+   * 
+   * @param first
+   * @param second
+   * @return
+   */
   public static boolean isCanonicalPair(char first, char second)
   {
 
index 5a9cd55..79d2f1f 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.appletgui;
 
+import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.SequenceGroup;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.schemes.ColourSchemeI;
@@ -96,7 +97,8 @@ public class AnnotationColourChooser extends Panel implements
     slider.addAdjustmentListener(this);
     slider.addMouseListener(this);
 
-    if (av.getAlignment().getAlignmentAnnotation() == null)
+    AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+    if (anns == null)
     {
       return;
     }
@@ -117,11 +119,15 @@ public class AnnotationColourChooser extends Panel implements
       // seqAssociated.setState(acg.isSeqAssociated());
     }
 
-    Vector list = new Vector();
+    Vector<String> list = new Vector<String>();
     int index = 1;
-    for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+    for (int i = 0; i < anns.length; i++)
     {
-      String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+      String label = anns[i].label;
+      if (anns[i].sequenceRef != null)
+      {
+        label = label + "_" + anns[i].sequenceRef.getName();
+      }
       if (!list.contains(label))
       {
         list.addElement(label);
@@ -309,6 +315,7 @@ public class AnnotationColourChooser extends Panel implements
 
   Checkbox thresholdIsMin = new Checkbox();
 
+  @Override
   public void actionPerformed(ActionEvent evt)
   {
     if (evt.getSource() == thresholdValue)
@@ -351,6 +358,7 @@ public class AnnotationColourChooser extends Panel implements
     }
   }
 
+  @Override
   public void itemStateChanged(ItemEvent evt)
   {
     if (evt.getSource() == currentColours)
@@ -368,6 +376,7 @@ public class AnnotationColourChooser extends Panel implements
     changeColour();
   }
 
+  @Override
   public void adjustmentValueChanged(AdjustmentEvent evt)
   {
     if (!adjusting)
@@ -552,23 +561,28 @@ public class AnnotationColourChooser extends Panel implements
 
   }
 
+  @Override
   public void mouseClicked(MouseEvent evt)
   {
   }
 
+  @Override
   public void mousePressed(MouseEvent evt)
   {
   }
 
+  @Override
   public void mouseReleased(MouseEvent evt)
   {
     ap.paintAlignment(true);
   }
 
+  @Override
   public void mouseEntered(MouseEvent evt)
   {
   }
 
+  @Override
   public void mouseExited(MouseEvent evt)
   {
   }
index e3def25..a8dff62 100644 (file)
@@ -135,17 +135,22 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
     slider.addAdjustmentListener(this);
     slider.addMouseListener(this);
 
-    if (av.getAlignment().getAlignmentAnnotation() == null)
+    AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+    if (anns == null)
     {
       return;
     }
     setOldColumnSelection(av.getColumnSelection());
     adjusting = true;
-    Vector list = new Vector();
+    Vector<String> list = new Vector<String>();
     int index = 1;
-    for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+    for (int i = 0; i < anns.length; i++)
     {
-      String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+      String label = anns[i].label;
+      if (anns[i].sequenceRef != null)
+      {
+        label = label + "_" + anns[i].sequenceRef.getName();
+      }
       if (!list.contains(label))
       {
         list.addElement(label);
@@ -273,6 +278,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
     this.validate();
   }
 
+  @Override
   @SuppressWarnings("unchecked")
   public void reset()
   {
@@ -302,6 +308,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
 
   }
 
+  @Override
   public void adjustmentValueChanged(AdjustmentEvent evt)
   {
     if (!adjusting)
@@ -343,6 +350,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
     });
   }
 
+  @Override
   public void valueChanged(boolean updateAllAnnotation)
   {
     if (slider.isEnabled())
@@ -866,6 +874,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
     }
   }
 
+  @Override
   public void actionPerformed(ActionEvent evt)
   {
     if (evt.getSource() == thresholdValue)
index fc49de5..8d67d71 100644 (file)
@@ -85,45 +85,6 @@ public abstract class AnnotationRowFilter extends Panel
 
   }
 
-  public Vector getAnnotationItems(boolean isSeqAssociated)
-  {
-    Vector list = new Vector();
-    int index = 1;
-    int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length];
-    for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
-    {
-      if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null)
-      {
-        if (isSeqAssociated)
-        {
-          continue;
-        }
-      }
-      else
-      {
-        enableSeqAss = true;
-      }
-      String label = av.getAlignment().getAlignmentAnnotation()[i].label;
-      if (!list.contains(label))
-      {
-        anmap[list.size()] = i;
-        list.add(label);
-
-      }
-      else
-      {
-        if (!isSeqAssociated)
-        {
-          anmap[list.size()] = i;
-          list.add(label + "_" + (index++));
-        }
-      }
-    }
-    this.annmap = new int[list.size()];
-    System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length);
-    return list;
-  }
-
   protected int getSelectedThresholdItem(int indexValue)
   {
     int selectedThresholdItem = -1;
index 8374721..264ac14 100644 (file)
@@ -64,6 +64,8 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Vector;
 
+import org.jmol.util.Logger;
+
 public class AppletJmol extends EmbmenuFrame implements
 // StructureListener,
         KeyListener, ActionListener, ItemListener
@@ -269,6 +271,7 @@ public class AppletJmol extends EmbmenuFrame implements
       jmb.allocateViewer(renderPanel, true, ap.av.applet.getName()
               + "_jmol_", ap.av.applet.getDocumentBase(),
               ap.av.applet.getCodeBase(), "-applet", scriptWindow, null);
+      Logger.setLogLevel(Logger.LEVEL_WARN);
     } catch (Exception e)
     {
       System.err
index 31dbeac..00c8b86 100755 (executable)
@@ -444,8 +444,9 @@ public class Cache
             .println("Jalview Version: " + codeVersion + codeInstallation);
 
     StructureImportSettings.setDefaultStructureFileFormat(jalview.bin.Cache
-            .getDefault(
-"PDB_DOWNLOAD_FORMAT", PDB_DOWNLOAD_FORMAT));
+            .getDefault("PDB_DOWNLOAD_FORMAT", PDB_DOWNLOAD_FORMAT));
+    StructureImportSettings
+            .setDefaultPDBFileParser(DEFAULT_PDB_FILE_PARSER);
     // StructureImportSettings
     // .setDefaultPDBFileParser(jalview.bin.Cache.getDefault(
     // "DEFAULT_PDB_FILE_PARSER", DEFAULT_PDB_FILE_PARSER));
index 2ccf118..b1b5ce4 100644 (file)
@@ -449,12 +449,12 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
       }
       if (selectioncom.length() > 0)
       {
-        System.out.println("Select regions:\n" + selectioncom.toString());
+        // System.out.println("Select regions:\n" + selectioncom.toString());
         evalStateCommand("select *; cartoons off; backbone; select ("
                 + selectioncom.toString() + "); cartoons; ");
         // selcom.append("; ribbons; ");
         String cmdString = command.toString();
-        System.out.println("Superimpose command(s):\n" + cmdString);
+        // System.out.println("Superimpose command(s):\n" + cmdString);
 
         evalStateCommand(cmdString);
       }
@@ -465,7 +465,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
       {
         selectioncom.setLength(selectioncom.length() - 1);
       }
-      System.out.println("Select regions:\n" + selectioncom.toString());
+      // System.out.println("Select regions:\n" + selectioncom.toString());
       evalStateCommand("select *; cartoons off; backbone; select ("
               + selectioncom.toString() + "); cartoons; ");
       // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
index cef552f..65b4b96 100644 (file)
@@ -124,8 +124,13 @@ public class JmolParser extends StructureFile implements JmolStatusListener
     {
       try
       {
+        /*
+         * params -o (output to sysout) -i (no info logging, less verbose)
+         * -n (nodisplay) -x (exit when finished)
+         * see http://wiki.jmol.org/index.php/Jmol_Application
+         */
         viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null,
-                null, "-x -o -n", this);
+                null, "-x -o -n -i", this);
         // ensure the 'new' (DSSP) not 'old' (Ramachandran) SS method is used
         viewer.setBooleanProperty("defaultStructureDSSP", true);
       } catch (ClassCastException x)
index 93c9a6b..39cde03 100644 (file)
@@ -210,7 +210,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        ok_actionPerformed(e);
+        ok_actionPerformed();
       }
     });
     cancel.setOpaque(false);
@@ -220,7 +220,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        cancel_actionPerformed(e);
+        cancel_actionPerformed();
       }
     });
     defColours.setOpaque(false);
@@ -233,7 +233,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent arg0)
       {
-        resetColours_actionPerformed(arg0);
+        resetColours_actionPerformed();
       }
     });
 
@@ -242,7 +242,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        annotations_actionPerformed(e);
+        annotations_actionPerformed();
       }
     });
     getThreshold().addActionListener(new ActionListener()
@@ -250,7 +250,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        threshold_actionPerformed(e);
+        threshold_actionPerformed();
       }
     });
     thresholdValue.addActionListener(new ActionListener()
@@ -258,7 +258,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        thresholdValue_actionPerformed(e);
+        thresholdValue_actionPerformed();
       }
     });
     slider.setPaintLabels(false);
@@ -278,7 +278,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        currentColours_actionPerformed(e);
+        currentColours_actionPerformed();
       }
     });
     thresholdIsMin.setBackground(Color.white);
@@ -290,7 +290,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
-        thresholdIsMin_actionPerformed(actionEvent);
+        thresholdIsMin_actionPerformed();
       }
     });
     seqAssociated.setBackground(Color.white);
@@ -303,7 +303,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       @Override
       public void actionPerformed(ActionEvent arg0)
       {
-        seqAssociated_actionPerformed(arg0, annotations, seqAssociated);
+        seqAssociated_actionPerformed(annotations);
       }
     });
 
@@ -332,7 +332,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     this.validate();
   }
 
-  protected void resetColours_actionPerformed(ActionEvent arg0)
+  protected void resetColours_actionPerformed()
   {
     setDefaultMinMax();
     updateView();
@@ -372,6 +372,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     updateView();
   }
 
+  @Override
   public void reset()
   {
     av.setGlobalColourScheme(oldcs);
@@ -385,6 +386,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     }
   }
 
+  @Override
   public void valueChanged(boolean updateAllAnnotation)
   {
     if (slider.isEnabled())
@@ -411,7 +413,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     this.threshold = threshold;
   }
 
-  public void currentColours_actionPerformed(ActionEvent e)
+  public void currentColours_actionPerformed()
   {
     if (currentColours.isSelected())
     {
index c0d7084..1290d70 100644 (file)
@@ -178,7 +178,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        ok_actionPerformed(e);
+        ok_actionPerformed();
       }
     });
 
@@ -189,7 +189,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        cancel_actionPerformed(e);
+        cancel_actionPerformed();
       }
     });
 
@@ -201,7 +201,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        threshold_actionPerformed(e);
+        threshold_actionPerformed();
       }
     });
 
@@ -212,7 +212,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        thresholdValue_actionPerformed(e);
+        thresholdValue_actionPerformed();
       }
     });
 
@@ -288,14 +288,15 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
     String defaultTtip = MessageManager
             .getString("info.change_threshold_mode_to_enable");
 
-    String threshold = getThreshold().getSelectedItem().toString();
-    if (threshold.equalsIgnoreCase("No Threshold"))
+    String thresh = getThreshold().getSelectedItem().toString();
+    if (thresh.equalsIgnoreCase("No Threshold"))
     {
       thresholdValue.setToolTipText(defaultTtip);
       slider.setToolTipText(defaultTtip);
     }
   }
 
+  @Override
   public void reset()
   {
     if (this.getOldColumnSelection() != null)
@@ -324,6 +325,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements
 
   }
 
+  @Override
   public void valueChanged(boolean updateAllAnnotation)
   {
     if (slider.isEnabled())
index f0bea60..37f1e55 100644 (file)
@@ -26,7 +26,6 @@ import jalview.datamodel.SequenceGroup;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.util.MessageManager;
 
-import java.awt.event.ActionEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.util.Vector;
@@ -52,7 +51,7 @@ public abstract class AnnotationRowFilter extends JPanel
 
   protected boolean enableSeqAss = false;
 
-  private jalview.datamodel.AlignmentAnnotation currentAnnotation;
+  private AlignmentAnnotation currentAnnotation;
 
   protected boolean adjusting = false;
 
@@ -161,11 +160,20 @@ public abstract class AnnotationRowFilter extends JPanel
         enableSeqAss = true;
       }
       String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+      // add associated sequence ID if available
+      if (!isSeqAssociated
+              && av.getAlignment().getAlignmentAnnotation()[i].sequenceRef != null)
+      {
+        label = label
+                + "_"
+                + av.getAlignment().getAlignmentAnnotation()[i].sequenceRef
+                        .getName();
+      }
+      // make label unique
       if (!list.contains(label))
       {
         anmap[list.size()] = i;
         list.add(label);
-
       }
       else
       {
@@ -200,7 +208,7 @@ public abstract class AnnotationRowFilter extends JPanel
     seqAssociated.setEnabled(enableSeqAss);
   }
 
-  public void ok_actionPerformed(ActionEvent e)
+  public void ok_actionPerformed()
   {
     try
     {
@@ -210,7 +218,7 @@ public abstract class AnnotationRowFilter extends JPanel
     }
   }
 
-  public void cancel_actionPerformed(ActionEvent e)
+  public void cancel_actionPerformed()
   {
     reset();
     ap.paintAlignment(true);
@@ -222,22 +230,22 @@ public abstract class AnnotationRowFilter extends JPanel
     }
   }
 
-  public void thresholdCheck_actionPerformed(ActionEvent e)
+  public void thresholdCheck_actionPerformed()
   {
     updateView();
   }
 
-  public void annotations_actionPerformed(ActionEvent e)
+  public void annotations_actionPerformed()
   {
     updateView();
   }
 
-  public void threshold_actionPerformed(ActionEvent e)
+  public void threshold_actionPerformed()
   {
     updateView();
   }
 
-  public void thresholdValue_actionPerformed(ActionEvent e)
+  public void thresholdValue_actionPerformed()
   {
     try
     {
@@ -249,7 +257,7 @@ public abstract class AnnotationRowFilter extends JPanel
     }
   }
 
-  public void thresholdIsMin_actionPerformed(ActionEvent actionEvent)
+  public void thresholdIsMin_actionPerformed()
   {
     updateView();
   }
@@ -264,8 +272,7 @@ public abstract class AnnotationRowFilter extends JPanel
             .getString("label.threshold_feature_below_threshold"));
   }
 
-  protected void seqAssociated_actionPerformed(ActionEvent arg0,
-          JComboBox<String> annotations, JCheckBox seqAssociated)
+  protected void seqAssociated_actionPerformed(JComboBox<String> annotations)
   {
     adjusting = true;
     String cursel = (String) annotations.getSelectedItem();
@@ -323,25 +330,25 @@ public abstract class AnnotationRowFilter extends JPanel
   }
 
   protected boolean colorAlignmContaining(
-          AlignmentAnnotation currentAnnotation, int selectedThresholdItem)
+          AlignmentAnnotation currentAnn, int selectedThresholdOption)
   {
 
     AnnotationColourGradient acg = null;
     if (currentColours.isSelected())
     {
-      acg = new AnnotationColourGradient(currentAnnotation,
-              av.getGlobalColourScheme(), selectedThresholdItem);
+      acg = new AnnotationColourGradient(currentAnn,
+              av.getGlobalColourScheme(), selectedThresholdOption);
     }
     else
     {
-      acg = new AnnotationColourGradient(currentAnnotation,
+      acg = new AnnotationColourGradient(currentAnn,
               minColour.getBackground(), maxColour.getBackground(),
-              selectedThresholdItem);
+              selectedThresholdOption);
     }
     acg.setSeqAssociated(seqAssociated.isSelected());
 
-    if (currentAnnotation.graphMin == 0f
-            && currentAnnotation.graphMax == 0f)
+    if (currentAnn.graphMin == 0f
+            && currentAnn.graphMax == 0f)
     {
       acg.setPredefinedColours(true);
     }
@@ -362,17 +369,17 @@ public abstract class AnnotationRowFilter extends JPanel
 
         if (currentColours.isSelected())
         {
-          sg.cs = new AnnotationColourGradient(currentAnnotation, sg.cs,
-                  selectedThresholdItem);
+          sg.cs = new AnnotationColourGradient(currentAnn, sg.cs,
+                  selectedThresholdOption);
           ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
                   .isSelected());
 
         }
         else
         {
-          sg.cs = new AnnotationColourGradient(currentAnnotation,
+          sg.cs = new AnnotationColourGradient(currentAnn,
                   minColour.getBackground(), maxColour.getBackground(),
-                  selectedThresholdItem);
+                  selectedThresholdOption);
           ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated
                   .isSelected());
         }
index a1846bc..2299c26 100644 (file)
@@ -41,6 +41,7 @@ import jalview.schemes.ZappoColourScheme;
 import jalview.structures.models.AAStructureBindingModel;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
+import jalview.ws.dbsources.Pdb;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -70,6 +71,7 @@ import javax.swing.JMenuItem;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JSplitPane;
+import javax.swing.SwingUtilities;
 import javax.swing.event.InternalFrameAdapter;
 import javax.swing.event.InternalFrameEvent;
 import javax.swing.event.MenuEvent;
@@ -77,6 +79,10 @@ import javax.swing.event.MenuListener;
 
 public class AppJmol extends StructureViewerBase
 {
+  private static final String SPACE = " ";
+
+  private static final String BACKSLASH = "\"";
+
   AppJmolBinding jmb;
 
   JPanel scriptWindow;
@@ -375,8 +381,11 @@ public class AppJmol extends StructureViewerBase
       scriptWindow.setVisible(false);
     }
 
-    jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow,
-            null);
+    /*
+     * -i for no info logging (less verbose)
+     */
+    jmb.allocateViewer(renderPanel, true, "", null, null, "-i",
+            scriptWindow, null);
     // jmb.newJmolPopup("Jmol");
     if (command == null)
     {
@@ -475,15 +484,163 @@ public class AppJmol extends StructureViewerBase
   public void run()
   {
     _started = true;
+    try
+    {
+      List<String> files = fetchPdbFiles();
+      if (files.size() > 0)
+      {
+        showFilesInViewer(files);
+      }
+    } finally
+    {
+      _started = false;
+      worker = null;
+    }
+  }
+
+  /**
+   * Either adds the given files to a structure viewer or opens a new viewer to
+   * show them
+   * 
+   * @param files
+   *          list of absolute paths to structure files
+   */
+  void showFilesInViewer(List<String> files)
+  {
+    long lastnotify = jmb.getLoadNotifiesHandled();
+    StringBuilder fileList = new StringBuilder();
+    for (String s : files)
+    {
+      fileList.append(SPACE).append(BACKSLASH).append(Platform.escapeString(s))
+              .append(BACKSLASH);
+    }
+    String filesString = fileList.toString();
+
+    if (!addingStructures)
+    {
+      try
+      {
+        initJmol("load FILES " + filesString);
+      } catch (OutOfMemoryError oomerror)
+      {
+        new OOMWarning("When trying to open the Jmol viewer!", oomerror);
+        Cache.log.debug("File locations are " + filesString);
+      } catch (Exception ex)
+      {
+        Cache.log.error("Couldn't open Jmol viewer!", ex);
+      }
+    }
+    else
+    {
+      StringBuilder cmd = new StringBuilder();
+      cmd.append("loadingJalviewdata=true\nload APPEND ");
+      cmd.append(filesString);
+      cmd.append("\nloadingJalviewdata=null");
+      final String command = cmd.toString();
+      lastnotify = jmb.getLoadNotifiesHandled();
+
+      try
+      {
+        jmb.evalStateCommand(command);
+      } catch (OutOfMemoryError oomerror)
+      {
+        new OOMWarning(
+                "When trying to add structures to the Jmol viewer!",
+                oomerror);
+        Cache.log.debug("File locations are " + filesString);
+      } catch (Exception ex)
+      {
+        Cache.log.error("Couldn't add files to Jmol viewer!", ex);
+      }
+    }
+
+    // need to wait around until script has finished
+    int waitMax = 5000; // give up after 5 seconds
+    int waitFor = 35;
+    int waitTotal = 0;
+    while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
+            : !(jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb
+                    .getPdbFile().length == files.size()))
+    {
+      try
+      {
+        Cache.log.debug("Waiting around for jmb notify.");
+        Thread.sleep(waitFor);
+        waitTotal += waitFor;
+      } catch (Exception e)
+      {
+      }
+      if (waitTotal > waitMax)
+      {
+        System.err.println("Timed out waiting for Jmol to load files");
+        break;
+      }
+    }
+
+    // refresh the sequence colours for the new structure(s)
+    for (AlignmentPanel ap : _colourwith)
+    {
+      jmb.updateColours(ap);
+    }
+    // do superposition if asked to
+    if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
+    {
+      alignAddedStructures();
+    }
+    addingStructures = false;
+  }
+
+  /**
+   * Queues a thread to align structures with Jalview alignments
+   */
+  void alignAddedStructures()
+  {
+    javax.swing.SwingUtilities.invokeLater(new Runnable()
+    {
+      @Override
+      public void run()
+      {
+        if (jmb.viewer.isScriptExecuting())
+        {
+          SwingUtilities.invokeLater(this);
+          try
+          {
+            Thread.sleep(5);
+          } catch (InterruptedException q)
+          {
+          }
+          return;
+        }
+        else
+        {
+          alignStructs_withAllAlignPanels();
+        }
+      }
+    });
+    alignAddedStructures = false;
+  }
+
+  /**
+   * Retrieves and saves as file any modelled PDB entries for which we do not
+   * already have a file saved. Returns a list of absolute paths to structure
+   * files which were either retrieved, or already stored but not modelled in
+   * the structure viewer (i.e. files to add to the viewer display).
+   * 
+   * @return
+   */
+  List<String> fetchPdbFiles()
+  {
+    // todo - record which pdbids were successfully imported.
+    StringBuilder errormsgs = new StringBuilder();
+
+    List<String> files = new ArrayList<String>();
     String pdbid = "";
-    // todo - record which pdbids were successfuly imported.
-    StringBuffer errormsgs = new StringBuffer(), files = new StringBuffer();
     try
     {
-      String[] curfiles = jmb.getPdbFile(); // files currently in viewer
+      String[] filesInViewer = jmb.getPdbFile();
       // TODO: replace with reference fetching/transfer code (validate PDBentry
       // as a DBRef?)
-      jalview.ws.dbsources.Pdb pdbclient = new jalview.ws.dbsources.Pdb();
+      Pdb pdbclient = new Pdb();
       for (int pi = 0; pi < jmb.getPdbCount(); pi++)
       {
         String file = jmb.getPdbEntry(pi).getFile();
@@ -507,12 +664,15 @@ public class AppJmol extends StructureViewerBase
           } catch (Exception ex)
           {
             ex.printStackTrace();
-            errormsgs.append("'" + pdbid + "'");
-          }
-          if (progressBar != null)
+            errormsgs.append("'").append(pdbid).append("'");
+          } finally
           {
-            progressBar.setProgressBar(
-                    MessageManager.getString("label.state_completed"), hdl);
+            if (progressBar != null)
+            {
+              progressBar.setProgressBar(
+                      MessageManager.getString("label.state_completed"),
+                      hdl);
+            }
           }
           if (pdbseq != null)
           {
@@ -521,22 +681,21 @@ public class AppJmol extends StructureViewerBase
             file = new File(pdbseq.getSequenceAt(0).getAllPDBEntries()
                     .elementAt(0).getFile()).getAbsolutePath();
             jmb.getPdbEntry(pi).setFile(file);
-
-            files.append(" \"" + Platform.escapeString(file) + "\"");
+            files.add(file);
           }
           else
           {
-            errormsgs.append("'" + pdbid + "' ");
+            errormsgs.append("'").append(pdbid).append("' ");
           }
         }
         else
         {
-          if (curfiles != null && curfiles.length > 0)
+          if (filesInViewer != null && filesInViewer.length > 0)
           {
             addingStructures = true; // already files loaded.
-            for (int c = 0; c < curfiles.length; c++)
+            for (int c = 0; c < filesInViewer.length; c++)
             {
-              if (curfiles[c].equals(file))
+              if (filesInViewer[c].equals(file))
               {
                 file = null;
                 break;
@@ -545,7 +704,7 @@ public class AppJmol extends StructureViewerBase
           }
           if (file != null)
           {
-            files.append(" \"" + Platform.escapeString(file) + "\"");
+            files.add(file);
           }
         }
       }
@@ -555,114 +714,18 @@ public class AppJmol extends StructureViewerBase
     } catch (Exception ex)
     {
       ex.printStackTrace();
-      errormsgs.append("When retrieving pdbfiles : current was: '" + pdbid
-              + "'");
+      errormsgs.append("When retrieving pdbfiles : current was: '")
+              .append(pdbid).append("'");
     }
     if (errormsgs.length() > 0)
     {
-
       JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
               .formatMessage("label.pdb_entries_couldnt_be_retrieved",
                       new String[] { errormsgs.toString() }),
               MessageManager.getString("label.couldnt_load_file"),
               JOptionPane.ERROR_MESSAGE);
-
-    }
-    long lastnotify = jmb.getLoadNotifiesHandled();
-    if (files.length() > 0)
-    {
-      if (!addingStructures)
-      {
-
-        try
-        {
-          initJmol("load FILES " + files.toString());
-        } catch (OutOfMemoryError oomerror)
-        {
-          new OOMWarning("When trying to open the Jmol viewer!", oomerror);
-          Cache.log.debug("File locations are " + files);
-        } catch (Exception ex)
-        {
-          Cache.log.error("Couldn't open Jmol viewer!", ex);
-        }
-      }
-      else
-      {
-        StringBuffer cmd = new StringBuffer();
-        cmd.append("loadingJalviewdata=true\nload APPEND ");
-        cmd.append(files.toString());
-        cmd.append("\nloadingJalviewdata=null");
-        final String command = cmd.toString();
-        cmd = null;
-        lastnotify = jmb.getLoadNotifiesHandled();
-
-        try
-        {
-          jmb.evalStateCommand(command);
-        } catch (OutOfMemoryError oomerror)
-        {
-          new OOMWarning(
-                  "When trying to add structures to the Jmol viewer!",
-                  oomerror);
-          Cache.log.debug("File locations are " + files);
-        } catch (Exception ex)
-        {
-          Cache.log.error("Couldn't add files to Jmol viewer!", ex);
-        }
-      }
-
-      // need to wait around until script has finished
-      while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
-              : (!jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb
-                      .getPdbFile().length != jmb.getPdbCount()))
-      {
-        try
-        {
-          Cache.log.debug("Waiting around for jmb notify.");
-          Thread.sleep(35);
-        } catch (Exception e)
-        {
-        }
-      }
-
-      // refresh the sequence colours for the new structure(s)
-      for (AlignmentPanel ap : _colourwith)
-      {
-        jmb.updateColours(ap);
-      }
-      // do superposition if asked to
-      if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
-      {
-        javax.swing.SwingUtilities.invokeLater(new Runnable()
-        {
-          @Override
-          public void run()
-          {
-            if (jmb.viewer.isScriptExecuting())
-            {
-              javax.swing.SwingUtilities.invokeLater(this);
-              try
-              {
-                Thread.sleep(5);
-              } catch (InterruptedException q)
-              {
-              }
-              ;
-              return;
-            }
-            else
-            {
-              alignStructs_withAllAlignPanels();
-            }
-          }
-        });
-        alignAddedStructures = false;
-      }
-      addingStructures = false;
-
     }
-    _started = false;
-    worker = null;
+    return files;
   }
 
   @Override
index 33c7ff3..af8b2f3 100644 (file)
@@ -65,8 +65,6 @@ import javax.swing.table.AbstractTableModel;
 public class StructureChooser extends GStructureChooser implements
         IProgressIndicator
 {
-  private boolean structuresDiscovered = false;
-
   private SequenceI selectedSequence;
 
   private SequenceI[] selectedSequences;
@@ -103,6 +101,8 @@ public class StructureChooser extends GStructureChooser implements
       progressBar = new ProgressBar(this.statusPanel, this.statusBar);
     }
 
+    // ensure a filter option is in force for search
+    populateFilterComboBox(true);
     Thread discoverPDBStructuresThread = new Thread(new Runnable()
     {
       @Override
@@ -117,7 +117,8 @@ public class StructureChooser extends GStructureChooser implements
                 .getString("status.searching_for_pdb_structures"),
                 startTime);
         fetchStructuresMetaData();
-        populateFilterComboBox();
+        // revise filter options if no results were found
+        populateFilterComboBox(isStructuresDiscovered());
         updateProgressIndicator(null, startTime);
         mainFrame.setVisible(true);
         updateCurrentView();
@@ -161,6 +162,10 @@ public class StructureChooser extends GStructureChooser implements
       pdbRequest.setAllowEmptySeq(false);
       pdbRequest.setResponseSize(500);
       pdbRequest.setFieldToSearchBy("(");
+      FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+              .getSelectedItem());
+      pdbRequest.setFieldToSortBy(selectedFilterOpt.getValue(),
+              !chk_invertFilter.isSelected());
       pdbRequest.setWantedFields(wantedFields);
       pdbRequest.setSearchTerm(buildQuery(seq) + ")");
       pdbRequest.setAssociatedSequence(seq);
@@ -191,7 +196,6 @@ public class StructureChooser extends GStructureChooser implements
       getResultTable().setModel(
               FTSRestResponse.getTableModel(lastPdbRequest,
               discoveredStructuresSet));
-      structuresDiscovered = true;
       noOfStructuresFound = discoveredStructuresSet.size();
       mainFrame.setTitle(MessageManager.formatMessage(
               "label.structure_chooser_no_of_structures",
@@ -524,10 +528,15 @@ public class StructureChooser extends GStructureChooser implements
    * Populates the filter combo-box options dynamically depending on discovered
    * structures
    */
-  @Override
-  protected void populateFilterComboBox()
+  protected void populateFilterComboBox(boolean haveData)
   {
-    if (isStructuresDiscovered())
+    /*
+     * temporarily suspend the change listener behaviour
+     */
+    cmb_filterOption.removeItemListener(this);
+
+    cmb_filterOption.removeAllItems();
+    if (haveData)
     {
       cmb_filterOption.addItem(new FilterOption("Best Quality",
               "overall_quality", VIEWS_FILTER));
@@ -546,12 +555,13 @@ public class StructureChooser extends GStructureChooser implements
             VIEWS_FROM_FILE));
     cmb_filterOption.addItem(new FilterOption("Cached PDB Entries", "-",
             VIEWS_LOCAL_PDB));
+
+    cmb_filterOption.addItemListener(this);
   }
 
   /**
    * Updates the displayed view based on the selected filter option
    */
-  @Override
   protected void updateCurrentView()
   {
     FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
@@ -717,6 +727,7 @@ public class StructureChooser extends GStructureChooser implements
   {
     final long progressSessionId = System.currentTimeMillis();
     final StructureSelectionManager ssm = ap.getStructureSelectionManager();
+    final int preferredHeight = pnl_filter.getHeight();
     ssm.setProgressIndicator(this);
     ssm.setProgressSessionId(progressSessionId);
     new Thread(new Runnable()
@@ -724,84 +735,82 @@ public class StructureChooser extends GStructureChooser implements
       @Override
       public void run()
       {
-    FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
-            .getSelectedItem());
-    String currentView = selectedFilterOpt.getView();
-    if (currentView == VIEWS_FILTER)
-    {
+        FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+                .getSelectedItem());
+        String currentView = selectedFilterOpt.getView();
+        if (currentView == VIEWS_FILTER)
+        {
           int pdbIdColIndex = getResultTable().getColumn("PDB Id")
                   .getModelIndex();
           int refSeqColIndex = getResultTable().getColumn("Ref Sequence")
-              .getModelIndex();
+                  .getModelIndex();
           int[] selectedRows = getResultTable().getSelectedRows();
-      PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
-      int count = 0;
-      ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
-      for (int row : selectedRows)
-      {
+          PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+          int count = 0;
+          ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+          for (int row : selectedRows)
+          {
             String pdbIdStr = getResultTable().getValueAt(row,
-                    pdbIdColIndex)
-                .toString();
+                    pdbIdColIndex).toString();
             SequenceI selectedSeq = (SequenceI) getResultTable()
-                    .getValueAt(row,
-                refSeqColIndex);
-        selectedSeqsToView.add(selectedSeq);
+                    .getValueAt(row, refSeqColIndex);
+            selectedSeqsToView.add(selectedSeq);
             PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
             if (pdbEntry == null)
             {
               pdbEntry = getFindEntry(pdbIdStr,
                       selectedSeq.getAllPDBEntries());
             }
-        if (pdbEntry == null)
-        {
-          pdbEntry = new PDBEntry();
-          pdbEntry.setId(pdbIdStr);
-          pdbEntry.setType(PDBEntry.Type.PDB);
-          selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
-        }
-        pdbEntriesToView[count++] = pdbEntry;
-      }
-      SequenceI[] selectedSeqs = selectedSeqsToView
-              .toArray(new SequenceI[selectedSeqsToView.size()]);
+            if (pdbEntry == null)
+            {
+              pdbEntry = new PDBEntry();
+              pdbEntry.setId(pdbIdStr);
+              pdbEntry.setType(PDBEntry.Type.PDB);
+              selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
+            }
+            pdbEntriesToView[count++] = pdbEntry;
+          }
+          SequenceI[] selectedSeqs = selectedSeqsToView
+                  .toArray(new SequenceI[selectedSeqsToView.size()]);
           launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
-    }
-    else if (currentView == VIEWS_LOCAL_PDB)
-    {
-      int[] selectedRows = tbl_local_pdb.getSelectedRows();
-      PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
-      int count = 0;
+        }
+        else if (currentView == VIEWS_LOCAL_PDB)
+        {
+          int[] selectedRows = tbl_local_pdb.getSelectedRows();
+          PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+          int count = 0;
           int pdbIdColIndex = tbl_local_pdb.getColumn("PDB Id")
                   .getModelIndex();
-      int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
-              .getModelIndex();
-      ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
-      for (int row : selectedRows)
-      {
-        PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
-                pdbIdColIndex);
-        pdbEntriesToView[count++] = pdbEntry;
-        SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(row,
-                refSeqColIndex);
-        selectedSeqsToView.add(selectedSeq);
-      }
-      SequenceI[] selectedSeqs = selectedSeqsToView
-              .toArray(new SequenceI[selectedSeqsToView.size()]);
+          int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
+                  .getModelIndex();
+          ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+          for (int row : selectedRows)
+          {
+            PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
+                    pdbIdColIndex);
+            pdbEntriesToView[count++] = pdbEntry;
+            SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(
+                    row, refSeqColIndex);
+            selectedSeqsToView.add(selectedSeq);
+          }
+          SequenceI[] selectedSeqs = selectedSeqsToView
+                  .toArray(new SequenceI[selectedSeqsToView.size()]);
           launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
-    }
-    else if (currentView == VIEWS_ENTER_ID)
-    {
-      SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
-              .getCmb_assSeq().getSelectedItem()).getSequence();
-      if (userSelectedSeq != null)
-      {
-        selectedSequence = userSelectedSeq;
-      }
+        }
+        else if (currentView == VIEWS_ENTER_ID)
+        {
+          SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
+                  .getCmb_assSeq().getSelectedItem()).getSequence();
+          if (userSelectedSeq != null)
+          {
+            selectedSequence = userSelectedSeq;
+          }
 
-      String pdbIdStr = txt_search.getText();
-      PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
-      if (pdbEntry == null)
-      {
-        pdbEntry = new PDBEntry();
+          String pdbIdStr = txt_search.getText();
+          PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
+          if (pdbEntry == null)
+          {
+            pdbEntry = new PDBEntry();
             if (pdbIdStr.split(":").length > 1)
             {
               pdbEntry.setId(pdbIdStr.split(":")[0]);
@@ -811,31 +820,31 @@ public class StructureChooser extends GStructureChooser implements
             {
               pdbEntry.setId(pdbIdStr);
             }
-        pdbEntry.setType(PDBEntry.Type.PDB);
-        selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
-      }
+            pdbEntry.setType(PDBEntry.Type.PDB);
+            selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
+          }
 
-      PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
+          PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
           launchStructureViewer(ssm, pdbEntriesToView, ap,
                   new SequenceI[] { selectedSequence });
-    }
-    else if (currentView == VIEWS_FROM_FILE)
-    {
-      SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
-              .getCmb_assSeq().getSelectedItem()).getSequence();
-      if (userSelectedSeq != null)
-      {
-        selectedSequence = userSelectedSeq;
-      }
-      PDBEntry fileEntry = new AssociatePdbFileWithSeq()
-              .associatePdbWithSeq(selectedPdbFileName,
-                      jalview.io.AppletFormatAdapter.FILE,
-                      selectedSequence, true, Desktop.instance);
+        }
+        else if (currentView == VIEWS_FROM_FILE)
+        {
+          SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
+                  .getCmb_assSeq().getSelectedItem()).getSequence();
+          if (userSelectedSeq != null)
+          {
+            selectedSequence = userSelectedSeq;
+          }
+          PDBEntry fileEntry = new AssociatePdbFileWithSeq()
+                  .associatePdbWithSeq(selectedPdbFileName,
+                          jalview.io.AppletFormatAdapter.FILE,
+                          selectedSequence, true, Desktop.instance);
 
           launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap,
                   new SequenceI[] { selectedSequence });
-    }
-        closeAction();
+        }
+        closeAction(preferredHeight);
       }
     }).start();
   }
@@ -865,7 +874,7 @@ public class StructureChooser extends GStructureChooser implements
 
     if (SiftsSettings.isMapWithSifts())
     {
-      ArrayList<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
+      List<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
       int p = 0;
       // TODO: skip PDBEntry:Sequence pairs where PDBEntry doesn't look like a
       // real PDB ID. For moment, we can also safely do this if there is already
@@ -906,7 +915,8 @@ public class StructureChooser extends GStructureChooser implements
         {
           seqWithoutSrcDBRef[x++] = fSeq;
         }
-        new DBRefFetcher(seqWithoutSrcDBRef).fetchDBRefs(true);
+        DBRefFetcher dbRefFetcher = new DBRefFetcher(seqWithoutSrcDBRef);
+        dbRefFetcher.fetchDBRefs(true);
       }
     }
     if (pdbEntriesToView.length > 1)
@@ -963,12 +973,8 @@ public class StructureChooser extends GStructureChooser implements
 
   public boolean isStructuresDiscovered()
   {
-    return structuresDiscovered;
-  }
-
-  public void setStructuresDiscovered(boolean structuresDiscovered)
-  {
-    this.structuresDiscovered = structuresDiscovered;
+    return discoveredStructuresSet != null
+            && !discoveredStructuresSet.isEmpty();
   }
 
   public Collection<FTSData> getDiscoveredStructuresSet()
index 552f00e..9695891 100755 (executable)
@@ -278,11 +278,36 @@ public class AppletFormatAdapter
         alignFile = new JPredFile(inFile, type);
         ((JPredFile) alignFile).removeNonSequences();
       }
-      else if (format.equals("PDB") || format.equalsIgnoreCase("mmCIF"))
+      else if (format.equals("PDB"))
+      {
+        // TODO obtain config value from preference settings.
+        // Set value to 'true' to test PDB processing with Jmol: JAL-1213
+        boolean isParseWithJMOL = StructureImportSettings
+                .getDefaultPDBFileParser().equalsIgnoreCase(
+                        StructureImportSettings.StructureParser.JMOL_PARSER
+                                .toString());
+        if (isParseWithJMOL)
+        {
+          StructureImportSettings.addSettings(annotFromStructure,
+                  localSecondaryStruct, serviceSecondaryStruct);
+          alignFile = new jalview.ext.jmol.JmolParser(inFile, type);
+        }
+        else
+        {
+          StructureImportSettings.addSettings(annotFromStructure,
+                  localSecondaryStruct, serviceSecondaryStruct);
+          StructureImportSettings.setShowSeqFeatures(true);
+          alignFile = new MCview.PDBfile(annotFromStructure,
+                  localSecondaryStruct, serviceSecondaryStruct, inFile,
+                  type);
+        }
+        ((StructureFile) alignFile).setDbRefType(format);
+      }
+      else if (format.equalsIgnoreCase("mmCIF"))
       {
         StructureImportSettings.addSettings(annotFromStructure,
                 localSecondaryStruct, serviceSecondaryStruct);
-        alignFile = new JmolParser(inFile, type);
+        alignFile = new jalview.ext.jmol.JmolParser(inFile, type);
         ((StructureFile) alignFile).setDbRefType(format);
       }
       else if (format.equals("STH"))
index ecce1a3..5294c45 100644 (file)
@@ -8,10 +8,10 @@ import java.awt.Color;
 
 public class PDBFeatureSettings extends FeatureSettingsAdapter
 {
+  // TODO find one central place to define feature names
+  private static final String FEATURE_INSERTION = "INSERTION";
 
-  public static final String FEATURE_INSERTION = "INSERTION";
-
-  public static final String FEATURE_RES_NUM = "RESNUM";
+  private static final String FEATURE_RES_NUM = "RESNUM";
 
   @Override
   public boolean isFeatureDisplayed(String type)
index 1348e59..4d66a18 100644 (file)
@@ -166,7 +166,7 @@ public abstract class GStructureChooser extends JPanel implements
 
   protected JScrollPane scrl_localPDB = new JScrollPane(tbl_local_pdb);
 
-  private JTabbedPane pnl_filter = new JTabbedPane();
+  protected JTabbedPane pnl_filter = new JTabbedPane();
 
   protected FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
           PreferenceSource.STRUCTURE_CHOOSER,
@@ -414,7 +414,7 @@ public abstract class GStructureChooser extends JPanel implements
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        closeAction();
+        closeAction(pnl_filter.getHeight());
       }
     });
     btn_cancel.addKeyListener(new KeyAdapter()
@@ -424,7 +424,7 @@ public abstract class GStructureChooser extends JPanel implements
       {
         if (evt.getKeyCode() == KeyEvent.VK_ENTER)
         {
-          closeAction();
+          closeAction(pnl_filter.getHeight());
         }
       }
     });
@@ -577,7 +577,7 @@ public abstract class GStructureChooser extends JPanel implements
               @Override
               public void internalFrameClosing(InternalFrameEvent e)
               {
-                closeAction();
+                closeAction(pnl_filter.getHeight());
               }
             });
     mainFrame.setVisible(true);
@@ -592,7 +592,7 @@ public abstract class GStructureChooser extends JPanel implements
     Desktop.addInternalFrame(mainFrame, frameTitle, width, height);
   }
 
-  protected void closeAction()
+  protected void closeAction(int preferredHeight)
   {
     // System.out.println(">>>>>>>>>> closing internal frame!!!");
     // System.out.println("width : " + mainFrame.getWidth());
@@ -600,11 +600,12 @@ public abstract class GStructureChooser extends JPanel implements
     // System.out.println("x : " + mainFrame.getX());
     // System.out.println("y : " + mainFrame.getY());
     tempUserPrefs.put("structureChooser.width", pnl_filter.getWidth());
-    tempUserPrefs.put("structureChooser.height", pnl_filter.getHeight());
+    tempUserPrefs.put("structureChooser.height", preferredHeight);
     tempUserPrefs.put("structureChooser.x", mainFrame.getX());
     tempUserPrefs.put("structureChooser.y", mainFrame.getY());
     mainFrame.dispose();
   }
+
   public boolean wantedFieldsUpdated()
   {
     if (previousWantedFields == null)
@@ -801,10 +802,6 @@ public abstract class GStructureChooser extends JPanel implements
 
   protected abstract void stateChanged(ItemEvent e);
 
-  protected abstract void updateCurrentView();
-
-  protected abstract void populateFilterComboBox();
-
   protected abstract void ok_ActionPerformed();
 
   protected abstract void pdbFromFile_actionPerformed();
index 62f3a2e..2be51c2 100644 (file)
@@ -86,6 +86,10 @@ public class TCoffeeColourScheme extends ResidueColourScheme
     seqMap = new IdentityHashMap<SequenceI, Color[]>();
     AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment
             : alignment.getContext();
+    if (alcontext == null)
+    {
+      return;
+    }
     int w = 0;
     for (AlignmentAnnotation al : alcontext
             .findAnnotation(TCoffeeScoreFile.TCOFFEE_SCORE))
index ca403c5..453cd00 100644 (file)
@@ -29,15 +29,19 @@ import jalview.datamodel.Mapping;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.gui.CutAndPasteTransfer;
+import jalview.gui.DasSourceBrowser;
 import jalview.gui.Desktop;
 import jalview.gui.FeatureSettings;
 import jalview.gui.IProgressIndicator;
 import jalview.gui.OOMWarning;
+import jalview.util.DBRefUtils;
 import jalview.util.MessageManager;
 import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.dbsources.das.datamodel.DasSequenceSource;
 import jalview.ws.seqfetcher.DbSourceProxy;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.List;
@@ -45,6 +49,7 @@ import java.util.StringTokenizer;
 import java.util.Vector;
 
 import uk.ac.ebi.picr.model.UPEntry;
+import uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator;
 
 /**
  * Implements a runnable for validating a sequence against external databases
@@ -55,21 +60,19 @@ import uk.ac.ebi.picr.model.UPEntry;
  */
 public class DBRefFetcher implements Runnable
 {
+  private static final String NEWLINE = System.lineSeparator();
+
   public interface FetchFinishedListenerI
   {
     void finished();
   }
 
-  private List<FetchFinishedListenerI> listeners;
-
   SequenceI[] dataset;
 
   IProgressIndicator progressWindow;
 
   CutAndPasteTransfer output = new CutAndPasteTransfer();
 
-  StringBuffer sbuffer = new StringBuffer();
-
   boolean running = false;
 
   /**
@@ -77,17 +80,19 @@ public class DBRefFetcher implements Runnable
    */
   uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface picrClient = null;
 
-  // /This will be a collection of Vectors of sequenceI refs.
+  // This will be a collection of Vectors of sequenceI refs.
   // The key will be the seq name or accession id of the seq
-  Hashtable seqRefs;
+  Hashtable<String, Vector<SequenceI>> seqRefs;
 
   DbSourceProxy[] dbSources;
 
   SequenceFetcher sfetcher;
 
+  private List<FetchFinishedListenerI> listeners;
+
   private SequenceI[] alseqs;
 
-  /**
+  /*
    * when true - retrieved sequences will be trimmed to cover longest derived
    * alignment sequence
    */
@@ -137,59 +142,74 @@ public class DBRefFetcher implements Runnable
     trimDsSeqs = Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true);
     if (sources == null)
     {
-      // af.featureSettings_actionPerformed(null);
-      String[] defdb = null, otherdb = sfetcher
-              .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
-      List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
-      Vector<jalviewSourceI> dasselsrc = (featureSettings != null) ? featureSettings
-              .getSelectedSources() : new jalview.gui.DasSourceBrowser()
-              .getSelectedSources();
-      Enumeration<jalviewSourceI> en = dasselsrc.elements();
-      while (en.hasMoreElements())
+      setDatabaseSources(featureSettings, isNucleotide);
+    }
+    else
+    {
+      // we assume the caller knows what they're doing and ensured that all the
+      // db source names are valid
+      dbSources = sources;
+    }
+  }
+
+  /**
+   * Helper method to configure the list of database sources to query
+   * 
+   * @param featureSettings
+   * @param forNucleotide
+   */
+  void setDatabaseSources(FeatureSettings featureSettings,
+          boolean forNucleotide)
+  {
+    // af.featureSettings_actionPerformed(null);
+    String[] defdb = null;
+    List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
+    Vector<jalviewSourceI> dasselsrc = (featureSettings != null) ? featureSettings
+            .getSelectedSources() : new DasSourceBrowser()
+            .getSelectedSources();
+
+    for (jalviewSourceI src : dasselsrc)
+    {
+      List<DbSourceProxy> sp = src.getSequenceSourceProxies();
+      if (sp != null)
       {
-        jalviewSourceI src = en.nextElement();
-        List<DbSourceProxy> sp = src.getSequenceSourceProxies();
-        if (sp != null)
+        selsources.addAll(sp);
+        if (sp.size() > 1)
         {
-          selsources.addAll(sp);
-          if (sp.size() > 1)
-          {
-            Cache.log.debug("Added many Db Sources for :" + src.getTitle());
-          }
+          Cache.log.debug("Added many Db Sources for :" + src.getTitle());
         }
       }
-      // select appropriate databases based on alignFrame context.
-      if (isNucleotide)
-      {
-        defdb = DBRefSource.DNACODINGDBS;
-      }
-      else
-      {
-        defdb = DBRefSource.PROTEINDBS;
-      }
-      List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
-      for (String ddb : defdb)
+    }
+    // select appropriate databases based on alignFrame context.
+    if (forNucleotide)
+    {
+      defdb = DBRefSource.DNACODINGDBS;
+    }
+    else
+    {
+      defdb = DBRefSource.PROTEINDBS;
+    }
+    List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
+    for (String ddb : defdb)
+    {
+      List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
+      if (srcesfordb != null)
       {
-        List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
-        if (srcesfordb != null)
+        for (DbSourceProxy src : srcesfordb)
         {
-          srces.addAll(srcesfordb);
+          if (!srces.contains(src))
+          {
+            srces.addAll(srcesfordb);
+          }
         }
       }
-      // append the PDB data source, since it is 'special', catering for both
-      // nucleotide and protein
-      srces.addAll(sfetcher.getSourceProxy(DBRefSource.PDB));
-
-      // append the selected sequence sources to the default dbs
-      srces.addAll(selsources);
-      dbSources = srces.toArray(new DbSourceProxy[0]);
-    }
-    else
-    {
-      // we assume the caller knows what they're doing and ensured that all the
-      // db source names are valid
-      dbSources = sources;
     }
+    // append the PDB data source, since it is 'special', catering for both
+    // nucleotide and protein
+    // srces.addAll(sfetcher.getSourceProxy(DBRefSource.PDB));
+
+    srces.addAll(selsources);
+    dbSources = srces.toArray(new DbSourceProxy[srces.size()]);
   }
 
   /**
@@ -224,7 +244,7 @@ public class DBRefFetcher implements Runnable
     }
     // append additional sources
     DbSourceProxy[] otherdb = sfetcher
-            .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
+            .getDbSourceProxyInstances(DasSequenceSource.class);
     if (otherdb != null && otherdb.length > 0)
     {
       DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length
@@ -243,6 +263,9 @@ public class DBRefFetcher implements Runnable
    */
   public void fetchDBRefs(boolean waitTillFinished)
   {
+    // TODO can we not simply write
+    // if (waitTillFinished) { run(); } else { new Thread(this).start(); }
+
     Thread thread = new Thread(this);
     thread.start();
     running = true;
@@ -274,10 +297,10 @@ public class DBRefFetcher implements Runnable
   {
     key = key.toUpperCase();
 
-    Vector seqs;
+    Vector<SequenceI> seqs;
     if (seqRefs.containsKey(key))
     {
-      seqs = (Vector) seqRefs.get(key);
+      seqs = seqRefs.get(key);
 
       if (seqs != null && !seqs.contains(seq))
       {
@@ -285,14 +308,14 @@ public class DBRefFetcher implements Runnable
       }
       else if (seqs == null)
       {
-        seqs = new Vector();
+        seqs = new Vector<SequenceI>();
         seqs.addElement(seq);
       }
 
     }
     else
     {
-      seqs = new Vector();
+      seqs = new Vector<SequenceI>();
       seqs.addElement(seq);
     }
 
@@ -323,7 +346,7 @@ public class DBRefFetcher implements Runnable
     {
       if (Cache.getDefault("DBREFFETCH_USEPICR", false))
       {
-        picrClient = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator()
+        picrClient = new AccessionMapperServiceLocator()
                 .getAccessionMapperPort();
       }
     } catch (Exception e)
@@ -331,149 +354,145 @@ public class DBRefFetcher implements Runnable
       System.err.println("Couldn't locate PICR service instance.\n");
       e.printStackTrace();
     }
+
+    Vector<SequenceI> sdataset = new Vector<SequenceI>(
+            Arrays.asList(dataset));
+    List<String> warningMessages = new ArrayList<String>();
+
     int db = 0;
-    Vector sdataset = new Vector();
-    for (int s = 0; s < dataset.length; s++)
-    {
-      sdataset.addElement(dataset[s]);
-    }
     while (sdataset.size() > 0 && db < dbSources.length)
     {
-      int maxqlen = 1; // default number of queries made to at one time
-      System.err.println("Verifying against " + dbSources[db].getDbName());
-      boolean dn = false;
+      int maxqlen = 1; // default number of queries made at one time
+      System.out.println("Verifying against " + dbSources[db].getDbName());
 
       // iterate through db for each remaining un-verified sequence
       SequenceI[] currSeqs = new SequenceI[sdataset.size()];
       sdataset.copyInto(currSeqs);// seqs that are to be validated against
       // dbSources[db]
-      Vector queries = new Vector(); // generated queries curSeq
-      seqRefs = new Hashtable();
+      Vector<String> queries = new Vector<String>(); // generated queries curSeq
+      seqRefs = new Hashtable<String, Vector<SequenceI>>();
 
       int seqIndex = 0;
 
-      jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db];
+      DbSourceProxy dbsource = dbSources[db];
+      // for moment, we dumbly iterate over all retrieval sources for a
+      // particular database
+      // TODO: introduce multithread multisource queries and logic to remove a
+      // query from other sources if any source for a database returns a
+      // record
+      maxqlen = dbsource.getMaximumQueryCount();
+
+      while (queries.size() > 0 || seqIndex < currSeqs.length)
       {
-        // for moment, we dumbly iterate over all retrieval sources for a
-        // particular database
-        // TODO: introduce multithread multisource queries and logic to remove a
-        // query from other sources if any source for a database returns a
-        // record
-        maxqlen = dbsource.getMaximumQueryCount();
-
-        while (queries.size() > 0 || seqIndex < currSeqs.length)
+        if (queries.size() > 0)
         {
-          if (queries.size() > 0)
-          {
-            // Still queries to make for current seqIndex
-            StringBuffer queryString = new StringBuffer("");
-            int numq = 0, nqSize = (maxqlen > queries.size()) ? queries
-                    .size() : maxqlen;
+          // Still queries to make for current seqIndex
+          StringBuffer queryString = new StringBuffer("");
+          int numq = 0;
+          int nqSize = (maxqlen > queries.size()) ? queries
+                  .size() : maxqlen;
 
-            while (queries.size() > 0 && numq < nqSize)
-            {
-              String query = (String) queries.elementAt(0);
-              if (dbsource.isValidReference(query))
-              {
-                queryString.append((numq == 0) ? "" : dbsource
-                        .getAccessionSeparator());
-                queryString.append(query);
-                numq++;
-              }
-              // remove the extracted query string
-              queries.removeElementAt(0);
-            }
-            // make the queries and process the response
-            AlignmentI retrieved = null;
-            try
-            {
-              if (jalview.bin.Cache.log.isDebugEnabled())
-              {
-                jalview.bin.Cache.log.debug("Querying "
-                        + dbsource.getDbName() + " with : '"
-                        + queryString.toString() + "'");
-              }
-              retrieved = dbsource.getSequenceRecords(queryString
-                      .toString());
-            } catch (Exception ex)
-            {
-              ex.printStackTrace();
-            } catch (OutOfMemoryError err)
+          while (queries.size() > 0 && numq < nqSize)
+          {
+            String query = queries.elementAt(0);
+            if (dbsource.isValidReference(query))
             {
-              new OOMWarning("retrieving database references ("
-                      + queryString.toString() + ")", err);
+              queryString.append((numq == 0) ? "" : dbsource
+                      .getAccessionSeparator());
+              queryString.append(query);
+              numq++;
             }
-            if (retrieved != null)
+            // remove the extracted query string
+            queries.removeElementAt(0);
+          }
+          // make the queries and process the response
+          AlignmentI retrieved = null;
+          try
+          {
+            if (Cache.log.isDebugEnabled())
             {
-              transferReferences(sdataset, dbsource.getDbSource(),
-                      retrieved, trimDsSeqs);
+              Cache.log.debug("Querying " + dbsource.getDbName()
+                      + " with : '" + queryString.toString() + "'");
             }
+            retrieved = dbsource.getSequenceRecords(queryString.toString());
+          } catch (Exception ex)
+          {
+            ex.printStackTrace();
+          } catch (OutOfMemoryError err)
+          {
+            new OOMWarning("retrieving database references ("
+                    + queryString.toString() + ")", err);
+          }
+          if (retrieved != null)
+          {
+            transferReferences(sdataset, dbsource.getDbSource(), retrieved,
+                    trimDsSeqs, warningMessages);
           }
-          else
+        }
+        else
+        {
+          // make some more strings for use as queries
+          for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)
           {
-            // make some more strings for use as queries
-            for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)
+            SequenceI sequence = dataset[seqIndex];
+            DBRefEntry[] uprefs = DBRefUtils.selectRefs(
+                    sequence.getDBRefs(),
+                    new String[] { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT
+            // });
+            // check for existing dbrefs to use
+            if (uprefs != null && uprefs.length > 0)
             {
-              SequenceI sequence = dataset[seqIndex];
-              DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
-                      sequence.getDBRefs(),
-                      new String[] { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT
-              // });
-              // check for existing dbrefs to use
-              if (uprefs != null && uprefs.length > 0)
+              for (int j = 0; j < uprefs.length; j++)
               {
-                for (int j = 0; j < uprefs.length; j++)
-                {
-                  addSeqId(sequence, uprefs[j].getAccessionId());
-                  queries.addElement(uprefs[j].getAccessionId()
-                          .toUpperCase());
-                }
+                addSeqId(sequence, uprefs[j].getAccessionId());
+                queries.addElement(uprefs[j].getAccessionId().toUpperCase());
               }
-              else
+            }
+            else
+            {
+              // generate queries from sequence ID string
+              StringTokenizer st = new StringTokenizer(sequence.getName(),
+                      "|");
+              while (st.hasMoreTokens())
               {
-                // generate queries from sequence ID string
-                StringTokenizer st = new StringTokenizer(
-                        sequence.getName(), "|");
-                while (st.hasMoreTokens())
+                String token = st.nextToken();
+                UPEntry[] presp = null;
+                if (picrClient != null)
                 {
-                  String token = st.nextToken();
-                  UPEntry[] presp = null;
-                  if (picrClient != null)
+                  // resolve the string against PICR to recover valid IDs
+                  try
                   {
-                    // resolve the string against PICR to recover valid IDs
-                    try
-                    {
-                      presp = picrClient.getUPIForAccession(token, null,
-                              picrClient.getMappedDatabaseNames(), null,
-                              true);
-                    } catch (Exception e)
-                    {
-                      System.err.println("Exception with Picr for '"
-                              + token + "'\n");
-                      e.printStackTrace();
-                    }
-                  }
-                  if (presp != null && presp.length > 0)
+                    presp = picrClient
+                            .getUPIForAccession(token, null,
+                                    picrClient.getMappedDatabaseNames(),
+                                    null, true);
+                  } catch (Exception e)
                   {
-                    for (int id = 0; id < presp.length; id++)
-                    {
-                      // construct sequences from response if sequences are
-                      // present, and do a transferReferences
-                      // otherwise transfer non sequence x-references directly.
-                    }
-                    System.out
-                            .println("Validated ID against PICR... (for what its worth):"
-                                    + token);
-                    addSeqId(sequence, token);
-                    queries.addElement(token.toUpperCase());
+                    System.err.println("Exception with Picr for '" + token
+                            + "'\n");
+                    e.printStackTrace();
                   }
-                  else
+                }
+                if (presp != null && presp.length > 0)
+                {
+                  for (int id = 0; id < presp.length; id++)
                   {
-                    // if ()
-                    // System.out.println("Not querying source with token="+token+"\n");
-                    addSeqId(sequence, token);
-                    queries.addElement(token.toUpperCase());
+                    // construct sequences from response if sequences are
+                    // present, and do a transferReferences
+                    // otherwise transfer non sequence x-references directly.
                   }
+                  System.out
+                          .println("Validated ID against PICR... (for what its worth):"
+                                  + token);
+                  addSeqId(sequence, token);
+                  queries.addElement(token.toUpperCase());
+                }
+                else
+                {
+                  // if ()
+                  // System.out.println("Not querying source with token="+token+"\n");
+                  addSeqId(sequence, token);
+                  queries.addElement(token.toUpperCase());
                 }
               }
             }
@@ -482,14 +501,20 @@ public class DBRefFetcher implements Runnable
       }
       // advance to next database
       db++;
-    } // all databases have been queries.
-    if (sbuffer.length() > 0)
+    } // all databases have been queried
+    if (!warningMessages.isEmpty())
     {
-      output.setText(MessageManager
-              .getString("label.your_sequences_have_been_verified")
-              + sbuffer.toString());
+      StringBuilder sb = new StringBuilder(warningMessages.size() * 30);
+      sb.append(MessageManager
+              .getString("label.your_sequences_have_been_verified"));
+      for (String msg : warningMessages)
+      {
+        sb.append(msg).append(NEWLINE);
+      }
+      output.setText(sb.toString());
+
       Desktop.addInternalFrame(output,
-              MessageManager.getString("label.sequence_names_updated"),
+              MessageManager.getString("label.sequences_updated"),
               600, 300);
       // The above is the dataset, we must now find out the index
       // of the viewed sequence
@@ -511,57 +536,62 @@ public class DBRefFetcher implements Runnable
 
   /**
    * Verify local sequences in seqRefs against the retrieved sequence database
-   * records.
+   * records. Returns true if any sequence was modified as a result (start/end
+   * changed and/or sequence enlarged), else false.
    * 
+   * @param sdataset
+   *          dataset sequences we are retrieving for
+   * @param dbSource
+   *          database source we are retrieving from
+   * @param retrievedAl
+   *          retrieved sequences as alignment
    * @param trimDatasetSeqs
-   * 
+   *          if true, sequences will not be enlarged to match longer retrieved
+   *          sequences, only their start/end adjusted
+   * @param warningMessages
+   *          a list of messages to add to
    */
-  void transferReferences(Vector sdataset, String dbSource,
-          AlignmentI retrievedAl, boolean trimDatasetSeqs) // File
-  // file)
+  boolean transferReferences(Vector<SequenceI> sdataset,
+          String dbSource,
+          AlignmentI retrievedAl, boolean trimDatasetSeqs,
+          List<String> warningMessages)
   {
-    System.out.println("trimming ? " + trimDatasetSeqs);
+    // System.out.println("trimming ? " + trimDatasetSeqs);
     if (retrievedAl == null || retrievedAl.getHeight() == 0)
     {
-      return;
+      return false;
     }
+
+    boolean modified = false;
     SequenceI[] retrieved = recoverDbSequences(retrievedAl
             .getSequencesArray());
     SequenceI sequence = null;
-    boolean transferred = false;
-    StringBuffer messages = new StringBuffer();
 
-    // Vector entries = new Uniprot().getUniprotEntries(file);
-
-    int i, iSize = retrieved.length; // entries == null ? 0 : entries.size();
-    // UniprotEntry entry;
-    for (i = 0; i < iSize; i++)
+    for (SequenceI retrievedSeq : retrieved)
     {
-      SequenceI entry = retrieved[i]; // (UniprotEntry) entries.elementAt(i);
-
       // Work out which sequences this sequence matches,
       // taking into account all accessionIds and names in the file
-      Vector sequenceMatches = new Vector();
+      Vector<SequenceI> sequenceMatches = new Vector<SequenceI>();
       // look for corresponding accession ids
-      DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs(
-              entry.getDBRefs(), new String[] { dbSource });
+      DBRefEntry[] entryRefs = DBRefUtils.selectRefs(retrievedSeq.getDBRefs(),
+              new String[] { dbSource });
       if (entryRefs == null)
       {
         System.err
                 .println("Dud dbSource string ? no entryrefs selected for "
-                        + dbSource + " on " + entry.getName());
+                        + dbSource + " on " + retrievedSeq.getName());
         continue;
       }
       for (int j = 0; j < entryRefs.length; j++)
       {
-        String accessionId = entryRefs[j].getAccessionId(); // .getAccession().elementAt(j).toString();
+        String accessionId = entryRefs[j].getAccessionId();
         // match up on accessionId
         if (seqRefs.containsKey(accessionId.toUpperCase()))
         {
-          Vector seqs = (Vector) seqRefs.get(accessionId);
+          Vector<SequenceI> seqs = seqRefs.get(accessionId);
           for (int jj = 0; jj < seqs.size(); jj++)
           {
-            sequence = (SequenceI) seqs.elementAt(jj);
+            sequence = seqs.elementAt(jj);
             if (!sequenceMatches.contains(sequence))
             {
               sequenceMatches.addElement(sequence);
@@ -569,17 +599,17 @@ public class DBRefFetcher implements Runnable
           }
         }
       }
-      if (sequenceMatches.size() == 0)
+      if (sequenceMatches.isEmpty())
       {
         // failed to match directly on accessionId==query so just compare all
         // sequences to entry
-        Enumeration e = seqRefs.keys();
+        Enumeration<String> e = seqRefs.keys();
         while (e.hasMoreElements())
         {
-          Vector sqs = (Vector) seqRefs.get(e.nextElement());
+          Vector<SequenceI> sqs = seqRefs.get(e.nextElement());
           if (sqs != null && sqs.size() > 0)
           {
-            Enumeration sqe = sqs.elements();
+            Enumeration<SequenceI> sqe = sqs.elements();
             while (sqe.hasMoreElements())
             {
               sequenceMatches.addElement(sqe.nextElement());
@@ -603,10 +633,11 @@ public class DBRefFetcher implements Runnable
        */
       // sequenceMatches now contains the set of all sequences associated with
       // the returned db record
-      String entrySeq = entry.getSequenceAsString().toUpperCase();
+      final String retrievedSeqString = retrievedSeq.getSequenceAsString();
+      String entrySeq = retrievedSeqString.toUpperCase();
       for (int m = 0; m < sequenceMatches.size(); m++)
       {
-        sequence = (SequenceI) sequenceMatches.elementAt(m);
+        sequence = sequenceMatches.elementAt(m);
         // only update start and end positions and shift features if there are
         // no existing references
         // TODO: test for legacy where uniprot or EMBL refs exist but no
@@ -616,13 +647,13 @@ public class DBRefFetcher implements Runnable
         // TODO:
         // verify sequence against the entry sequence
 
+        Mapping mp;
+        final int sequenceStart = sequence.getStart();
+
+        boolean remoteEnclosesLocal = false;
         String nonGapped = AlignSeq.extractGaps("-. ",
                 sequence.getSequenceAsString()).toUpperCase();
-
         int absStart = entrySeq.indexOf(nonGapped);
-        Mapping mp;
-
-        final int sequenceStart = sequence.getStart();
         if (absStart == -1)
         {
           // couldn't find local sequence in sequence from database, so check if
@@ -632,17 +663,20 @@ public class DBRefFetcher implements Runnable
           {
             // verification failed. couldn't find any relationship between
             // entrySeq and local sequence
-            messages.append(sequence.getName()
-                    + " SEQUENCE NOT %100 MATCH \n");
+            // messages suppressed as many-to-many matches are confusing
+            // String msg = sequence.getName()
+            // + " Sequence not 100% match with "
+            // + retrievedSeq.getName();
+            // addWarningMessage(warningMessages, msg);
             continue;
           }
           /*
-           * found match for the whole of the database sequence within the local
-           * sequence's reference frame. 
+           * retrieved sequence is a proper subsequence of local sequence
            */
-          transferred = true;
-          sbuffer.append(sequence.getName() + " HAS " + absStart
-                  + " PREFIXED RESIDUES COMPARED TO " + dbSource + "\n");
+          String msg = sequence.getName() + " has " + absStart
+                  + " prefixed residues compared to "
+                  + retrievedSeq.getName();
+          addWarningMessage(warningMessages, msg);
 
           /*
            * So create a mapping to the external entry from the matching region of 
@@ -650,50 +684,40 @@ public class DBRefFetcher implements Runnable
            */
           mp = new Mapping(null, new int[] { sequenceStart + absStart,
               sequenceStart + absStart + entrySeq.length() - 1 }, new int[]
-          { entry.getStart(), entry.getStart() + entrySeq.length() - 1 },
+          { retrievedSeq.getStart(), retrievedSeq.getStart() + entrySeq.length() - 1 },
                   1, 1);
           updateRefFrame = false;
         }
         else
         {
           /*
-           * found a match for the local sequence within sequence from 
-           * the external database 
+           * local sequence is a subsequence of (or matches) retrieved sequence
            */
-          transferred = true;
-
-          // update start and end of local sequence to place it in entry's
-          // reference frame.
-          // apply identity map map from whole of local sequence to matching
-          // region of database
-          // sequence
-          mp = null; // Mapping.getIdentityMap();
-          // new Mapping(null,
-          // new int[] { absStart+sequence.getStart(),
-          // absStart+sequence.getStart()+entrySeq.length()-1},
-          // new int[] { entry.getStart(), entry.getEnd() }, 1, 1);
-          // relocate local features for updated start
+          remoteEnclosesLocal = true;
+          mp = null;
 
           if (updateRefFrame)
           {
-            if (sequence.getSequenceFeatures() != null)
+            SequenceFeature[] sfs = sequence.getSequenceFeatures();
+            if (sfs != null)
             {
               /*
                * relocate existing sequence features by offset
                */
-              SequenceFeature[] sf = sequence.getSequenceFeatures();
               int start = sequenceStart;
               int end = sequence.getEnd();
-              int startShift = 1 - absStart - start; // how much the features
-                                                     // are
-              // to be shifted by
-              for (int sfi = 0; sfi < sf.length; sfi++)
+              int startShift = 1 - absStart - start;
+
+              if (startShift != 0)
               {
-                if (sf[sfi].getBegin() >= start && sf[sfi].getEnd() <= end)
+                for (SequenceFeature sf : sfs)
                 {
-                  // shift feature along by absstart
-                  sf[sfi].setBegin(sf[sfi].getBegin() + startShift);
-                  sf[sfi].setEnd(sf[sfi].getEnd() + startShift);
+                  if (sf.getBegin() >= start && sf.getEnd() <= end)
+                  {
+                    sf.setBegin(sf.getBegin() + startShift);
+                    sf.setEnd(sf.getEnd() + startShift);
+                    modified = true;
+                  }
                 }
               }
             }
@@ -701,16 +725,36 @@ public class DBRefFetcher implements Runnable
         }
 
         System.out.println("Adding dbrefs to " + sequence.getName()
-                + " from " + dbSource + " sequence : " + entry.getName());
-        sequence.transferAnnotation(entry, mp);
+                + " from " + dbSource + " sequence : " + retrievedSeq.getName());
+        sequence.transferAnnotation(retrievedSeq, mp);
 
-        absStart += entry.getStart();
+        absStart += retrievedSeq.getStart();
         int absEnd = absStart + nonGapped.length() - 1;
         if (!trimDatasetSeqs)
         {
-          // insert full length sequence from record
-          sequence.setSequence(entry.getSequenceAsString());
-          sequence.setStart(entry.getStart());
+          /*
+           * update start position and/or expand to longer retrieved sequence
+           */
+          if (!retrievedSeqString.equals(sequence.getSequenceAsString())
+                  && remoteEnclosesLocal)
+          {
+            sequence.setSequence(retrievedSeqString);
+            modified = true;
+            addWarningMessage(warningMessages,
+                    "Sequence for " + sequence.getName()
+                            + " expanded from " + retrievedSeq.getName());
+          }
+          if (sequence.getStart() != retrievedSeq.getStart())
+          {
+            sequence.setStart(retrievedSeq.getStart());
+            modified = true;
+            if (absStart != sequenceStart)
+            {
+              addWarningMessage(warningMessages, "Start/end position for "
+                      + sequence.getName() + " updated from "
+                      + retrievedSeq.getName());
+            }
+          }
         }
         if (updateRefFrame)
         {
@@ -718,8 +762,16 @@ public class DBRefFetcher implements Runnable
           if (trimDatasetSeqs)
           {
             // just fix start/end
-            sequence.setStart(absStart);
-            sequence.setEnd(absEnd);
+            if (sequence.getStart() != absStart
+                    || sequence.getEnd() != absEnd)
+            {
+              sequence.setStart(absStart);
+              sequence.setEnd(absEnd);
+              modified = true;
+              addWarningMessage(warningMessages, "Start/end for "
+                      + sequence.getName() + " updated from "
+                      + retrievedSeq.getName());
+            }
           }
           // search for alignment sequences to update coordinate frame for
           for (int alsq = 0; alsq < alseqs.length; alsq++)
@@ -736,6 +788,7 @@ public class DBRefFetcher implements Runnable
               {
                 alseqs[alsq].setEnd(ngAlsq.length()
                         + alseqs[alsq].getStart() - 1);
+                modified = true;
               }
             }
           }
@@ -752,10 +805,20 @@ public class DBRefFetcher implements Runnable
         // ids, so we can query all enabled DAS servers for them ?
       }
     }
-    if (!transferred)
+    return modified;
+  }
+
+  /**
+   * Adds the message to the list unless it already contains it
+   * 
+   * @param messageList
+   * @param msg
+   */
+  void addWarningMessage(List<String> messageList, String msg)
+  {
+    if (!messageList.contains(msg))
     {
-      // report the ID/sequence mismatches
-      sbuffer.append(messages);
+      messageList.add(msg);
     }
   }
 
@@ -767,12 +830,12 @@ public class DBRefFetcher implements Runnable
    */
   private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray)
   {
-    Vector nseq = new Vector();
+    Vector<SequenceI> nseq = new Vector<SequenceI>();
     for (int i = 0; sequencesArray != null && i < sequencesArray.length; i++)
     {
       nseq.addElement(sequencesArray[i]);
-      DBRefEntry dbr[] = sequencesArray[i].getDBRefs();
-      jalview.datamodel.Mapping map = null;
+      DBRefEntry[] dbr = sequencesArray[i].getDBRefs();
+      Mapping map = null;
       for (int r = 0; (dbr != null) && r < dbr.length; r++)
       {
         if ((map = dbr[r].getMap()) != null)
index 04c23a2..a50ed14 100644 (file)
@@ -37,7 +37,6 @@ import jalview.ws.ebi.EBIFetchClient;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Vector;
 
 import com.stevesoft.pat.Regex;
 
@@ -47,15 +46,16 @@ import com.stevesoft.pat.Regex;
  */
 public class Pdb extends EbiFileRetrievedProxy
 {
+  private static final String SEPARATOR = "|";
+  private static final String COLON = ":";
+  private static final int PDB_ID_LENGTH = 4;
+
+
   public Pdb()
   {
     super();
   }
 
-  public static final String FEATURE_INSERTION = "INSERTION";
-
-  public static final String FEATURE_RES_NUM = "RESNUM";
-
   /*
    * (non-Javadoc)
    * 
@@ -64,7 +64,6 @@ public class Pdb extends EbiFileRetrievedProxy
   @Override
   public String getAccessionSeparator()
   {
-    // TODO Auto-generated method stub
     return null;
   }
 
@@ -110,23 +109,28 @@ public class Pdb extends EbiFileRetrievedProxy
   public AlignmentI getSequenceRecords(String queries) throws Exception
   {
     AlignmentI pdbAlignment = null;
-    Vector result = new Vector();
     String chain = null;
     String id = null;
-    if (queries.indexOf(":") > -1)
+    if (queries.indexOf(COLON) > -1)
     {
-      chain = queries.substring(queries.indexOf(":") + 1);
-      id = queries.substring(0, queries.indexOf(":"));
+      chain = queries.substring(queries.indexOf(COLON) + 1);
+      id = queries.substring(0, queries.indexOf(COLON));
     }
     else
     {
       id = queries;
     }
-    if (queries.length() > 4 && chain == null)
+
+    /*
+     * extract chain code if it is appended to the id and we
+     * don't already have one
+     */
+    if (queries.length() > PDB_ID_LENGTH && chain == null)
     {
-      chain = queries.substring(4, 5);
-      id = queries.substring(0, 4);
+      chain = queries.substring(PDB_ID_LENGTH, PDB_ID_LENGTH + 1);
+      id = queries.substring(0, PDB_ID_LENGTH);
     }
+
     if (!isValidReference(id))
     {
       System.err.println("Ignoring invalid pdb query: '" + id + "'");
@@ -165,8 +169,6 @@ public class Pdb extends EbiFileRetrievedProxy
               chid = pid.getChainCode();
 
             }
-            ;
-
           }
           if (chain == null
                   || (chid != null && (chid.equals(chain)
@@ -175,8 +177,8 @@ public class Pdb extends EbiFileRetrievedProxy
           {
             // FIXME seems to result in 'PDB|1QIP|1qip|A' - 1QIP is redundant.
             // TODO: suggest simplify naming to 1qip|A as default name defined
-            pdbcs.setName(jalview.datamodel.DBRefSource.PDB + "|" + id
-                    + "|" + pdbcs.getName());
+            pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR + id
+                    + SEPARATOR + pdbcs.getName());
             // Might need to add more metadata to the PDBEntry object
             // like below
             /*
index ddd38e7..b4628b8 100644 (file)
@@ -977,7 +977,7 @@ public class AlignmentUtilsTests
     /*
      * scenario:
      *     dna1 --> [4, 6] [10,12]        --> pep1 
-     *     dna2 --> [1, 3] [7, 9] [13,15] --> pep1 
+     *     dna2 --> [1, 3] [7, 9] [13,15] --> pep2
      */
     SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa");
     SequenceI dna2 = new Sequence("dna2", "GGGcccTTTaaaCCC");
@@ -993,6 +993,13 @@ public class AlignmentUtilsTests
     dna.setDataset(null);
 
     /*
+     * put a variant feature on dna2 base 8
+     * - should transfer to cds2 base 5
+     */
+    dna2.addSequenceFeature(new SequenceFeature("variant", "hgmd", 8, 8,
+            0f, null));
+
+    /*
      * need a sourceDbRef if we are to construct dbrefs to the CDS
      * sequence from the dna contig sequences
      */
@@ -1154,6 +1161,16 @@ public class AlignmentUtilsTests
     assertSame(cds2Dss, m.getSequence());
     assertEquals(7, m.getStart());
     assertEquals(9, m.getEnd());
+
+    /*
+     * check cds2 acquired a variant feature in position 5
+     */
+    SequenceFeature[] sfs = cds2Dss.getSequenceFeatures();
+    assertNotNull(sfs);
+    assertEquals(1, sfs.length);
+    assertEquals("variant", sfs[0].type);
+    assertEquals(5, sfs[0].begin);
+    assertEquals(5, sfs[0].end);
   }
 
   /**
index bad536b..4c7df46 100644 (file)
@@ -105,24 +105,16 @@ public class StructureChooserTest
   }
 
   @Test(groups = { "Functional" })
-  public void populateFilterComboBoxTest()
+  public void populateFilterComboBoxTest() throws InterruptedException
   {
     SequenceI[] selectedSeqs = new SequenceI[] { seq };
     StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
-    sc.populateFilterComboBox();
+    sc.populateFilterComboBox(false);
     int optionsSize = sc.getCmbFilterOption().getItemCount();
     assertEquals(3, optionsSize); // if structures are not discovered then don't
                                   // populate filter options
 
-    sc.setStructuresDiscovered(true);
-    sc.populateFilterComboBox();
-    try
-    {
-      Thread.sleep(2000);
-    } catch (InterruptedException e)
-    {
-      e.printStackTrace();
-    }
+    sc.populateFilterComboBox(true);
     optionsSize = sc.getCmbFilterOption().getItemCount();
     assertTrue(optionsSize > 3); // if structures are found, filter options
                                  // should be populated