- * Add annotations to the sequences and to the alignment.
- *
- * @param candidates
- * a map whose keys are sequences on the alignment, and values a list
- * of annotations to add to each sequence
- */
- protected void addReferenceAnnotations_actionPerformed(
- Map<SequenceI, List<AlignmentAnnotation>> candidates)
- {
- for (SequenceI seq : candidates.keySet())
- {
- for (AlignmentAnnotation ann : candidates.get(seq))
- {
- AlignmentAnnotation copyAnn = new AlignmentAnnotation(ann);
- int startRes = 0;
- int endRes = ann.annotations.length;
- final SequenceGroup selectionGroup = this.ap.av.getSelectionGroup();
- if (selectionGroup != null)
- {
- startRes = selectionGroup.getStartRes();
- endRes = selectionGroup.getEndRes();
- }
- copyAnn.restrict(startRes, endRes);
-
- // add to the sequence (sets correct copyAnn.datasetSequence)
- seq.addAlignmentAnnotation(copyAnn);
- // adjust for gaps
- copyAnn.adjustForAlignment();
- // add to the alignment and set visible
- this.ap.getAlignment().addAnnotation(copyAnn);
- copyAnn.visible = true;
- }
- }
- refresh();
- }
-
- protected void sequenceSelectionDetails_actionPerformed()
- {
- createSequenceDetailsReport(ap.av.getSequenceSelection());
- }
-
- protected void sequenceDetails_actionPerformed()
- {
- createSequenceDetailsReport(new SequenceI[]
- { sequence });
- }
-
- public void createSequenceDetailsReport(SequenceI[] sequences)
- {
- CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer();
- StringBuffer contents = new StringBuffer();
- for (SequenceI seq : sequences)
- {
- contents.append("<p><h2>"
- + MessageManager
- .formatMessage(
- "label.create_sequence_details_report_annotation_for",
- new String[]
- { seq.getDisplayId(true) }) + "</h2></p><p>");
- new SequenceAnnotationReport(null)
- .createSequenceAnnotationReport(
- contents,
- seq,
- true,
- true,
- false,
- (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.minmax
- : null);
- contents.append("</p>");
- }
- cap.setText("<html>" + contents.toString() + "</html>");
-
- Desktop.instance.addInternalFrame(cap, MessageManager.formatMessage(
- "label.sequece_details_for",
- (sequences.length == 1 ? new String[]
- { sequences[0].getDisplayId(true) } : new String[]
- { MessageManager.getString("label.selection") })), 500, 400);
-
- }
-
- protected void showNonconserved_actionPerformed()
- {
- getGroup().setShowNonconserved(displayNonconserved.isSelected());
- refresh();
- }
-
- /**
- * call to refresh view after settings change
- */
- void refresh()
- {
- ap.updateAnnotation();
- ap.paintAlignment(true);
-
- PaintRefresher.Refresh(this, ap.av.getSequenceSetId());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void clustalColour_actionPerformed()
- {
- SequenceGroup sg = getGroup();
- sg.cs = new ClustalxColourScheme(sg, ap.av.getHiddenRepSequences());
- refresh();
- }
-
- /**
- * DOCUMENT ME!