JAL-722 redone additional derived alignment statistics
[jalview.git] / src / jalview / io / AlignmentProperties.java
index a65b83d..69bd658 100644 (file)
@@ -83,9 +83,9 @@ public class AlignmentProperties
 
       /*
        * proportion of aligned sequence that is ungapped
-       * (note: not normalised by alignment width here)
+       * (note: normalised by alignment width here)
        */
-      float ungapped = (seqLength - gapCount) / (float) seqLength;
+      float ungapped = (seqWidth - gapCount) / (float) seqWidth;
       maxUngapped = Math.max(maxUngapped, ungapped);
       minUngapped = Math.min(minUngapped, ungapped);
     }
@@ -105,9 +105,9 @@ public class AlignmentProperties
     appendRow(sb, "Maximum (sequence length / width)",
             String.format(PCT_FORMAT, maxUngapped * 100f), html);
     appendRow(sb, "Residue density", String.format(PCT_FORMAT,
-            (totalLength - totalGaps) * 100f / totalLength), html);
+            (height * width - totalGaps) * 100f / (height * width)), html);
     appendRow(sb, "Gap density",
-            String.format(PCT_FORMAT, totalGaps * 100f / totalLength),
+            String.format(PCT_FORMAT, totalGaps * 100f / (height * width)),
             html);
     sb.append(html ? "</table>" : nl);