JAL-1841 JAL-2215 add the ‘ignore gaps’ structure consensus fraction
authorJim Procter <jprocter@issues.jalview.org>
Wed, 21 Sep 2016 15:42:10 +0000 (16:42 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 21 Sep 2016 15:42:10 +0000 (16:42 +0100)
src/jalview/analysis/StructureFrequency.java

index 479c856..29bdb7a 100644 (file)
@@ -114,6 +114,7 @@ public class StructureFrequency
     {
       int canonicalOrWobblePairCount = 0;
       int otherPairCount = 0;
+      int nongap = 0;
       maxResidue = "-";
       values = new int[255];
       pairs = new int[255][255];
@@ -161,7 +162,7 @@ public class StructureFrequency
               values['-']++;
               continue;
             }
-
+            nongap++;
             /*
              * ensure upper-case for counting purposes
              */
@@ -188,7 +189,6 @@ public class StructureFrequency
             pairs[c][cEnd]++;
           }
         }
-        // nonGap++;
       }
 
       residueHash = new Hashtable();
@@ -222,8 +222,9 @@ public class StructureFrequency
       percentage = ((float) count * 100) / jSize;
       residueHash.put(PID_GAPS, new Float(percentage));
 
-      // percentage = ((float) count * 100) / (float) nongap;
-      // residueHash.put(PID_NOGAPS, new Float(percentage));
+      percentage = ((float) count * 100) / nongap;
+      residueHash.put(PID_NOGAPS, new Float(percentage));
+
       if (result[i] == null)
       {
         result[i] = residueHash;
@@ -251,6 +252,9 @@ public class StructureFrequency
         percentage = ((float) count * 100) / jSize;
         residueHash.put(PID_GAPS, new Float(percentage));
 
+        percentage = ((float) count * 100) / nongap;
+        residueHash.put(PID_NOGAPS, new Float(percentage));
+
         result[bpEnd] = residueHash;
       }
     }