import jalview.schemes.ColourSchemeI;
import jalview.schemes.PIDColourScheme;
import jalview.schemes.ResidueProperties;
+import jalview.util.MappingUtils;
import jalview.workers.AlignCalcManager;
import jalview.workers.ConsensusThread;
import jalview.workers.StrucConsensusThread;
public abstract class AlignmentViewport implements AlignViewportI
{
/*
- * A viewport that is a slave of (driven by) this one in some sense.
+ * A viewport that hosts the cDna view of this (protein), or vice versa (if
+ * set).
*/
- AlignViewportI slave = null;
+ AlignViewportI codingComplement = null;
/**
* alignment displayed in the viewport. Please use get/setter
hideSequence(seqs);
+ AlignViewportI peer = getCodingComplement();
+ if (peer != null)
+ {
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(
+ selectionGroup, this, peer);
+ ((AlignmentViewport) peer).hideSequence(mappedGroup
+ .getSequencesInOrder(peer.getAlignment()));
+ peer.setSelectionGroup(null);
+
+ }
+
setSelectionGroup(null);
}
};
@Override
- public AlignViewportI getSlave()
+ public AlignViewportI getCodingComplement()
{
- return this.slave;
+ return this.codingComplement;
}
+ /**
+ * Set this as the (cDna/protein) complement of the given viewport. Also
+ * ensures the reverse relationship is set on the given viewport.
+ */
@Override
- public void setSlave(AlignViewportI sl)
+ public void setCodingComplement(AlignViewportI av)
{
- if (this == sl.getSlave())
+ if (this == av)
{
- System.err.println("Ignoring recursive setSlave request");
+ System.err.println("Ignoring recursive setCodingComplement request");
}
else
{
- this.slave = sl;
+ this.codingComplement = av;
+ // avoid infinite recursion!
+ if (av.getCodingComplement() != this)
+ {
+ av.setCodingComplement(this);
+ }
}
}
+
+ @Override
+ public boolean isNucleotide()
+ {
+ return getAlignment() == null ? false : getAlignment().isNucleotide();
+ }
}