- if(alignment.isNucleotide())
- return;
-
- Conservation cons = new jalview.analysis.Conservation("All",
- jalview.schemes.ResidueProperties.propHash, 3,
- alignment.getSequences(), 0,
- alignment.getWidth() - 1);
- cons.calculate();
- cons.verdict(false, ConsPercGaps);
- cons.findQuality();
- int alWidth = alignment.getWidth();
- Annotation[] annotations = new Annotation[alWidth];
- Annotation[] qannotations = new Annotation[alWidth];
- String sequence = cons.getConsSequence().getSequence();
- float minR, minG, minB, maxR, maxG, maxB;
- minR = 0.3f;
- minG = 0.0f;
- minB = 0f;
- maxR = 1.0f - minR;
- maxG = 0.9f - minG;
- maxB = 0f - minB; // scalable range for colouring both Conservation and Quality
- float min = 0f;
- float max = 11f;
- float qmin = cons.qualityRange[0].floatValue();
- float qmax = cons.qualityRange[1].floatValue();
-
- for (int i = 0; i < alWidth; i++)
- {
- float value = 0;
- try
- {
- value = Integer.parseInt(sequence.charAt(i) + "");
- }
- catch (Exception ex)
- {
- if (sequence.charAt(i) == '*')
- {
- value = 11;
- }
- if (sequence.charAt(i) == '+')
- {
- value = 10;
- }
- }
- float vprop = value - min;
- vprop /= max;
-
- annotations[i] = new Annotation(sequence.charAt(i) + "",
- "", ' ', value,
- new Color(minR + maxR * vprop,
- minG + maxG * vprop,
- minB + maxB * vprop));
- // Quality calc
- value = ( (Double) cons.quality.elementAt(i)).floatValue();
- vprop = value - qmin;
- vprop /= qmax;
- qannotations[i] = new Annotation(" ",
- String.valueOf(value), ' ', value,
- new
- Color(minR + maxR * vprop,
- minG + maxG * vprop,
- minB + maxB * vprop));
- }
-
- if (conservation == null)
- {
- conservation = new AlignmentAnnotation("Conservation",
- "Conservation of total alignment less than " +
- ConsPercGaps + "% gaps",
- annotations,
- 0f, // cons.qualityRange[0].floatValue(),
- 11f, // cons.qualityRange[1].floatValue()
- AlignmentAnnotation.BAR_GRAPH);
- if (showConservation)
- {
- alignment.addAnnotation(conservation);
- }
- quality = new AlignmentAnnotation("Quality",
- "Alignment Quality based on Blosum62 scores",
- qannotations,
- cons.qualityRange[0].floatValue(),
- cons.qualityRange[1].floatValue(),
- AlignmentAnnotation.BAR_GRAPH);
- if (showQuality)
- {
- alignment.addAnnotation(quality);
- }
- }
- else