action.by_id = by Id
action.by_length = by Length
action.by_group = by Group
+action.unmark_as_reference = Unmark as Reference
+action.set_as_reference = Set as Reference
action.remove = Remove
-action.remove_redundancy = Remove Redundancy
+action.remove_redundancy = Remove Redundancy...
action.pairwise_alignment = Pairwise Alignments...
action.by_rna_helixes = by RNA Helices
action.user_defined = User Defined...
label.view_full_application = View in Full Application
label.load_associated_tree = Load Associated Tree ...
label.load_features_annotations = Load Features/Annotations ...
-label.export_features = Export Features
-label.export_annotations = Export Annotations
+label.export_features = Export Features ...
+label.export_annotations = Export Annotations ...
label.jalview_copy = Copy (Jalview Only)
label.jalview_cut = Cut (Jalview Only)
label.to_upper_case = To Upper Case
label.use_modeller_output = Use Modeller Output
label.wrap_alignment = Wrap Alignment
label.right_align_ids = Right Align Ids
-label.sequence_name_italics = Seq Name Italics
+label.sequence_name_italics = Sequence Name Italics
label.open_overview = Open Overview
label.default_colour_scheme_for_alignment = Default Colour Scheme for alignment
label.annotation_shading_default = Annotation Shading Default
*/
void updateGroupAnnotationSettings(boolean applyGlobalSettings,
boolean preserveNewGroupSettings);
+
+ /**
+ * @return true if a reference sequence is set and should be displayed
+ */
+ public boolean isDisplayReferenceSeq();
+
+ /**
+ * @return set the flag for displaying reference sequences when they are
+ * available
+ */
+ public void setDisplayReferenceSeq(boolean displayReferenceSeq);
+
+ /**
+ * @return true if colourschemes should render according to reference sequence
+ * rather than consensus if available
+ */
+ public boolean isColourByReferenceSeq();
+
+ /**
+ * @return true set flag for deciding if colourschemes should render according
+ * to reference sequence rather than consensus if available
+ */
+ public void setColourByReferenceSeq(boolean colourByReferenceSeq);
void setSequenceColour(SequenceI seq, Color col);
MenuItem selSeqDetails = new MenuItem(
MessageManager.getString("label.sequence_details") + "...");
+ MenuItem makeReferenceSeq = new MenuItem();
+
Sequence seq;
MenuItem revealAll = new MenuItem();
if (seq != null)
{
seqMenu.setLabel(seq.getName());
+ if (seq == ap.av.getAlignment().getSeqrep())
+ {
+ makeReferenceSeq.setLabel(MessageManager
+ .getString("action.unmark_as_reference"));// Unmark
+ // representative");
+ }
+ else
+ {
+ makeReferenceSeq.setLabel(MessageManager
+ .getString("action.set_as_reference")); // );
+ }
repGroup.setLabel(MessageManager.formatMessage(
"label.represent_group_with", new String[]
{ seq.getName() }));
{
editName();
}
+ else if (source == makeReferenceSeq)
+ {
+ makeReferenceSeq_actionPerformed();
+ }
else if (source == sequenceDetails)
{
showSequenceDetails();
toLower.addActionListener(this);
editMenu.add(toggleCase);
seqMenu.add(sequenceName);
+ seqMenu.add(makeReferenceSeq);
// seqMenu.add(sequenceDetails);
if (!ap.av.applet.useXtrnalSviewer)
repGroup.addActionListener(this);
revealAll.addActionListener(this);
revealSeq.addActionListener(this);
+ makeReferenceSeq.addActionListener(this);
}
void refresh()
getGroup().setDisplayText(showText.getState());
refresh();
}
+ public void makeReferenceSeq_actionPerformed()
+ {
+ if (!ap.av.getAlignment().hasSeqrep())
+ {
+ // initialise the display flags so the user sees something happen
+ ap.av.setDisplayReferenceSeq(true);
+ ap.av.setColourByReferenceSeq(true);
+ ap.av.getAlignment().setSeqrep(seq);
+ }
+ else
+ {
+ if (ap.av.getAlignment().getSeqrep() == seq)
+ {
+ ap.av.getAlignment().setSeqrep(null);
+ }
+ else
+ {
+ ap.av.getAlignment().setSeqrep(seq);
+ }
+ }
+ refresh();
+ }
public void showNonconserved_itemStateChanged()
{
SequenceI s = av.getAlignment().getSequenceAt(i);
gg.setFont(italic);
- if (av.hasHiddenRows())
+ if (av.isDisplayReferenceSeq() || av.hasHiddenRows())
{
setHiddenFont(s);
}
}
gg.setFont(italic);
// boolean isrep=false;
- if (av.hasHiddenRows())
+ if (av.isDisplayReferenceSeq() || av.hasHiddenRows())
{
// isrep =
setHiddenFont(seq);
Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont()
.getSize());
- if (av.getHiddenRepSequences() != null
- && av.getHiddenRepSequences().containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
gg.setFont(bold);
return true;
}
char s = ' ';
-
+ boolean srep = av.isDisplayReferenceSeq();
for (int i = start; i <= end; i++)
{
graphics.setColor(Color.black);
}
if (currentSequenceGroup.getShowNonconserved())
{
- // cheat - use this if we have a consensus for each group: s =
- // getDisplayChar(currentSequenceGroup.getConsensus(), i, s, '.');
- s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s,
+ s = getDisplayChar(srep, i, s,
'.');
}
}
}
if (av.getShowUnconserved())
{
- s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s,
+ s = getDisplayChar(srep, i, s,
'.');
}
}
- private char getDisplayChar(AlignmentAnnotation consensus, int position,
+ private char getDisplayChar(final boolean usesrep, int position,
char s, char c)
{
- char conschar = consensus.annotations[position].displayCharacter
+ // TODO - use currentSequenceGroup rather than alignemnt
+ // currentSequenceGroup.getConsensus()
+ char conschar = (usesrep) ? av.getAlignment().getSeqrep().getCharAt(position) : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
.charAt(0);
if (conschar != '-' && s == conschar)
{
}
}
+
+ private SequenceI seqrep=null;
+
+ /**
+ *
+ * @return the representative sequence for this group
+ */
+ public SequenceI getSeqrep()
+ {
+ return seqrep;
+ }
+
+ /**
+ * set the representative sequence for this group. Note - this affects the
+ * interpretation of the Hidereps attribute.
+ *
+ * @param seqrep
+ * the seqrep to set (null means no sequence representative)
+ */
+ public void setSeqrep(SequenceI seqrep)
+ {
+ this.seqrep = seqrep;
+ }
+
+ /**
+ *
+ * @return true if group has a sequence representative
+ */
+ public boolean hasSeqrep()
+ {
+ return seqrep != null;
+ }
+
@Override
public int getEndRes()
{
List<SequenceI> getSequences(
Map<SequenceI, SequenceCollectionI> hiddenReps);
-
int getWidth();
+ /**
+ *
+ * @return true if getSeqrep doesn't return null
+ */
+ boolean hasSeqrep();
+ /**
+ * get the reference or representative sequence within this collection
+ * @return null or the current reference sequence
+ */
+ SequenceI getSeqrep();
+ /**
+ * set the reference or representative sequence for this collection.
+ * Reference is assumed to be present within the collection.
+ * @return
+ */
+ void setSeqrep(SequenceI refseq);
/**
* @return the first column included in this collection. Runs from 0<=i<N_cols
alignPanel.paintAlignment(true);
}
}
+ public void clearAlignmentSeqRep()
+ {
+ // TODO refactor alignmentseqrep to controller
+ if (viewport.getAlignment().hasSeqrep()) {
+ viewport.getAlignment().setSeqrep(null);
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
+ }
@Override
protected void createGroup_actionPerformed(ActionEvent e)
for (int i = starty; i < alheight; i++)
{
SequenceI s = av.getAlignment().getSequenceAt(i);
- if (av.hasHiddenRows())
+ if (av.isDisplayReferenceSeq() || av.hasHiddenRows())
{
setHiddenFont(s);
}
continue;
}
- if (av.hasHiddenRows())
+ if (av.isDisplayReferenceSeq() || av.hasHiddenRows())
{
setHiddenFont(sequence);
}
JMenuItem sequenceDetails = new JMenuItem();
JMenuItem sequenceSelDetails = new JMenuItem();
+
+ JMenuItem makeReferenceSeq = new JMenuItem();
JMenuItem chooseAnnotations = new JMenuItem();
if (seq != null)
{
sequenceMenu.setText(sequence.getName());
+ if (seq == ap.av.getAlignment().getSeqrep())
+ {
+ makeReferenceSeq.setText("Unmark representative");
+ } else {
+ makeReferenceSeq.setText("Mark as representative");
+ }
if (seq.getDatasetSequence().getPDBId() != null
&& seq.getDatasetSequence().getPDBId().size() > 0)
}
// structureMenu.remove(colStructureMenu);
}
-
if (ap.av.getAlignment().isNucleotide() == true)
{
AlignmentAnnotation[] aa = ap.av.getAlignment()
}
}
}
-
}
menuItem = new JMenuItem(
editSequence_actionPerformed(actionEvent);
}
});
-
+ makeReferenceSeq.setText("Mark as representative");
+ makeReferenceSeq.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ makeReferenceSeq_actionPerformed(actionEvent);
+
+ }
+ });
/*
* annotationMenuItem.setText("By Annotation");
* annotationMenuItem.addActionListener(new ActionListener() { public void
groupMenu.add(jMenu1);
sequenceMenu.add(sequenceName);
sequenceMenu.add(sequenceDetails);
+ sequenceMenu.add(makeReferenceSeq);
colourMenu.add(textColour);
colourMenu.add(noColourmenuItem);
colourMenu.add(clustalColour);
}
refresh();
}
+protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
+{
+ if (!ap.av.getAlignment().hasSeqrep())
+ {
+ // initialise the display flags so the user sees something happen
+ ap.av.setDisplayReferenceSeq(true);
+ ap.av.setColourByReferenceSeq(true);
+ ap.av.getAlignment().setSeqrep(sequence);
+ }
+ else
+ {
+ if (ap.av.getAlignment().getSeqrep() == sequence)
+ {
+ ap.av.getAlignment().setSeqrep(null);
+ }
+ else
+ {
+ ap.av.getAlignment().setSeqrep(sequence);
+ }
+ }
+ refresh();
+}
protected void sequenceSelectionDetails_actionPerformed()
{
}
else
{
+ boolean srep = av.isDisplayReferenceSeq();
boolean getboxColour = false;
for (int i = start; i <= end; i++)
{
if (currentSequenceGroup.getShowNonconserved()) // todo optimize
{
// todo - use sequence group consensus
- s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s,
+ s = getDisplayChar(srep, i, s,
'.');
}
}
if (av.getShowUnconserved())
{
- s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s,
+ s = getDisplayChar(srep, i, s,
'.');
}
}
}
- private char getDisplayChar(AlignmentAnnotation consensus, int position,
+ private char getDisplayChar(final boolean usesrep, int position,
char s, char c)
{
- char conschar = consensus.annotations[position].displayCharacter
+ // TODO - use currentSequenceGroup rather than alignemnt
+ // currentSequenceGroup.getConsensus()
+ char conschar = (usesrep) ? av.getAlignment().getSeqrep().getCharAt(position) : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
.charAt(0);
if (conschar != '-' && s == conschar)
{
public boolean isHiddenRepSequence(SequenceI seq)
{
- return hiddenRepSequences != null
- && hiddenRepSequences.containsKey(seq);
+ return alignment.getSeqrep()==seq || (hiddenRepSequences != null
+ && hiddenRepSequences.containsKey(seq));
}
public SequenceGroup getRepresentedSequences(SequenceI seq)
}
oldrfs.clear();
}
+ /**
+ * show the reference sequence in the alignment view
+ */
+ private boolean displayReferenceSeq=false;
+ /**
+ * colour according to the reference sequence defined on the alignment
+ */
+ private boolean colourByReferenceSeq=false;
+
+ public boolean isDisplayReferenceSeq()
+ {
+ return alignment.hasSeqrep() && displayReferenceSeq;
+ }
+
+ public void setDisplayReferenceSeq(boolean displayReferenceSeq)
+ {
+ this.displayReferenceSeq = displayReferenceSeq;
+ }
+
+ public boolean isColourByReferenceSeq()
+ {
+ return alignment.hasSeqrep() && colourByReferenceSeq;
+ }
+
+ public void setColourByReferenceSeq(boolean colourByReferenceSeq)
+ {
+ this.colourByReferenceSeq = colourByReferenceSeq;
+ }
@Override
public Color getSequenceColour(SequenceI seq)