JAL-885 more efficient calculation and robust for mismatch between WUSS and alignment...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 28 Oct 2011 16:20:28 +0000 (17:20 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 28 Oct 2011 16:20:28 +0000 (17:20 +0100)
src/jalview/analysis/StructureFrequency.java

index aa1e277..0c9f830 100644 (file)
@@ -122,6 +122,9 @@ public class StructureFrequency
       }
       else
       {
+        bpEnd = findPair(rna, i);
+        if (bpEnd>-1)
+        {
         for (j = 0; j < jSize; j++) // foreach row
         {
           if (sequences[j] == null)
@@ -130,11 +133,8 @@ public class StructureFrequency
                     .println("WARNING: Consensus skipping null sequence - possible race condition.");
             continue;
           }
-          seq = sequences[j].getSequence();
-
-          if (seq.length > i)
+          c = sequences[j].getCharAt(i);
           {
-            c = seq[i];
 
             // standard representation for gaps in sequence and structure
             if (c == '.' || c == ' ')
@@ -147,8 +147,7 @@ public class StructureFrequency
               values['-']++;
               continue;
             }
-            bpEnd = findPair(rna, i);
-            cEnd = seq[bpEnd];
+            cEnd = sequences[j].getCharAt(bpEnd);
             if (checkBpType(c, cEnd))
             {
               values['(']++; // H means it's a helix (structured)
@@ -158,6 +157,7 @@ public class StructureFrequency
             maxResidue = "(";
           }
         }
+        }
         // nonGap++;
       }
       // UPDATE this for new values