X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FConservation.java;h=75dec63ac63c6930428fba667e573786f5c38a36;hb=refs%2Fheads%2Freleases%2FRelease_2_10_0_Branch;hp=01a14c95730607e896023f1504b96d91458c1c45;hpb=b5c03446e1c939f40b560fa672e1dc503d7f2ff8;p=jalview.git diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index 01a14c9..75dec63 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -53,7 +53,7 @@ public class Conservation boolean seqNumsChanged = false; // updated after any change via calcSeqNum; - Hashtable[] total; + Map[] total; boolean canonicaliseAa = true; // if true then conservation calculation will @@ -62,20 +62,18 @@ public class Conservation // symbol /** Stores calculated quality values */ - public Vector quality; + private Vector quality; /** Stores maximum and minimum values of quality values */ private double[] qualityRange = new double[2]; - Sequence consSequence; + private Sequence consSequence; - Map> 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 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 ht = (Hashtable) propHash - .get(type); + Map 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 resultHash = total[i - start]; + Map 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 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 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) {