Merge branch 'JAL-1587_promotedisorder' into Release_2_8_2_Branch
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 18 Nov 2014 09:56:53 +0000 (09:56 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Tue, 18 Nov 2014 09:56:53 +0000 (09:56 +0000)
25 files changed:
help/help.jhm
help/helpTOC.xml
help/html/features/annotation.html
help/html/features/preferences.html
help/html/features/viewingpdbs.html
help/html/features/xsspannotation.html [new file with mode: 0644]
help/html/menus/popupMenu.html
help/html/releases.html
help/html/webServices/jnet.html
help/html/whatsNew.html
src/MCview/PDBChain.java
src/MCview/PDBViewer.java
src/MCview/PDBfile.java
src/jalview/analysis/AlignSeq.java
src/jalview/datamodel/Alignment.java
src/jalview/gui/Desktop.java
src/jalview/gui/Preferences.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/FormatAdapter.java
src/jalview/structure/StructureSelectionManager.java
src/jalview/ws/jws1/JPredThread.java
src/jalview/ws/jws2/AADisorderClient.java
src/jalview/ws/jws2/JabawsCalcWorker.java
test/jalview/ext/jmol/PDBFileWithJmolTest.java
test/jalview/ext/paradise/TestAnnotate3D.java

index c6cc626..b6b0063 100755 (executable)
@@ -39,6 +39,7 @@
    <mapID target="disorder" url="html/webServices/proteinDisorder.html"/>
    <mapID target="aacon" url="html/webServices/AACon.html"/>
    <mapID target="rnaalifold" url="html/webServices/RNAalifold.html"/>
+   <mapID target="seqannots" url="html/features/annotation.html#seqannots"/>
    <mapID target="seqfetch" url="html/features/seqfetch.html"/>
    <mapID target="dbreffetcher" url="html/webServices/dbreffetcher.html"/>
    <mapID target="seqmappings" url="html/features/seqmappings.html"/>
@@ -54,6 +55,7 @@
    <mapID target="pdbjmol" url="html/features/jmol.html"/>
    <mapID target="chimera" url="html/features/chimera.html"/>
    <mapID target="varna" url="html/features/varna.html"/>
+   <mapID target="xsspannotation" url="html/features/xsspannotation.html"/>
    <mapID target="preferences" url="html/features/preferences.html"/>     
    <mapID target="commandline" url="html/features/commandline.html"/>
    <mapID target="clarguments" url="html/features/clarguments.html"/>
index 6ae5c78..1d45e7a 100755 (executable)
@@ -97,6 +97,9 @@
                <tocitem text="Pairwise Alignments" target="pairwise"/>
                <tocitem text="Remove Redundancy" target="redundancy"/>
        </tocitem>
+       <tocitem text="Sequence Annotations" target="seqannots" expand="true">
+               <tocitem text="Annotation from Structure" target="xsspannotation" expand="false"/>
+       </tocitem>
        <tocitem text="Alignment Annotations" target ="alannotation" expand="false">
           <tocitem text="Conservation" target="calcs.alconserv"/>          
           <tocitem text="Quality" target="calcs.alquality"/>
index 49128c2..a036bd5 100755 (executable)
@@ -39,6 +39,15 @@ and symbolic annotations can be added to an alignment via an <a
 href="annotationsFormat.html">Annotations File</a> dragged into the
 alignment window or loaded from the alignment's file menu.
 </p>
+<p><a name="seqannots"/><strong>Sequence Reference Annotation</strong>
+</p>
+<p>
+               Sequence reference annotation is created from 3D structure
+               data, and from the results of sequence based prediction of
+               <a href="../webServices/jnet.html">secondary structure</a> and <a
+                       href="../webServices/proteinDisorder.html">disordered region</a>
+               prediction methods. 
+</p>
 <p><strong>Interactive Alignment Annotation</strong></p>
 <p>
 Annotation rows are added using the <strong>Annotation Label</strong>
index b2d8b93..5d4ab4d 100755 (executable)
@@ -113,13 +113,12 @@ will be loaded.</p>
 <p><a name="structure"><strong>&quot;Structure&quot;
 Preferences tab</strong></a><em> added in Jalview 2.8.2</em></p>
 <p><em>Process secondary structure from PDB</em> - if selected, then structure information
-read from PDB will be processed to derive secondary structure annotation.
-<p><em>Use RNAView for secondary structure</em> - if selected, the RNAView service will be 
-automatically called to derive secondary structure information.
-<p><em>Add secondary structure annotation to alignment</em> - if selected, PDB secondary structure
-annotation will be shown on the alignment when available.
-<p><em>Add Temperature Factor annotation to alignment</em> - if selected, PDB Temperature Factor
-annotation will be shown on the alignment when available. 
+read from PDB will be processed and annotation added to associated sequences.
+<p><em>Use RNAView for secondary structure</em> - if selected, the pyRNA RNAView service (<a href="https://github.com/fjossinet/PyRNA">https://github.com/fjossinet/PyRNA</a>) will be 
+called to derive secondary structure information for RNA chains.
+<p><em>Add secondary structure annotation to alignment</em> - if selected, <a href="http://swift.cmbi.ru.nl/gv/dssp/">Jmol's implementation DSSP</a> will be used to add annotation to polypeptide chains in the structure.
+<p><em>Add Temperature Factor annotation to alignment</em> - if selected, values extracted from the Temperature Factor
+column for the backbone atoms in the PDB file will be extracted as annotation lines shown on the alignment. 
 <p><em>Default structure viewer</em> - choose JMOL or CHIMERA for viewing 3D structures. 
 <p><em>Path to Chimera program</em> - Optional, as Jalview will search standard installation paths for Windows, Linux or MacOS. 
 If you have installed Chimera in a non-standard location, you can specify it here. Enter the full path to the Chimera executable program.  
index 8fc557e..75a5c9c 100755 (executable)
 </head>
 <body>
 <p><strong>Viewing PDB Structures</strong></p>
-
-<p>Jalview can view protein structures associated with a sequence
-via the <strong>"Structure&rarr;"</strong> submenu from a
-sequence's <a href="../menus/popupMenu.html">pop-up menu</a>.</p>
-A <a href="jmol.html">Jmol viewer</a> has been included since Jalview 2.3. Jalview 2.8.2 added support for <a href="https://www.cgl.ucsf.edu/chimera/">Chimera</a>,
-provided this has been separately installed. Choice of default viewer is configurable in the Preferences <a href="preferences.html#structure">Structure tab</a>. 
-  
-<p>The following menu entries are provided for viewing structure data<br>
+       <p>
+               Jalview can view protein structures associated with a sequence via the
+               <strong>"Structure&rarr;"</strong> submenu from a sequence's <a
+                       href="../menus/popupMenu.html">pop-up menu</a>.
+       </p>
+       The
+       <a href="jmol.html">Jmol viewer</a> has been included since Jalview
+       2.3. Jalview 2.8.2 included support for
+       <a href="https://www.cgl.ucsf.edu/chimera/">Chimera</a>, provided it is
+       installed and can be launched by Jalview. The default viewer can be
+       configured in the
+       <a href="preferences.html#structure">Structure tab</a> in the
+       <strong>Tools&rarr;Preferences</strong> dialog box.
+       <p>
+               Structure data imported into Jalview can also be processed to display
+               secondary structure and temperature factor annotation. See the <a
+                       href="xsspannotation.html">Annotation from Structure</a> page for
+               more information.
+       </p>
+       <p>The following menu entries are provided for viewing structure data<br>
   <ul>
     <li>The <strong>&quot;Structure&#8594;View
         Structure&#8594;</strong> submenu allows a single PDB structure to be chosen
diff --git a/help/html/features/xsspannotation.html b/help/html/features/xsspannotation.html
new file mode 100644 (file)
index 0000000..0dc7475
--- /dev/null
@@ -0,0 +1,90 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 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>Annotation from 3D structure data</title>
+</head>
+<body>
+       <p>
+               <strong>Working with annotation from 3D structure data</strong>
+       </p>
+       <p>
+               Jalview can process PDB data associated with sequences to display
+               values extracted from the <em>Temperature Factor</em> column for
+               corresponding sites, and secondary structure from DSSP or RNAView (as
+               appropriate).
+       </p>
+       <p>
+               <strong>Extracting data from PDB files<br /></strong>Annotation is
+               created for structure files retrieved directly from the PDB loaded
+               from the file system (via the <strong>Structure&rarr;Associate
+                       Structure...&rarr;From file</strong> option, or when displayed via the View
+               Structures Menu.<br /> Structure annotation is not automatically
+               added to an alignment, but any available structure annotation rows for
+               the current selection or a particular sequence can be added via the <strong>Add
+                       Reference Annotation</strong> in the <strong>Selection</strong> and <strong>Sequence
+                       ID</strong> sub-menus of the Sequence ID Panel's popup menu.<br/> <em>Please
+                       note:</em>Protein structures are analysed
+               <em>in situ</em>, but Jalview employs a web service to process RNA
+               structures which can cause long delays if your internet connection is
+               slow.
+       </p>
+       <p>
+               The <a href="../menus/alwannotation.html"><em>Annotations</em>
+                       alignment menu</a> provides settings useful for controlling the display
+               of secondary structure annotation.
+       </p>
+       <p>
+               <strong>Shading sequences by associated structure annotation<br /></strong>The
+               annotation colouring dialog (opened by the <strong>Colour&rarr;By
+                       Annotation</strong> option) allows sequences with associated secondary
+               structure data to be shaded according to secondary structure type.
+               Once the dialog is opened, select the <em>Per Sequence</em> option and
+               then choose <em>Secondary structure</em> from the dropdown menu.<br />When
+               colouring alignments by secondary structure, two modes can be
+               employed. The default is to shade sequences with the same colour as
+               the secondary structure glyph. If, however, <em>original colours</em>
+               is selected and another colourscheme has already been applied, then
+               only portions of the sequence with defined secondary structure will be
+               shaded with the previously applied scheme.<br />
+       </p>
+       <p>
+               <strong>Configuration options for processing PDB files<br /></strong>
+               Occasionally, you may wish to disable secondary structure processing. 
+               Configuration options in the <strong>Structure</strong> tab in the <strong>Tools&rarr;Preferences</strong>
+               dialog allow the processing of structure data to be disabled, or
+               selectively enabled. For more information, take a look at the <a href="preferences.html#structure">documentation for the structure panel</a>.
+       </p>
+       <p>
+               <em>The display of secondary structure data was introduced in
+                       Jalview 2.8.2, and is made possible by Jalview's use of <a
+                       href="jmol.html">Jmol's DSSP implementation</a>, based on the
+                       original <a href="http://www.ncbi.nlm.nih.gov/pubmed/6667333">Kabsch
+                               and Sander algorithm</a> ported by <a
+                       href="http://swift.cmbi.ru.nl/gv/dssp/">Robbie P. Joosten and
+                               colleagues</a>, and a client for <a
+                       href="https://github.com/fjossinet/PyRNA">Fabrice Jossinet's
+                               pyRNA services</a> that was developed by Anne Menard, Jim Procter and
+                       Yann Ponty as part of the Jalview Summer of Code 2012.
+               </em>
+       </p>
+</body>
+</html>
index 511b85f..63bb815 100755 (executable)
@@ -41,7 +41,7 @@ not be accessible when in 'Cursor Mode' (toggled with the F2 key).</em></p>
       <li><strong>Hide Annotations...<br>
           </strong><em>Choose to hide either All or 
           a selected type of annotation for the selected sequences. (Since Jalview 2.8.2)</em></li>
-      <li><strong>Add Reference Annotations...<br>
+      <li><a name="addrefannot"><strong>Add Reference Annotations<br>
           </strong><em>Add to the alignment window any annotations on the selected sequences
           which have been read from reference sources or calculated (for example, 
           secondary structure derived from 3D structure). (Since Jalview 2.8.2)</em></li>
@@ -134,7 +134,7 @@ not be accessible when in 'Cursor Mode' (toggled with the F2 key).</em></p>
         window will be displayed asking for a new sequence name and sequence description 
         to be entered. Press OK to accept your edit. To save sequence descriptions, 
         you must save in Fasta, PIR or Jalview File format.</em></li>
-      <li><em> </em></li>
+      <li><a href="sqaddrefannot"><strong>Add Reference Annotations<br></strong><em>When enabled, copies any available alignment annotation for this sequence to the current view.</em></li>
       <li><strong>Represent Group With (Sequence Id)</strong><br>
         <em>All sequences in the current selection group will be hidden, apart 
         from (Sequence Id). Any edits performed on the visible representative 
index 6b92a2c..8913a32 100755 (executable)
        </tr>
                <tr>
                        <td><div align="center">
+                                       <strong><a name="Jalview.2.8.2">2.8.2</a><br /> <em>18/11/2014</em></strong>
+                               </div></td>
+                       <td>
+                               <!--  New features --> <!--  For major releases, split into sections: Application | Applet | General | Deployment and Documentation -->
+                               <em>General</em>
+                               <ul>
+                               </ul> <em>Application</em>
+                               <ul>
+                                       <li>Update Jalview project format:
+                                               <ul>
+                                               </ul>
+                                       </li>
+                               </ul>
+                       </td>
+                       <td>
+                               <!--  issues resolved --> <em>Application</em>
+                               <ul>
+
+                               </ul> <em>Applet</em>
+                               <ul>
+                               </ul> <em>Other</em>
+                               <ul>
+                               </ul>
+                       </td>
+               </tr>
+               <tr>
+                       <td><div align="center">
                                        <strong><a name="Jalview.2.8.1">2.8.1</a><br /> <em>4/6/2014</em></strong>
                                </div></td>
                        <td>
index 9a7acd9..5555c73 100755 (executable)
@@ -110,10 +110,11 @@ The annotation bars below the alignment are as follows:
        invoked to rationalise significantly different primary predictions.</em></li>
 </ul>
 </p>
+<em>JNet annotation created in Jalview 2.8.2 and later versions can be displayed on other alignments via the <a href="">Add reference annotation</a></em>
 <em>As of Jalview 2.6, the Jnet service accessed accessed via the
 'Secondary structure prediction' submenu should be considered a legacy
 Jalview SOAP service, and will be replaced in the near future by a
-JABAWS Jnet service.</em>
+JABAWS Jnet service (now available in the Jalview 2.9 development version).</em>
 
 </body>
 </html>
index dd536b1..ae45aae 100755 (executable)
 </head>
 <body>
        <p>
-               <strong>What's new ?</strong></p>
-       <p>
-               Jalview 2.8.1 includes new features for group creation, RNA secondary
-               structure prediction and a host bug fixes. It also includes support
-               for <a href="http://www.compbio.dundee.ac.uk/JABAWS">version 2.1
-                       of JABA</a> and includes a Spanish translation of its user interface.<br />
-               The highlights are detailed below, and the full list is given in the <a
-                       href="releases.html#Jalview2.8.1">Jalview 2.8.1 Release Notes</a>.
-       </p>
-       <p>The Desktop and web based applet include new keystrokes for
-               defining and undefining groups, and PAM250 has been added to the range
-               of score models available for use by the tree and PCA calculations.
-               The Jalview project file format has also been extended for handling
-               RNA and protein secondary structure annotation, in anticipation for
-               new structure based secondary structure support in Jalview 2.8.2.</p>
-       <p><strong>Internationalisation</strong></p>
-       <p>Jalview 2.8.1 is the first release to include support for
-               displaying Jalview's user interface in different languages. In August
-               2013, David Rold&aacute;n-Martinez took on the task of
-               internationalising Jalview's user interface. He also recruited Sara
-               Hern&aacute;ndez D&iacute;az and Laura Ferrandis Martinez who created
-               Jalview's first spanish user interface translation.</p>
-       <p>
-               If you notice any problems, or would like to help translate Jalview's
-               user interface into other languages, head over to <a
-                       href="http://issues.jalview.org">issues.jalview.org</a> and put in a
-               feature request describing the translations you can provide to the <a
-                       href="http://issues.jalview.org/browse/JAL/component/10682">i18n
-                       component</a>. David has also <a
-                       href="https://wiki.jalview.org/index.php/Development:i18n">documented
-                       the process of creating i18n translations</a> to help you get started.
+               <strong>What's new ?</strong>
        </p>
-       <p><strong>RNA Secondary Structure Prediction with JABA 2.1</strong></p>
-       <p>
-               This version of Jalview includes a client to access the new services available in <a
-                       href="http://www.compbio.dundee.ac.uk/jabaws/">JABA v2.1</a> , which
-               provides services for RNA consensus secondary structure prediction and
-               two new alignment programs (<a
-                       href="http://sourceforge.net/projects/glprobs/">GLProbs</a> and <a
-                       href="http://sourceforge.net/projects/msaprobs/">MSAProbs</a>).</p>
        <p>
-               To see how to perform RNA secondary structure predictions like the one below, take a look at the <a href="webServices/RNAalifold.html">RNAAliFold
-                       client documentation</a>. 
+               Jalview 2.8.2 is the first release produced by our new core
+               development team.<br /> It incorporates many minor improvements and
+               bug-fixes, and also includes new features for working with 3D
+               structure data, shading alignments by secondary structure and
+               generation of alignment figures as Scalable Vector Graphics. <br />As
+               ever, the highlights are detailed below, and the full list is given in
+               the <a href="releases.html#Jalview2.8.2">Jalview 2.8.2 Release
+                       Notes</a>.
        </p>
-  <div align="center">
-    <img src="webServices/RNAalifoldAnnotationRows.png" width="500" height="216"> <br> <em>The RNAalifold client was implemented by Jalview's 2013
-                       summer student, Dan Barton.</em>
-       </div>
 </body>
 </html>
index 2dd6d37..e8f1bc9 100755 (executable)
@@ -267,7 +267,7 @@ public class PDBChain
     bonds.addElement(new Bond(start, end, at1, at2));
   }
 
-  public void makeResidueList()
+  public void makeResidueList(boolean visibleChainAnnotation)
   {
     int count = 0;
     Object symbol;
@@ -377,23 +377,27 @@ public class PDBChain
               .elementAt(i));
       resFeatures.setElementAt(null, i);
     }
-    Annotation[] annots = new Annotation[resAnnotation.size()];
-    float max = 0;
-    for (i = 0, iSize = annots.length; i < iSize; i++)
+    if (visibleChainAnnotation)
     {
-      annots[i] = (Annotation) resAnnotation.elementAt(i);
-      if (annots[i].value > max)
+      Annotation[] annots = new Annotation[resAnnotation.size()];
+      float max = 0;
+      for (i = 0, iSize = annots.length; i < iSize; i++)
       {
-        max = annots[i].value;
+        annots[i] = (Annotation) resAnnotation.elementAt(i);
+        if (annots[i].value > max)
+        {
+          max = annots[i].value;
+        }
+        resAnnotation.setElementAt(null, i);
       }
-      resAnnotation.setElementAt(null, i);
+
+      AlignmentAnnotation tfactorann = new AlignmentAnnotation(
+              "PDB.TempFactor", "Temperature Factor for "
+                      + sequence.getName(), annots, 0, max,
+              AlignmentAnnotation.LINE_GRAPH);
+      tfactorann.setSequenceRef(sequence);
+      sequence.addAlignmentAnnotation(tfactorann);
     }
-    AlignmentAnnotation tfactorann = new AlignmentAnnotation(
-            "PDB.TempFactor", "Temperature Factor for "
-                    + sequence.getName(), annots, 0, max,
-            AlignmentAnnotation.LINE_GRAPH);
-    tfactorann.setSequenceRef(sequence);
-    sequence.addAlignmentAnnotation(tfactorann);
   }
 
   public void setChargeColours()
