public abstract class AlignmentViewport
implements AlignViewportI, CommandListener, VamsasSource
{
+ /**
+ * An enum for auto-calculated annotations, with constants for the
+ * annotation's label, and the key for the property to show it or not
+ */
+ public enum AutoAnnotation
+ {
+ CONSERVATION("Conservation", "SHOW_CONSERVATION"),
+ QUALITY("Quality", "SHOW_QUALITY"),
+ CONSENSUS("Consensus", "SHOW_IDENTITY"),
+ CDNA_CONSENSUS("cDNA Consensus", null),
+ STRUCTURE_CONSENSUS("StrucConsensus", null),
+ OCCUPANCY("Occupancy", "SHOW_OCCUPANCY");
+
+ public final String label;
+ public final String preferenceKey;
+
+ private AutoAnnotation(String lbl, String prefKey)
+ {
+ this.label = lbl;
+ this.preferenceKey = prefKey;
+ }
+ }
+
protected ViewportRanges ranges;
protected ViewStyleI viewStyle = new ViewStyle();
* retain any colour thresholds per group while
* changing choice of colour scheme (JAL-2386)
*/
- sg.setColourScheme(cs.getInstance(sg, hiddenRepSequences));
+ sg.setColourScheme(
+ cs == null ? null : cs.getInstance(this, sg));
if (cs != null)
{
sg.getGroupColourScheme().alignmentChanged(sg,
public void invertColumnSelection()
{
colSel.invertColumnSelection(0, alignment.getWidth(), alignment);
+ isColSelChanged(true);
}
@Override
{
initRNAStructure();
}
- consensus = new AlignmentAnnotation("Consensus",
+ consensus = new AlignmentAnnotation(AutoAnnotation.CONSENSUS.label,
MessageManager.getString("label.consensus_descr"),
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
initConsensus(consensus);
}
if (doConsensus)
{
- complementConsensus = new AlignmentAnnotation("cDNA Consensus",
+ complementConsensus = new AlignmentAnnotation(
+ AutoAnnotation.CDNA_CONSENSUS.label,
MessageManager
.getString("label.complement_consensus_descr"),
new Annotation[1], 0f, 100f,
}
}
- // these should be extracted from the view model - style and settings for
- // derived annotation
private void initGapCounts()
{
if (showOccupancy)
{
- gapcounts = new AlignmentAnnotation("Occupancy",
+ gapcounts = new AlignmentAnnotation(AutoAnnotation.OCCUPANCY.label,
MessageManager.getString("label.occupancy_descr"),
new Annotation[1], 0f, alignment.getHeight(),
AlignmentAnnotation.BAR_GRAPH);
{
if (conservation == null)
{
- conservation = new AlignmentAnnotation("Conservation",
+ conservation = new AlignmentAnnotation(
+ AutoAnnotation.CONSERVATION.label,
MessageManager.formatMessage("label.conservation_descr",
getConsPercGaps()),
new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
{
if (quality == null)
{
- quality = new AlignmentAnnotation("Quality",
+ quality = new AlignmentAnnotation(AutoAnnotation.QUALITY.label,
MessageManager.getString("label.quality_descr"),
new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
quality.hasText = true;
{
if (alignment.hasRNAStructure() && strucConsensus == null)
{
- strucConsensus = new AlignmentAnnotation("StrucConsensus",
+ strucConsensus = new AlignmentAnnotation(
+ AutoAnnotation.STRUCTURE_CONSENSUS.label,
MessageManager.getString("label.strucconsensus_descr"),
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
strucConsensus.hasText = true;
return sortAnnotationsBy;
}
+ @Override
public void setSortAnnotationsBy(
SequenceAnnotationOrder sortAnnotationsBy)
{
this.sortAnnotationsBy = sortAnnotationsBy;
}
+ @Override
public boolean isShowAutocalculatedAbove()
{
return showAutocalculatedAbove;
}
+ @Override
public void setShowAutocalculatedAbove(boolean showAutocalculatedAbove)
{
this.showAutocalculatedAbove = showAutocalculatedAbove;
{
return currentTree;
}
+
+ /**
+ * flag set to indicate if structure views might be out of sync with sequences
+ * in the alignment
+ */
+
+ private boolean needToUpdateStructureViews = false;
+
+ @Override
+ public boolean isUpdateStructures()
+ {
+ return needToUpdateStructureViews;
+ }
+
+ @Override
+ public void setUpdateStructures(boolean update)
+ {
+ needToUpdateStructureViews = update;
+ }
+
+ @Override
+ public boolean needToUpdateStructureViews()
+ {
+ boolean update = needToUpdateStructureViews;
+ needToUpdateStructureViews = false;
+ return update;
+ }
+
+ @Override
+ public void addSequenceGroup(SequenceGroup sequenceGroup)
+ {
+ alignment.addGroup(sequenceGroup);
+
+ Color col = sequenceGroup.idColour;
+ if (col != null)
+ {
+ col = col.brighter();
+
+ for (SequenceI sq : sequenceGroup.getSequences())
+ {
+ setSequenceColour(sq, col);
+ }
+ }
+
+ if (codingComplement != null)
+ {
+ SequenceGroup mappedGroup = MappingUtils
+ .mapSequenceGroup(sequenceGroup, this, codingComplement);
+ if (mappedGroup.getSequences().size() > 0)
+ {
+ codingComplement.getAlignment().addGroup(mappedGroup);
+
+ if (col != null)
+ {
+ for (SequenceI seq : mappedGroup.getSequences())
+ {
+ codingComplement.setSequenceColour(seq, col);
+ }
+ }
+ }
+ // propagate the structure view update flag according to our own setting
+ codingComplement.setUpdateStructures(needToUpdateStructureViews);
+ }
+ }
}