Merge branch 'Release_2_8_1_Branch' into Release_2_8_1_Branch_i18n
authorJim Procter <jprocter@dundee.ac.uk>
Sun, 27 Apr 2014 20:42:10 +0000 (21:42 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Sun, 27 Apr 2014 20:42:10 +0000 (21:42 +0100)
examples-jbake/content/appletParameters.html
examples/appletParameters.html
src/jalview/schemes/ColourSchemeProperty.java
src/jalview/schemes/RNAHelicesColour.java
src/jalview/schemes/RNAHelicesColourChooser.java
src/jalview/ws/jws2/AADisorderClient.java
src/jalview/ws/jws2/JabawsCalcWorker.java
test/jalview/io/Jalview2xmlTests.java

index e02a7be..b936824 100644 (file)
@@ -78,7 +78,7 @@ the applet can be interacted with <em>via</em> its
             <td>defaultColour</td>
             <td> <em>One of: </em><br>
               Clustal, Blosum62, % Identity, Hydrophobic, Zappo, Taylor, Helix 
-              Propensity, Strand Propensity, Turn Propensity, Buried Index, Nucleotide</td>
+              Propensity, Strand Propensity, Turn Propensity, Buried Index, Nucleotide, T-Coffee Scores, RNA Helices</td>
             <td>Default is no colour.</td>
           </tr>
           <tr> 
index a1af716..fe29b2e 100644 (file)
@@ -236,7 +236,7 @@ the applet can be interacted with <em>via</em> its
             <td>defaultColour</td>
             <td> <em>One of: </em><br>
               Clustal, Blosum62, % Identity, Hydrophobic, Zappo, Taylor, Helix 
-              Propensity, Strand Propensity, Turn Propensity, Buried Index, Nucleotide</td>
+              Propensity, Strand Propensity, Turn Propensity, Buried Index, Nucleotide, T-Coffee Scores, RNA Helices</td>
             <td>Default is no colour.</td>
           </tr>
           <tr> 
index c655fe2..76b1ff1 100755 (executable)
@@ -86,13 +86,15 @@ public class ColourSchemeProperty
   public static final int COVARIATION = 14;
 
   public static final int TCOFFEE = 15;
+  
+  public static final int RNAHELIX = 16;
 
   /**
    * index of first colourscheme (includes 'None')
    */
   public static final int FIRST_COLOUR = NONE;
 
-  public static final int LAST_COLOUR = NUCLEOTIDE;
+  public static final int LAST_COLOUR = RNAHELIX;
 
   /**
    * DOCUMENT ME!
@@ -167,6 +169,10 @@ public class ColourSchemeProperty
     {
       ret = PURINEPYRIMIDINE;
     }
+    else if (name.equalsIgnoreCase("RNA Helices"))
+    {
+      ret = RNAHELIX;
+    }
     // else if (name.equalsIgnoreCase("Covariation"))
     // {
     // ret = COVARIATION;
@@ -240,6 +246,10 @@ public class ColourSchemeProperty
     {
       index = TCOFFEE;
     }
+    else if (cs instanceof RNAHelicesColour)
+    {
+      index = RNAHELIX;
+    }
     /*
      * else if (cs instanceof CovariationColourScheme) { index = COVARIATION; }
      */
@@ -334,6 +344,10 @@ public class ColourSchemeProperty
       ret = "T-Coffee Scores";
 
       break;
+    case RNAHELIX:
+      ret = "RNA Helices";
+
+      break;
     /*
      * case COVARIATION: ret = "Covariation";
      * 
@@ -486,6 +500,10 @@ public class ColourSchemeProperty
     case TCOFFEE:
       cs = new TCoffeeColourScheme(coll);
       break;
+    
+    case RNAHELIX:
+      cs = new RNAHelicesColour(coll);
+      break;
       
       // case COVARIATION:
       // cs = new CovariationColourScheme(annotation);
index 7cbca66..06553f0 100644 (file)
@@ -20,8 +20,11 @@ package jalview.schemes;
 
 import java.awt.*;
 import java.util.Hashtable;
+import java.util.Map;
 
 import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
 import jalview.datamodel.SequenceI;
 
 /**
@@ -62,14 +65,40 @@ public class RNAHelicesColour extends ResidueColourScheme
     this.annotation = annotation;
     refresh();
   }
+  public RNAHelicesColour(AnnotatedCollectionI alignment)
+  {
+    super(ResidueProperties.nucleotideIndex);
+    alignmentChanged(alignment, null);
+  }
+
+  @Override
+  public void alignmentChanged(AnnotatedCollectionI alignment,
+          Map<SequenceI, SequenceCollectionI> hiddenReps)
+  {
 
+    // This loop will find the first rna structure annotation by which to colour
+    //  the sequences.
+    AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation();
+    for (int i = 0; i < annotations.length; i++) {
+        
+        // is this a sensible way of determining type of annotation?
+        if (annotations[i].getRNAStruc() != null) { 
+                annotation = annotations[i];
+                break;
+        }
+    }
+
+    refresh();
+
+  }
   private long lastrefresh = -1;
 
   public void refresh()
   {
-    if ((annotation._rnasecstr == null
+    
+    if (annotation!=null && ((annotation._rnasecstr == null
                || lastrefresh != annotation._rnasecstr.hashCode())
-            && annotation.isValidStruc())
+            && annotation.isValidStruc()))
     {
       annotation.getRNAStruc();
       lastrefresh = annotation._rnasecstr.hashCode();
index 45c374d..bcac5c7 100644 (file)
@@ -97,28 +97,9 @@ public class RNAHelicesColourChooser
     {
       return;
     }
-
-    // This loop will find the first rna structure annotation by which to colour
-    //  the sequences.
-    AlignmentAnnotation[] annotations = av.getAlignment().getAlignmentAnnotation();
-    for (int i = 0; i < annotations.length; i++) {
-       
-       // is this a sensible way of determining type of annotation?
-       if (annotations[i].getRNAStruc() != null) { 
-               currentAnnotation = annotations[i];
-               break;
-       }
-    }
-    if (currentAnnotation == null)   
-    {
-       System.err.println("Jalview is about to try and colour by RNAHelices even"
-                       + " though there are no RNA secondary structure annotations present!");
-       currentAnnotation = av.getAlignment().getAlignmentAnnotation()[0];// annotations.getSelectedIndex()];
-    }
-    
     RNAHelicesColour rhc = null;
 
-    rhc = new RNAHelicesColour(currentAnnotation);
+    rhc = new RNAHelicesColour(av.getAlignment());
 
     av.setGlobalColourScheme(rhc);
 
@@ -131,7 +112,7 @@ public class RNAHelicesColourChooser
           continue;
         }
 
-        sg.cs = new RNAHelicesColour(currentAnnotation);
+        sg.cs = new RNAHelicesColour(sg);
 
       }
     }
index 49a904c..e158da7 100644 (file)
@@ -19,8 +19,8 @@
 package jalview.ws.jws2;
 
 import jalview.api.AlignCalcWorkerI;
+import jalview.bin.Cache;
 import jalview.datamodel.AlignmentAnnotation;
-
 import jalview.datamodel.GraphLine;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
@@ -37,6 +37,7 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+
 import compbio.data.sequence.Range;
 import compbio.data.sequence.Score;
 import compbio.data.sequence.ScoreManager.ScoreHolder;
@@ -206,8 +207,18 @@ public class AADisorderClient extends JabawsCalcWorker implements
         {
           seq = seq.getDatasetSequence();
         }
-        ;
-        ScoreHolder scores = scoremanager.getAnnotationForSequence(seqId);
+        ScoreHolder scores = null;
+        try {
+          scores = scoremanager.getAnnotationForSequence(seqId);
+        } catch (Exception q)
+        {
+          Cache.log
+                  .info("Couldn't recover disorder prediction for sequence "
+                          + seq.getName()
+                          + "(Prediction name was "
+                          + seqId+")"
+                          + "\nSee http://issues.jalview.org/browse/JAL-1319 for one possible reason why disorder predictions might fail.");
+        }
         float last = Float.NaN, val = Float.NaN;
         int lastAnnot = ourAnnot.size();
         if (scores!=null && scores.scores!=null) {
index 8515dbc..f585732 100644 (file)
@@ -379,7 +379,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker
     end=inputSeqs.getEndRes();
     
 
-    for (SequenceI sq : ((List<SequenceI>) alignment.getSequences()))
+    for (SequenceI sq : ((List<SequenceI>) inputSeqs.getSequences()))
     {
       if (bySequence ? sq.findPosition(end+1) -sq.findPosition(start+1) > minlen - 1 : sq.getEnd() - sq.getStart() > minlen - 1)
       {
index 4ef038a..3a69595 100644 (file)
@@ -57,6 +57,8 @@ public class Jalview2xmlTests
     assertTrue("Didn't read input file "+inFile, af!=null);
     int olddsann=countDsAnn(af.getViewport());
     assertTrue("Didn't find any dataset annotations",olddsann>0);
+    af.rnahelicesColour_actionPerformed(null);
+    assertTrue("Couldn't apply RNA helices colourscheme",af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
     assertTrue("Failed to store as a project.",af.saveAlignment(tfile, "Jalview"));
     af.closeMenuItem_actionPerformed(true);
     af=null;
@@ -65,6 +67,7 @@ public class Jalview2xmlTests
     int newdsann=countDsAnn(af.getViewport());
     assertTrue("Differing numbers of dataset sequence annotation\nOriginally "+olddsann+" and now "+newdsann,olddsann==newdsann);
     System.out.println("Read in same number of annotations as originally present ("+olddsann+")");
+    assertTrue("RNA helices colourscheme was not applied on import.",af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
   }
   @Test
   public void testTCoffeeScores() throws Exception
@@ -93,5 +96,4 @@ public class Jalview2xmlTests
     assertTrue("Didn't set T-coffee colourscheme for imported project.",af.getViewport().getGlobalColourScheme().getClass().equals(jalview.schemes.TCoffeeColourScheme.class));
     System.out.println("T-Coffee score shading successfully recovered from project.");
   }
-
 }