index d3535c0..bf285b9 100755 (executable)
@@ -113,7 +113,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
       try
       {
         tmpPDBFile = pdbentry.getFile();
-        PDBfile pdbfile = new PDBfile(false,false,tmpPDBFile,
+        PDBfile pdbfile = new PDBfile(false, false, false, tmpPDBFile,
                 jalview.io.AppletFormatAdapter.FILE);
 
         pdbcanvas.init(pdbentry, seq, chains, ap, protocol);
index b22eb29..e1c4dc5 100755 (executable)
@@ -47,32 +47,38 @@ public class PDBfile extends jalview.io.AlignFile
    */
   boolean VisibleChainAnnotation = false;
 
-  boolean processSecondaryStructure=true;
-  
+  boolean processSecondaryStructure = true;
+
+  boolean externalSecondaryStructure = false;
 
   public PDBfile(boolean visibleChainAnnotation,
-          boolean processSecondaryStructure)
+          boolean processSecondaryStructure, boolean externalSecStr)
   {
     super();
     VisibleChainAnnotation = visibleChainAnnotation;
     this.processSecondaryStructure = processSecondaryStructure;
+    this.externalSecondaryStructure = externalSecStr;
   }
 
   public PDBfile(boolean visibleChainAnnotation,
-          boolean processSecondaryStructure, String file, String protocol) throws IOException
+          boolean processSecondaryStructure, boolean externalSecStr,
+          String file, String protocol) throws IOException
   {
     super(false, file, protocol);
     VisibleChainAnnotation = visibleChainAnnotation;
     this.processSecondaryStructure = processSecondaryStructure;
+    this.externalSecondaryStructure = externalSecStr;
     doParse();
   }
 
   public PDBfile(boolean visibleChainAnnotation,
-          boolean processSecondaryStructure, FileParse source) throws IOException
+          boolean processSecondaryStructure, boolean externalSecStr,
+          FileParse source) throws IOException
   {
     super(false, source);
     VisibleChainAnnotation = visibleChainAnnotation;
     this.processSecondaryStructure = processSecondaryStructure;
+    this.externalSecondaryStructure = externalSecStr;
     doParse();
   }
 
