/** DOCUMENT ME!! */
- public Vector vconsensus;
+ public Hashtable [] hconsensus;
AlignmentAnnotation consensus;
AlignmentAnnotation conservation;
AlignmentAnnotation quality;
// We must set conservation and consensus before setting colour,
// as Blosum and Clustal require this to be done
- if(vconsensus==null && !isDataset)
+ if(hconsensus==null && !isDataset)
{
updateConservation();
updateConsensus();
if (globalColourScheme != null)
{
- globalColourScheme.setConsensus(vconsensus);
+ globalColourScheme.setConsensus(hconsensus);
}
}
}
if(alignment.isNucleotide())
return;
+ // System.out.println("UPDATING CONSERVATION");
+
try{
Conservation cons = new jalview.analysis.Conservation("All",
jalview.schemes.ResidueProperties.propHash, 3,
}
}
+
/**
* DOCUMENT ME!
*/
public void updateConsensus()
{
try{
- Annotation[] annotations = new Annotation[alignment.getWidth()];
-
- // this routine prevents vconsensus becoming a new object each time
- // consenus is calculated. Important for speed of Blosum62
- // and PID colouring of alignment
- if (vconsensus == null)
- {
- vconsensus = alignment.getAAFrequency();
- }
- else
- {
- Vector temp = alignment.getAAFrequency();
- vconsensus.clear();
-
- Enumeration e = temp.elements();
+ int aWidth = alignment.getWidth();
- while (e.hasMoreElements())
- {
- vconsensus.add(e.nextElement());
- }
- }
+ Annotation[] annotations = new Annotation[aWidth];
- Hashtable hash = null;
+ hconsensus = new Hashtable[aWidth];
+ AAFrequency.calculate(alignment.getSequencesArray(),
+ 0,
+ alignment.getWidth(),
+ hconsensus);
- for (int i = 0; i < alignment.getWidth(); i++)
+ for (int i = 0; i < aWidth; i++)
{
- hash = (Hashtable) vconsensus.elementAt(i);
-
float value = 0;
if (ignoreGapsInConsensusCalculation)
- value = ( (Float) hash.get("pid_nogaps")).floatValue();
+ value = ( (Float) hconsensus[i].get("pid_nogaps")).floatValue();
else
- value = ( (Float) hash.get("pid_gaps")).floatValue();
+ value = ( (Float) hconsensus[i].get("pid_gaps")).floatValue();
- String maxRes = hash.get("maxResidue").toString();
- String mouseOver = hash.get("maxResidue") + " ";
+ String maxRes = hconsensus[i].get("maxResidue").toString();
+ String mouseOver = hconsensus[i].get("maxResidue") + " ";
if (maxRes.length() > 1)
{
}
if (globalColourScheme != null)
- globalColourScheme.setConsensus(vconsensus);
+ globalColourScheme.setConsensus(hconsensus);
}catch(OutOfMemoryError error)
{