- SequenceI [] sequences;
- int start;
- int end;
- Vector seqNums; // vector of int vectors where first is sequence checksum
- int maxLength = 0; // used by quality calcs
- boolean seqNumsChanged = false; // updated after any change via calcSeqNum;
- Hashtable [] total;
-
- /** Stores calculated quality values */
- public Vector quality;
-
- /** Stores maximum and minimum values of quality values */
- public Double[] qualityRange = new Double[2];
- String consString = "";
- Sequence consSequence;
- Hashtable propHash;
- int threshold;
- String name = "";
- int[][] cons2;
-
- /**
- * Creates a new Conservation object.
- *
- * @param name Name of conservation
- * @param propHash DOCUMENT ME!
- * @param threshold to count the residues in residueHash(). commonly used value is 3
- * @param sequences sequences to be used in calculation
- * @param start start residue position
- * @param end end residue position
- */
- public Conservation(String name, Hashtable propHash, int threshold,
- Vector sequences, int start, int end)
+ private static final int TOUPPERCASE = 'a' - 'A';
+
+ SequenceI[] sequences;
+
+ int start;
+
+ int end;
+
+ Vector<int[]> seqNums; // vector of int vectors where first is sequence
+ // checksum
+
+ int maxLength = 0; // used by quality calcs
+
+ boolean seqNumsChanged = false; // updated after any change via calcSeqNum;
+
+ /*
+ * a map per column with {property, conservation} where conservation value is
+ * 1 (property is conserved), 0 (absence of property is conserved) or -1
+ * (property is not conserved i.e. column has residues with and without it)
+ */
+ Map<String, Integer>[] total;
+
+ boolean canonicaliseAa = true; // if true then conservation calculation will
+
+ // map all symbols to canonical aa numbering
+ // rather than consider conservation of that
+ // symbol
+
+ /** Stores calculated quality values */
+ private Vector<Double> quality;
+
+ /** Stores maximum and minimum values of quality values */
+ private double[] qualityRange = new double[2];
+
+ private Sequence consSequence;
+
+ /*
+ * percentage of residues in a column to qualify for counting conservation
+ */
+ private int threshold;
+
+ private String name = "";
+
+ private int[][] cons2;
+
+ private String[] consSymbs;
+
+ /**
+ * Creates a new Conservation object.
+ *
+ * @param name
+ * Name of conservation
+ * @param threshold
+ * to count the residues in residueHash(). commonly used value is 3
+ * @param sequences
+ * sequences to be used in calculation
+ * @param start
+ * start residue position
+ * @param end
+ * end residue position
+ */
+ public Conservation(String name, int threshold,
+ List<SequenceI> sequences, int start, int end)
+ {
+ this.name = name;
+ this.threshold = threshold;
+ this.start = start;
+ this.end = end;
+
+ maxLength = end - start + 1; // default width includes bounds of
+ // calculation
+
+ int s, sSize = sequences.size();
+ SequenceI[] sarray = new SequenceI[sSize];
+ this.sequences = sarray;
+ try
+ {
+ for (s = 0; s < sSize; s++)
+ {
+ sarray[s] = sequences.get(s);
+ if (sarray[s].getLength() > maxLength)
+ {
+ maxLength = sarray[s].getLength();
+ }
+ }
+ } catch (ArrayIndexOutOfBoundsException ex)