@@ -189,8 +195,7 @@ public class PDBfile extends jalview.io.AlignFile
         entry.setProperty(new Hashtable());
         if (chains.elementAt(i).id != null)
         {
-          entry.getProperty().put("CHAIN",
-                  chains.elementAt(i).id);
+          entry.getProperty().put("CHAIN", chains.elementAt(i).id);
         }
         if (inFile != null)
         {
@@ -217,7 +222,7 @@ public class PDBfile extends jalview.io.AlignFile
 
         AlignmentAnnotation[] chainannot = chainseq.getAnnotation();
 
-        if (chainannot != null)
+        if (chainannot != null && VisibleChainAnnotation)
         {
           for (int ai = 0; ai < chainannot.length; ai++)
           {
@@ -228,34 +233,34 @@ public class PDBfile extends jalview.io.AlignFile
       }
       if (processSecondaryStructure)
       {
-      if (rna.size() > 0)
-      {
-        try
+        if (externalSecondaryStructure && rna.size() > 0)
         {
-          processPdbFileWithAnnotate3d(rna);
-        } catch (Exception x)
-        {
-          System.err
-                  .println("Exceptions when dealing with RNA in pdb file");
-          x.printStackTrace();
+          try
+          {
+            processPdbFileWithAnnotate3d(rna);
+          } catch (Exception x)
+          {
+            System.err
+                    .println("Exceptions when dealing with RNA in pdb file");
+            x.printStackTrace();
 
+          }
         }
-      }
-      ;
-      if (prot.size() > 0)
-      {
-        try
+        ;
+        if (prot.size() > 0)
         {
-          processPdbFileWithJmol(prot);
-        } catch (Exception x)
-        {
-          System.err
-                  .println("Exceptions from Jmol when processing data in pdb file");
-          x.printStackTrace();
+          try
+          {
+            processPdbFileWithJmol(prot);
+          } catch (Exception x)
+          {
+            System.err
+                    .println("Exceptions from Jmol when processing data in pdb file");
+            x.printStackTrace();
 
+          }
         }
       }
-      }
     } catch (OutOfMemoryError er)
     {
       System.out.println("OUT OF MEMORY LOADING PDB FILE");
@@ -277,11 +282,11 @@ public class PDBfile extends jalview.io.AlignFile
 
   public static boolean isCalcIdHandled(String calcId)
   {
-    return calcId != null
- && (calcIdPrefix.equals(calcId));
+    return calcId != null && (calcIdPrefix.equals(calcId));
   }
 
-  public static boolean isCalcIdForFile(AlignmentAnnotation alan, String pdbFile)
+  public static boolean isCalcIdForFile(AlignmentAnnotation alan,
+          String pdbFile)
   {
     return alan.getCalcId() != null
             && calcIdPrefix.equals(alan.getCalcId())
@@ -301,19 +306,23 @@ public class PDBfile extends jalview.io.AlignFile
   {
     for (SequenceI sq : seqs)
     {
-      for (AlignmentAnnotation aa : sq.getAnnotation())
+      if (sq.getAnnotation() != null)
       {
-        String oldId = aa.getCalcId();
-        if (oldId == null)
+        for (AlignmentAnnotation aa : sq.getAnnotation())
         {
-          oldId = "";
+          String oldId = aa.getCalcId();
+          if (oldId == null)
+          {
+            oldId = "";
+          }
+          aa.setCalcId(calcIdPrefix);
+          aa.setProperty("PDBID", id);
+          aa.setProperty("oldCalcId", oldId);
         }
-        aa.setCalcId(calcIdPrefix);
-        aa.setProperty("PDBID", id);
-        aa.setProperty("oldCalcId", oldId);
       }
     }
   }
+
   private void processPdbFileWithJmol(ArrayList<SequenceI> prot)
           throws Exception
   {
@@ -352,8 +361,8 @@ public class PDBfile extends jalview.io.AlignFile
           AlignmentI al, String pep, boolean b)
   {
     List<List<? extends Object>> replaced = AlignSeq
-            .replaceMatchingSeqsWith(seqs,
-            annotations, prot, al, AlignSeq.PEP, false);
+            .replaceMatchingSeqsWith(seqs, annotations, prot, al,
+                    AlignSeq.PEP, false);
     for (PDBChain ch : chains)
     {
       int p = 0;
@@ -371,8 +380,7 @@ public class PDBfile extends jalview.io.AlignFile
         p = -p - 1;
         // set shadow entry for chains
         ch.shadow = (SequenceI) replaced.get(1).get(p);
-        ch.shadowMap = ((AlignSeq) replaced.get(2)
-.get(p))
+        ch.shadowMap = ((AlignSeq) replaced.get(2).get(p))
                 .getMappingFromS1(false);
       }
     }
@@ -445,7 +453,7 @@ public class PDBfile extends jalview.io.AlignFile
   {
     for (int i = 0; i < chains.size(); i++)
     {
-      chains.elementAt(i).makeResidueList();
+      chains.elementAt(i).makeResidueList(VisibleChainAnnotation);
     }
   }
 
@@ -490,8 +498,8 @@ public class PDBfile extends jalview.io.AlignFile
   {
     for (int i = 0; i < chains.size(); i++)
     {
-      chains.elementAt(i).setChainColours(Color.getHSBColor(
-              1.0f / i, .4f, 1.0f));
+      chains.elementAt(i).setChainColours(
+              Color.getHSBColor(1.0f / i, .4f, 1.0f));
     }
   }
 
index 307a06f..ba7e520 100755 (executable)
@@ -1153,7 +1153,7 @@ public class AlignSeq
               ap++;
             }
           }
-          if (sq.getAnnotation() != null)
+          if (sq.getAnnotation() != null && sq.getAnnotation().length > 0)
           {
             annotations.addAll(inspos, Arrays.asList(sq.getAnnotation()));
           }
index b2d4f0f..4057773 100755 (executable)
@@ -147,7 +147,9 @@ public class Alignment implements AlignmentI
   public SequenceI[] getSequencesArray()
   {
     if (sequences == null)
+    {
       return null;
+    }
     synchronized (sequences)
     {
       return sequences.toArray(new SequenceI[sequences.size()]);
@@ -211,7 +213,9 @@ public class Alignment implements AlignmentI
       }
     }
     if (hiddenSequences != null)
+    {
       hiddenSequences.adjustHeightSequenceAdded();
+    }
   }
 
   /**
@@ -245,7 +249,9 @@ public class Alignment implements AlignmentI
   public void finalize()
   {
     if (getDataset() != null)
+    {
       getDataset().removeAlignmentRef();
+    }
 
     dataset = null;
     sequences = null;
@@ -754,7 +760,9 @@ public class Alignment implements AlignmentI
         continue;
       }
       if (tIndex < temp.length)
+      {
         temp[tIndex++] = annotations[i];
+      }
     }
 
     if (swap)
@@ -950,6 +958,27 @@ public class Alignment implements AlignmentI
     else if (dataset == null && data != null)
     {
       dataset = data;
+      for (int i = 0; i < getHeight(); i++)
+      {
+        SequenceI currentSeq = getSequenceAt(i);
+        SequenceI dsq = currentSeq.getDatasetSequence();
+        if (dsq == null)
+        {
+          dsq = currentSeq.createDatasetSequence();
+          dataset.addSequence(dsq);
+        }
+        else
+        {
+          while (dsq.getDatasetSequence() != null)
+          {
+            dsq = dsq.getDatasetSequence();
+          }
+          if (dataset.findIndex(dsq) == -1)
+          {
+            dataset.addSequence(dsq);
+          }
+        }
+      }
     }
     dataset.addAlignmentRef();
   }
@@ -1150,7 +1179,9 @@ public class Alignment implements AlignmentI
   public void setProperty(Object key, Object value)
   {
     if (alignmentProperties == null)
+    {
       alignmentProperties = new Hashtable();
+    }
 
     alignmentProperties.put(key, value);
   }
@@ -1159,9 +1190,13 @@ public class Alignment implements AlignmentI
   public Object getProperty(Object key)
   {
     if (alignmentProperties != null)
+    {
       return alignmentProperties.get(key);
+    }
     else
+    {
       return null;
+    }
   }
 
   @Override
@@ -1183,7 +1218,9 @@ public class Alignment implements AlignmentI
   public void addCodonFrame(AlignedCodonFrame codons)
   {
     if (codons == null)
+    {
       return;
+    }
     if (codonFrameList == null)
     {
       codonFrameList = new AlignedCodonFrame[]
@@ -1217,15 +1254,21 @@ public class Alignment implements AlignmentI
   public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
   {
     if (seq == null || codonFrameList == null)
+    {
       return null;
+    }
     Vector cframes = new Vector();
     for (int f = 0; f < codonFrameList.length; f++)
     {
       if (codonFrameList[f].involvesSequence(seq))
+      {
         cframes.addElement(codonFrameList[f]);
+      }
     }
     if (cframes.size() == 0)
+    {
       return null;
+    }
     AlignedCodonFrame[] cfr = new AlignedCodonFrame[cframes.size()];
     cframes.copyInto(cfr);
     return cfr;
@@ -1252,7 +1295,9 @@ public class Alignment implements AlignmentI
   public boolean removeCodonFrame(AlignedCodonFrame codons)
   {
     if (codons == null || codonFrameList == null)
+    {
       return false;
+    }
     boolean removed = false;
     int i = 0, iSize = codonFrameList.length;
     while (i < iSize)
index faffd89..23ba893 100644 (file)
@@ -26,6 +26,7 @@ import jalview.io.FormatAdapter;
 import jalview.io.IdentifyFile;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
+import jalview.structure.StructureSelectionManager;
 import jalview.util.ImageMaker;
 import jalview.util.MessageManager;
 import jalview.ws.params.ParamManager;
@@ -286,7 +287,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     instance = this;
     doVamsasClientCheck();
     doGroovyCheck();
-
+    doConfigureStructurePrefs();
     setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
@@ -416,6 +417,27 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             });
   }
 
+  public void doConfigureStructurePrefs()
+  {
+    // configure services
+    StructureSelectionManager ssm = StructureSelectionManager
+            .getStructureSelectionManager(this);
+    if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true))
+    {
+      ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault(
+              Preferences.ADD_TEMPFACT_ANN, true));
+    ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
+    ssm.setSecStructServices(jalview.bin.Cache.getDefault(Preferences.USE_RNAVIEW,
+            true));
+    }
+    else
+    {
+      ssm.setAddTempFacAnnot(false);
+      ssm.setProcessSecondaryStructure(false);
+      ssm.setSecStructServices(false);
+    }
+  }
+
   public void checkForNews()
   {
     final Desktop me = this;
index ab4f94f..09f3686 100755 (executable)
@@ -590,9 +590,8 @@ public class Preferences extends GPreferences
 
     dasSource.saveProperties(Cache.applicationProperties);
     wsPrefs.updateAndRefreshWsMenuConfig(false);
-
     Cache.saveProperties();
-
+    Desktop.instance.doConfigureStructurePrefs();
     try
     {
       frame.setClosed(true);
index 5366cb4..d3b19fa 100755 (executable)
@@ -123,6 +123,21 @@ public class AppletFormatAdapter
 
   public static String CLASSLOADER = "ClassLoader";
 
+  /**
+   * add jalview-derived non-secondary structure annotation from PDB structure
+   */
+  boolean annotFromStructure = false;
+
+  /**
+   * add secondary structure from PDB data with built-in algorithms
+   */
+  boolean localSecondaryStruct = false;
+
+  /**
+   * process PDB data with web services
+   */
+  boolean serviceSecondaryStruct = false;
+
   AlignFile afile = null;
 
   String inFile;
