quickfix for applet when opening relative URLs from feature file : https://mantis...
[jalview.git] / src / jalview / analysis / AAFrequency.java
index a4418a4..36534a3 100755 (executable)
@@ -23,24 +23,28 @@ import java.util.*;
 import jalview.datamodel.*;
 
 /**
- * Takes in a vector or array of sequences and column start and column end
- * and returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied.
- * This class is used extensively in calculating alignment colourschemes
- * that depend on the amount of conservation in each alignment column.
+ * Takes in a vector or array of sequences and column start and column end and
+ * returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied.
+ * This class is used extensively in calculating alignment colourschemes that
+ * depend on the amount of conservation in each alignment column.
+ * 
  * @author $author$
  * @version $Revision$
  */
 public class AAFrequency
 {
-  //No need to store 1000s of strings which are not
-  //visible to the user.
+  // No need to store 1000s of strings which are not
+  // visible to the user.
   public static final String MAXCOUNT = "C";
+
   public static final String MAXRESIDUE = "R";
+
   public static final String PID_GAPS = "G";
+
   public static final String PID_NOGAPS = "N";
 
   public static final Hashtable[] calculate(Vector sequences, int start,
-                                            int end)
+          int end)
   {
     SequenceI[] seqs = new SequenceI[sequences.size()];
     int width = 0;
@@ -65,9 +69,8 @@ public class AAFrequency
     return reply;
   }
 
-  public static final void calculate(SequenceI[] sequences,
-                                     int start, int end,
-                                     Hashtable[] result)
+  public static final void calculate(SequenceI[] sequences, int start,
+          int end, Hashtable[] result)
   {
     Hashtable residueHash;
     int maxCount, nongap, i, j, v, jSize = sequences.length;
@@ -106,7 +109,7 @@ public class AAFrequency
           }
           else if ('a' <= c && c <= 'z')
           {
-            c -= 32; //('a' - 'A');
+            c -= 32; // ('a' - 'A');
           }
 
           nongap++;
@@ -128,11 +131,11 @@ public class AAFrequency
 
         if (values[v] > maxCount)
         {
-          maxResidue = String.valueOf( (char) v);
+          maxResidue = String.valueOf((char) v);
         }
         else if (values[v] == maxCount)
         {
-          maxResidue += String.valueOf( (char) v);
+          maxResidue += String.valueOf((char) v);
         }
         maxCount = values[v];
       }
@@ -145,10 +148,10 @@ public class AAFrequency
       residueHash.put(MAXCOUNT, new Integer(maxCount));
       residueHash.put(MAXRESIDUE, maxResidue);
 
-      percentage = ( (float) maxCount * 100) / (float) jSize;
+      percentage = ((float) maxCount * 100) / (float) jSize;
       residueHash.put(PID_GAPS, new Float(percentage));
 
-      percentage = ( (float) maxCount * 100) / (float) nongap;
+      percentage = ((float) maxCount * 100) / (float) nongap;
       residueHash.put(PID_NOGAPS, new Float(percentage));
       result[i] = residueHash;
     }