JAL-2089 patch broken merge to master for Release 2.10.0b1
[jalview.git] / src / jalview / analysis / Conservation.java
index 01a14c9..75dec63 100755 (executable)
@@ -53,7 +53,7 @@ public class Conservation
 
   boolean seqNumsChanged = false; // updated after any change via calcSeqNum;
 
-  Hashtable<String, Integer>[] total;
+  Map<String, Integer>[] total;
 
   boolean canonicaliseAa = true; // if true then conservation calculation will
 
@@ -62,20 +62,18 @@ public class Conservation
   // symbol
 
   /** Stores calculated quality values */
-  public Vector<Double> quality;
+  private Vector<Double> quality;
 
   /** Stores maximum and minimum values of quality values */
   private double[] qualityRange = new double[2];
 
-  Sequence consSequence;
+  private Sequence consSequence;
 
-  Map<String, Map<String, Integer>> propHash;
+  private int threshold;
 
-  int threshold;
+  private String name = "";
 
-  String name = "";
-
-  int[][] cons2;
+  private int[][] cons2;
 
   private String[] consSymbs;
 
@@ -84,8 +82,6 @@ public class Conservation
    * 
    * @param name
    *          Name of conservation
-   * @param propHash
-   *          hash of properties for each symbol
    * @param threshold
    *          to count the residues in residueHash(). commonly used value is 3
    * @param sequences
@@ -95,11 +91,10 @@ public class Conservation
    * @param end
    *          end residue position
    */
-  public Conservation(String name, Hashtable propHash, int threshold,
+  public Conservation(String name, int threshold,
           List<SequenceI> sequences, int start, int end)
   {
     this.name = name;
-    this.propHash = propHash;
     this.threshold = threshold;
     this.start = start;
     this.end = end;
@@ -254,10 +249,9 @@ public class Conservation
           String res = String.valueOf(v);
 
           // Now loop over the properties
-          for (String type : propHash.keySet())
+          for (String type : ResidueProperties.propHash.keySet())
           {
-            Hashtable<String, Integer> ht = (Hashtable<String, Integer>) propHash
-                    .get(type);
+            Map<String, Integer> ht = ResidueProperties.propHash.get(type);
 
             // Have we ticked this before?
             if (!resultHash.containsKey(type))
@@ -384,7 +378,7 @@ public class Conservation
 
       if (percentageGaps > pgaps)
       {
-        Hashtable<String, Integer> resultHash = total[i - start];
+        Map<String, Integer> resultHash = total[i - start];
         // Now find the verdict
         int count = 0;
         for (String type : resultHash.keySet())
@@ -564,8 +558,10 @@ public class Conservation
       {
         tot = 0;
         xx = new double[24];
-        seqNum = (j < lengths[k]) ? seqNums.elementAt(k)[j + 1]
-                : 23; // Sequence, or gap at the end
+        seqNum = (j < lengths[k]) ? seqNums.elementAt(k)[j + 1] : 23; // Sequence,
+                                                                      // or gap
+                                                                      // at the
+                                                                      // end
 
         // This is a loop over r
         for (i = 0; i < 23; i++)
@@ -724,9 +720,6 @@ public class Conservation
    * 
    * @param name
    *          - name of conservation
-   * @param consHash
-   *          - hash table of properties for each amino acid (normally
-   *          ResidueProperties.propHash)
    * @param threshold
    *          - minimum number of conserved residues needed to indicate
    *          conservation (typically 3)
@@ -744,29 +737,12 @@ public class Conservation
    * @return Conservation object ready for use in visualization
    */
   public static Conservation calculateConservation(String name,
-          Hashtable consHash, int threshold, List<SequenceI> seqs,
-          int start, int end, boolean posOrNeg, int consPercGaps,
-          boolean calcQuality)
-  {
-    Conservation cons = new Conservation(name, consHash, threshold, seqs,
-            start, end);
-    return calculateConservation(cons, posOrNeg, consPercGaps, calcQuality);
-  }
-
-  /**
-   * @param b
-   *          positive (true) or negative (false) conservation
-   * @param consPercGaps
-   *          percentage of gaps tolerated in column
-   * @param calcQuality
-   *          flag indicating if alignment quality should be calculated
-   * @return Conservation object ready for use in visualization
-   */
-  public static Conservation calculateConservation(Conservation cons,
-          boolean b, int consPercGaps, boolean calcQuality)
+          int threshold, List<SequenceI> seqs, int start, int end,
+          boolean posOrNeg, int consPercGaps, boolean calcQuality)
   {
+    Conservation cons = new Conservation(name, threshold, seqs, start, end);
     cons.calculate();
-    cons.verdict(b, consPercGaps);
+    cons.verdict(posOrNeg, consPercGaps);
 
     if (calcQuality)
     {