@@ -236,7 +251,8 @@ public class AppletFormatAdapter
       }
       else if (format.equals("PDB"))
       {
-        afile = new MCview.PDBfile(true,true,inFile, type);
+        afile = new MCview.PDBfile(annotFromStructure,
+                localSecondaryStruct, serviceSecondaryStruct, inFile, type);
         // Uncomment to test Jmol data based PDB processing: JAL-1213
         // afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type);
       }
@@ -357,7 +373,8 @@ public class AppletFormatAdapter
       }
       else if (format.equals("PDB"))
       {
-        afile = new MCview.PDBfile(true,true,source);
+        afile = new MCview.PDBfile(annotFromStructure,
+                localSecondaryStruct, serviceSecondaryStruct, source);
       }
       else if (format.equals("STH"))
       {
index c2a317a..8ca0c35 100755 (executable)
 package jalview.io;
 
 import jalview.api.AlignViewportI;
-import jalview.datamodel.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
 
 /**
  * Additional formatting methods used by the application in a number of places.
@@ -32,6 +38,26 @@ import jalview.datamodel.*;
 public class FormatAdapter extends AppletFormatAdapter
 {
 
+  public FormatAdapter()
+  {
+    super();
+    if (jalview.bin.Cache.getDefault("STRUCT_FROM_PDB", true))
+    {
+      annotFromStructure = jalview.bin.Cache.getDefault("ADD_TEMPFACT_ANN",
+              true);
+      localSecondaryStruct = jalview.bin.Cache.getDefault("ADD_SS_ANN",
+            true);
+    serviceSecondaryStruct = jalview.bin.Cache.getDefault("USE_RNAVIEW",
+            true);
+    }
+    else
+    {
+      // disable all PDB annotation options
+      annotFromStructure = false;
+      localSecondaryStruct = false;
+      serviceSecondaryStruct = false;
+    }
+  }
   public String formatSequences(String format, SequenceI[] seqs,
           String[] omitHiddenColumns)
   {
@@ -154,8 +180,10 @@ public class FormatAdapter extends AppletFormatAdapter
   public boolean getCacheSuffixDefault(String format)
   {
     if (isValidFormat(format))
+    {
       return jalview.bin.Cache.getDefault(format.toUpperCase()
               + "_JVSUFFIX", true);
+    }
     return false;
   }
 
index ac2897d..4359879 100644 (file)
@@ -46,6 +46,70 @@ public class StructureSelectionManager
 
   StructureMapping[] mappings;
 
+  private boolean processSecondaryStructure = false,
+          secStructServices = false, addTempFacAnnot = false;
+
+  /**
+   * @return true if will try to use external services for processing secondary
+   *         structure
+   */
+  public boolean isSecStructServices()
+  {
+    return secStructServices;
+  }
+
+  /**
+   * control use of external services for processing secondary structure
+   * 
+   * @param secStructServices
+   */
+  public void setSecStructServices(boolean secStructServices)
+  {
+    this.secStructServices = secStructServices;
+  }
+
+  /**
+   * flag controlling addition of any kind of structural annotation
+   * 
+   * @return true if temperature factor annotation will be added
+   */
+  public boolean isAddTempFacAnnot()
+  {
+    return addTempFacAnnot;
+  }
+
+  /**
+   * set flag controlling addition of structural annotation
+   * 
+   * @param addTempFacAnnot
+   */
+  public void setAddTempFacAnnot(boolean addTempFacAnnot)
+  {
+    this.addTempFacAnnot = addTempFacAnnot;
+  }
+
+  /**
+   * 
+   * @return if true, the structure manager will attempt to add secondary
+   *         structure lines for unannotated sequences
+   */
+
+  public boolean isProcessSecondaryStructure()
+  {
+    return processSecondaryStructure;
+  }
+
+  /**
+   * Control whether structure manager will try to annotate mapped sequences
+   * with secondary structure from PDB data.
+   * 
+   * @param enable
+   */
+  public void setProcessSecondaryStructure(boolean enable)
+  {
+    processSecondaryStructure = enable;
+  }
+
   /**
    * debug function - write all mappings to stdout
    */
@@ -245,7 +309,7 @@ public class StructureSelectionManager
      * the tried and tested MCview pdb mapping
      */
     MCview.PDBfile pdb = null;
-    boolean parseSecStr=true;
+    boolean parseSecStr = processSecondaryStructure;
     if (isPDBFileRegistered(pdbFile))
     {
       for (SequenceI sq : sequence)
@@ -274,7 +338,8 @@ public class StructureSelectionManager
     }
     try
     {
-      pdb = new MCview.PDBfile(true, parseSecStr, pdbFile, protocol);
+      pdb = new MCview.PDBfile(addTempFacAnnot, parseSecStr,
+              secStructServices, pdbFile, protocol);
       if (pdb.id != null && pdb.id.trim().length() > 0
               && AppletFormatAdapter.FILE.equals(protocol))
       {
index 85969fc..4e95b14 100644 (file)
  */
 package jalview.ws.jws1;
 
-import java.util.*;
-
-import jalview.analysis.*;
-import jalview.bin.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import jalview.io.*;
-import jalview.util.*;
+import jalview.analysis.AlignSeq;
+import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.WebserviceInfo;
+import jalview.io.FormatAdapter;
+import jalview.util.Comparison;
+import jalview.util.MessageManager;
 import jalview.ws.AWsJob;
 import jalview.ws.JobStateSummary;
 import jalview.ws.WSClientI;
+
+import java.util.Hashtable;
+import java.util.List;
+
 import vamsas.objects.simple.JpredResult;
 
 class JPredThread extends JWS1Thread implements WSClientI
@@ -138,14 +147,21 @@ class JPredThread extends JWS1Thread implements WSClientI
               sqs[i] = al.getSequenceAt(i);
             }
             if (!jalview.analysis.SeqsetUtils.deuniquify(
-                    (Hashtable) SequenceInfo, sqs))
+                    SequenceInfo, sqs))
             {
               throw (new Exception(MessageManager.getString("exception.couldnt_recover_sequence_properties_for_alignment")));
             }
           }
           FirstSeq = 0;
