+ int aWidth = this.getWidth();
+ // pointer
+ // possibility
+ // here.
+ if (aWidth < 0)
+ {
+ return null;
+ }
+ if (consensus==null)
+ {
+ consensus = new AlignmentAnnotation("Consensus for "+getName(), "PID",
+ new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
+ consensus.hasText = true;
+ consensus.autoCalculated = true;
+ consensus.groupRef = this;
+ }
+ return consensus;
+ }
+ /**
+ * get the conservation annotation row for this group
+ * @return autoCalculated annotation row
+ */
+ public AlignmentAnnotation getConservationRow() {
+ int ConsPercGaps = 25;
+ if (conservation == null) {
+ conservation = new AlignmentAnnotation("Conservation",
+ "Conservation of total alignment less than " + ConsPercGaps
+ + "% gaps", new Annotation[1], 0f, 11f,
+ AlignmentAnnotation.BAR_GRAPH);
+ conservation.hasText = true;
+ conservation.autoCalculated = true;
+ conservation.groupRef = this;
+ }
+
+ return conservation;
+ }
+
+ /**
+ *
+ * @return true if annotation rows have been instantiated for this group
+ */
+ public boolean hasAnnotationRows()
+ {
+ return consensus!=null || conservation!=null;
+ }
+
+ public SequenceI getConsensusSeq()
+ {
+ getConsensus();
+ StringBuffer seqs = new StringBuffer();
+ for (int i = 0; i < consensus.annotations.length; i++)
+ {
+ if (consensus.annotations[i] != null)
+ {
+ if (consensus.annotations[i].description.charAt(0) == '[')
+ {
+ seqs.append(consensus.annotations[i].description.charAt(1));
+ }
+ else
+ {
+ seqs.append(consensus.annotations[i].displayCharacter);
+ }
+ }
+ }
+
+ SequenceI sq = new Sequence("Group"+getName()+" Consensus", seqs.toString());
+ sq.setDescription("Percentage Identity Consensus "
+ + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
+ return sq;
+ }
+
+ public void setIgnoreGapsConsensus(boolean state)
+ {
+ if (this.ignoreGapsInConsensusCalculation!=state && consensus!=null)
+ {
+ ignoreGapsInConsensusCalculation = state;
+ recalcConservation();
+ }
+ ignoreGapsInConsensusCalculation = state;