JAL-1819 use Float.isNaN() to check for NaNs!
[jalview.git] / src / jalview / ws / jws2 / AADisorderClient.java
index 34969d1..91be2e6 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -40,6 +40,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import compbio.data.sequence.FastaSequence;
 import compbio.data.sequence.Range;
 import compbio.data.sequence.Score;
 import compbio.data.sequence.ScoreManager.ScoreHolder;
@@ -82,6 +83,12 @@ public class AADisorderClient extends JabawsCalcWorker implements
     return "Submitting amino acid sequences for disorder prediction.";
   }
 
+  @Override
+  boolean checkValidInputSeqs(boolean dynamic, List<FastaSequence> seqs)
+  {
+    return (seqs.size() > 0);
+  }
+
   private static Map<String, Map<String, String[]>> featureMap;
 
   private static Map<String, Map<String, Map<String, Object>>> annotMap;
@@ -258,7 +265,7 @@ public class AADisorderClient extends JabawsCalcWorker implements
                           + rn.from, base + rn.to, methodName);
                 }
                 dseq.addSequenceFeature(sf);
-                if (last != val && last != Float.NaN)
+                if (last != val && !Float.isNaN(last))
                 {
                   fc.put(sf.getType(), sf);
                 }
@@ -272,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;
 
@@ -326,6 +336,9 @@ public class AADisorderClient extends JabawsCalcWorker implements
                 }
               }
               annot._linecolour = col;
+              // finally, update any dataset annotation
+              replaceAnnotationOnAlignmentWith(annot, typename, calcName,
+                      aseq);
             }
           }
         }
@@ -338,7 +351,7 @@ public class AADisorderClient extends JabawsCalcWorker implements
       {
         if (dispFeatures)
         {
-          jalview.gui.FeatureRenderer fr = ((jalview.gui.AlignmentPanel) ap)
+          jalview.api.FeatureRenderer fr = ((jalview.gui.AlignmentPanel) ap)
                   .cloneFeatureRenderer();
           for (String ft : fc.keySet())
           {
@@ -374,4 +387,11 @@ public class AADisorderClient extends JabawsCalcWorker implements
     }
   }
 
+  @Override
+  public String getCalcId()
+  {
+    // Disorder predictions are not dynamically updated so we return null
+    return null;
+  }
+
 }