-          al.setDataset(null);
+          if (currentView.getDataset() != null)
+          {
+            al.setDataset(currentView.getDataset());
 
+          }
+          else
+          {
+            al.setDataset(null);
+          }
           jalview.io.JnetAnnotationMaker.add_annotation(prediction, al,
                   FirstSeq, false, predMap);
 
@@ -162,8 +178,8 @@ class JPredThread extends JWS1Thread implements WSClientI
         if (predMap != null)
         {
           char gc = getGapChar();
-          SequenceI[] sqs = (SequenceI[]) ((java.lang.Object[]) input
-                  .getAlignmentAndColumnSelection(gc))[0];
+          SequenceI[] sqs = (SequenceI[]) input
+                  .getAlignmentAndColumnSelection(gc)[0];
           if (this.msaIndex >= sqs.length)
           {
             throw new Error(MessageManager.getString("error.implementation_error_invalid_msa_index_for_job"));
@@ -187,7 +203,15 @@ class JPredThread extends JWS1Thread implements WSClientI
         }
         else
         {
-          al.setDataset(null);
+          if (currentView.getDataset() != null)
+          {
+            al.setDataset(currentView.getDataset());
+
+          }
+          else
+          {
+            al.setDataset(null);
+          }
           jalview.io.JnetAnnotationMaker.add_annotation(prediction, al,
                   FirstSeq, true, predMap);
           SequenceI profileseq = al.getSequenceAt(0); // this includes any gaps.
@@ -201,11 +225,53 @@ class JPredThread extends JWS1Thread implements WSClientI
           }
         }
       }
