JAL-1841 count (logo height) is valid pairs only; detect base-gap pair
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 12 Aug 2016 13:49:08 +0000 (14:49 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 12 Aug 2016 13:49:08 +0000 (14:49 +0100)
src/jalview/analysis/StructureFrequency.java

index 29d02fe..479c856 100644 (file)
@@ -24,6 +24,7 @@ import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
+import jalview.util.Comparison;
 import jalview.util.Format;
 
 import java.util.ArrayList;
@@ -151,20 +152,15 @@ public class StructureFrequency
                       .println("WARNING: Consensus skipping null sequence - possible race condition.");
               continue;
             }
-            c = sequences[j].getCharAt(i);
 
-            // standard representation for gaps in sequence and structure
-            if (c == '.' || c == ' ')
-            {
-              c = '-';
-            }
+            c = sequences[j].getCharAt(i);
+            cEnd = sequences[j].getCharAt(bpEnd);
 
-            if (c == '-')
+            if (Comparison.isGap(c) || Comparison.isGap(cEnd))
             {
               values['-']++;
               continue;
             }
-            cEnd = sequences[j].getCharAt(bpEnd);
 
             /*
              * ensure upper-case for counting purposes
@@ -204,7 +200,17 @@ public class StructureFrequency
 
         residueHash.put(PAIRPROFILE, pairs);
       }
-      int count = Math.max(canonicalOrWobblePairCount, otherPairCount);
+
+      /*
+       * the count is the number of valid pairs (as a percentage, determines
+       * the relative size of the profile logo)
+       */
+      int count = canonicalOrWobblePairCount;
+
+      /*
+       * currently displaying as '(' if most pairs are valid, or as
+       * '[' if there are more invalid than valid pairs 
+       */
       if (!maxResidue.equals("-"))
       {
         maxResidue = canonicalOrWobblePairCount >= otherPairCount ? "("