Merge branch 'JAL-1364_patch' into Release_2_8_1_Branch
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 21 Feb 2014 16:28:13 +0000 (16:28 +0000)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 21 Feb 2014 16:28:13 +0000 (16:28 +0000)
src/jalview/ws/jws2/RNAalifoldClient.java

index ec40552..c7d8efd 100644 (file)
@@ -198,7 +198,7 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
   private AlignmentAnnotation constructAnnotationFromScoreHolder(
           AlignmentAnnotation annotation, String struct, TreeSet<Score> data)
   {
-    Annotation[] anns = new Annotation[struct.length()];
+    Annotation[] anns = new Annotation[gapMap!= null ? gapMap.length+1 : struct.length()];
 
     if (data != null
             && data.size() > 1
@@ -261,10 +261,14 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
         if (gapMap!=null)
         {
           // skip any gapped columns in the input data
-          while (!gapMap[ri])
+          while (!gapMap[ri] && ri<gapMap.length)
           {
             ri++;
           }
+          if (ri==gapMap.length)
+          {
+            break;
+          }
         }
         anns[ri] = new Annotation(struct.substring(i, i + 1), "",
                 isSS(struct.charAt(i)), Float.NaN);