+      // transfer to dataset
+      for (AlignmentAnnotation alant : al.getAlignmentAnnotation())
+      {
+        if (alant.sequenceRef != null)
+        {
+          replaceAnnotationOnAlignmentWith(alant, alant.label,
+                  "jalview.jws1.Jpred" + (this.msa == null ? "" : "MSA"),
+                  alant.sequenceRef);
+        }
+      }
       return new Object[]
       { al, alcsel }; // , FirstSeq, noMsa};
     }
 
     /**
+     * copied from JabawsCalcWorker
+     * 
+     * @param newAnnot
+     * @param typeName
+     * @param calcId
+     * @param aSeq
+     */
+    protected void replaceAnnotationOnAlignmentWith(
+            AlignmentAnnotation newAnnot, String typeName, String calcId,
+            SequenceI aSeq)
+    {
+      SequenceI dsseq = aSeq.getDatasetSequence();
+      while (dsseq.getDatasetSequence() != null)
+      {
+        dsseq = dsseq.getDatasetSequence();
+      }
+      // look for same annotation on dataset and lift this one over
+      List<AlignmentAnnotation> dsan = dsseq.getAlignmentAnnotations(
+              calcId, typeName);
+      if (dsan != null && dsan.size() > 0)
+      {
+        for (AlignmentAnnotation dssan : dsan)
+        {
+          dsseq.removeAlignmentAnnotation(dssan);
+        }
+      }
+      AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot);
+      dsseq.addAlignmentAnnotation(dssan);
+      dssan.adjustForAlignment();
+    }
+
+    /**
      * Given an alignment where all other sequences except profileseq are
      * aligned to the ungapped profileseq, insert gaps in the other sequences to
      * realign them with the residues in profileseq
@@ -372,7 +438,7 @@ class JPredThread extends JWS1Thread implements WSClientI
       {
         if (job.getJobId().startsWith("Broken"))
         {
-          job.result = (vamsas.objects.simple.Result) new JpredResult();
+          job.result = new JpredResult();
           job.result.setInvalid(true);
           job.result.setStatus(MessageManager.formatMessage("label.submission_params", new String[]{job.getJobId().toString()}));
           throw new Exception(job.getJobId());
index 83eebdf..6c438be 100644 (file)
@@ -279,10 +279,13 @@ public class AADisorderClient extends JabawsCalcWorker implements
               {
                 continue;
               }
+              String typename, calcName;
               AlignmentAnnotation annot = createAnnotationRowsForScores(
                       ourAnnot,
-                      service.serviceType + " (" + scr.getMethod() + ")",
-                      service.getServiceTypeURI() + "/" + scr.getMethod(),
+                      typename = service.serviceType + " ("
+                              + scr.getMethod() + ")",
+                      calcName = service.getServiceTypeURI() + "/"
+                              + scr.getMethod(),
                       aseq, base + 1, scr);
               annot.graph = AlignmentAnnotation.LINE_GRAPH;
 
@@ -333,6 +336,9 @@ public class AADisorderClient extends JabawsCalcWorker implements
                 }
               }
               annot._linecolour = col;
+              // finally, update any dataset annotation
+              replaceAnnotationOnAlignmentWith(annot, typename, calcName,
+                      aseq);
             }
           }
         }
index e966886..e01c648 100644 (file)
@@ -158,6 +158,30 @@ public abstract class JabawsCalcWorker extends AbstractJabaCalcWorker
     return annotation;
   }
 
+  protected void replaceAnnotationOnAlignmentWith(
+          AlignmentAnnotation newAnnot, String typeName, String calcId,
+          SequenceI aSeq)
+  {
+    SequenceI dsseq = aSeq.getDatasetSequence();
+    while (dsseq.getDatasetSequence() != null)
+    {
+      dsseq = dsseq.getDatasetSequence();
+    }
+    // look for same annotation on dataset and lift this one over
+    List<AlignmentAnnotation> dsan = dsseq.getAlignmentAnnotations(calcId,
+            typeName);
+    if (dsan != null && dsan.size() > 0)
+    {
+      for (AlignmentAnnotation dssan : dsan)
+      {
+        dsseq.removeAlignmentAnnotation(dssan);
+      }
+    }
+    AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot);
+    dsseq.addAlignmentAnnotation(dssan);
+    dssan.adjustForAlignment();
+  }
+
   private void constructAnnotationFromScore(AlignmentAnnotation annotation,
           int base, int alWidth, Score scr)
   {
index 79e3eae..7bcf902 100644 (file)
@@ -64,7 +64,7 @@ public class PDBFileWithJmolTest
   {
     for (String pdbStr : testFile)
     {
-      PDBfile mctest = new PDBfile(false, false, pdbStr,
+      PDBfile mctest = new PDBfile(false, false, false, pdbStr,
               AppletFormatAdapter.FILE);
       PDBFileWithJmol jtest = new PDBFileWithJmol(pdbStr,
               jalview.io.AppletFormatAdapter.FILE);
index d2322ef..a7c439f 100644 (file)
 package jalview.ext.paradise;
 
 import static org.junit.Assert.assertTrue;
-
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
-import jalview.ext.paradise.Annotate3D;
 import jalview.io.FastaFile;
 import jalview.io.FormatAdapter;
 
@@ -72,9 +70,13 @@ public class TestAnnotate3D
         iline = id.readLine();
         fline = file.readLine();
         if (iline != null)
+        {
           System.out.println(iline);
+        }
         if (fline != null)
+        {
           System.out.println(fline);
+        }
         // next assert fails for latest RNAview - because the XMLID entries
         // change between file and ID based RNAML generation.
         assertTrue(
@@ -96,7 +98,8 @@ public class TestAnnotate3D
   @Test
   public void testPDBfileVsRNAML() throws Exception
   {
-    PDBfile pdbf = new PDBfile(true,true,"examples/2GIS.pdb", FormatAdapter.FILE);
+    PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb",
+            FormatAdapter.FILE);
     Assert.assertTrue(pdbf.isValid());
     // Comment - should add new FileParse constructor like new FileParse(Reader
     // ..). for direct reading