import jalview.datamodel.Annotation;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.ColourMenuHelper.ColourChangeListener;
+import jalview.hmmer.HMMBuildThread;
import jalview.io.FileFormatI;
import jalview.io.FileFormats;
import jalview.io.FormatAdapter;
JMenuItem sequenceFeature = new JMenuItem();
+ JMenuItem hmmBuildGroup = new JMenuItem();
+
JMenuItem textColour = new JMenuItem();
JMenu jMenu1 = new JMenu();
* @param seq
* DOCUMENT ME!
*/
- public PopupMenu(final AlignmentPanel ap, Sequence seq, List<String> links)
+ public PopupMenu(final AlignmentPanel ap, Sequence seq,
+ List<String> links)
{
this(ap, seq, links, null);
}
* 'reference annotations' that may be added to the alignment. First for the
* currently selected sequence (if there is one):
*/
- final List<SequenceI> selectedSequence = (seq == null ? Collections
- .<SequenceI> emptyList() : Arrays.asList(seq));
+ final List<SequenceI> selectedSequence = (seq == null
+ ? Collections.<SequenceI> emptyList() : Arrays.asList(seq));
buildAnnotationTypesMenus(seqShowAnnotationsMenu,
seqHideAnnotationsMenu, selectedSequence);
configureReferenceAnnotationsMenu(seqAddReferenceAnnotations,
/*
* And repeat for the current selection group (if there is one):
*/
- final List<SequenceI> selectedGroup = (ap.av.getSelectionGroup() == null ? Collections
- .<SequenceI> emptyList() : ap.av.getSelectionGroup()
- .getSequences());
+ final List<SequenceI> selectedGroup = (ap.av.getSelectionGroup() == null
+ ? Collections.<SequenceI> emptyList()
+ : ap.av.getSelectionGroup().getSequences());
buildAnnotationTypesMenus(groupShowAnnotationsMenu,
groupHideAnnotationsMenu, selectedGroup);
configureReferenceAnnotationsMenu(groupAddReferenceAnnotations,
sequenceMenu.setText(sequence.getName());
if (seq == ap.av.getAlignment().getSeqrep())
{
- makeReferenceSeq.setText(MessageManager
- .getString("action.unmark_as_reference"));
+ makeReferenceSeq.setText(
+ MessageManager.getString("action.unmark_as_reference"));
}
else
{
- makeReferenceSeq.setText(MessageManager
- .getString("action.set_as_reference"));
+ makeReferenceSeq.setText(
+ MessageManager.getString("action.set_as_reference"));
}
if (!ap.av.getAlignment().isNucleotide())
menuItem = new JMenuItem();
menuItem.setText(MessageManager.formatMessage(
"label.2d_rna_structure_line",
- new Object[] { aa.label }));
+ new Object[]
+ { aa.label }));
menuItem.addActionListener(new ActionListener()
{
@Override
menuItem = new JMenuItem();
menuItem.setText(MessageManager.formatMessage(
"label.2d_rna_sequence_name",
- new Object[] { seq.getName() }));
+ new Object[]
+ { seq.getName() }));
menuItem.addActionListener(new ActionListener()
{
@Override
});
add(menuItem);
+ if (sequence.isHMMConsensusSequence())
+ {
+ JMenuItem selectHMM = new JCheckBoxMenuItem();
+ selectHMM.setText(MessageManager.getString("label.select_hmm"));
+ selectHMM.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ selectHMM_actionPerformed(e);
+ }
+ });
+ add(selectHMM);
+ }
+
if (ap.av.getSelectionGroup() != null
&& ap.av.getSelectionGroup().getSize() > 1)
{
- menuItem = new JMenuItem(MessageManager.formatMessage(
- "label.represent_group_with",
- new Object[] { seq.getName() }));
+ menuItem = new JMenuItem(
+ MessageManager.formatMessage("label.represent_group_with",
+ new Object[]
+ { seq.getName() }));
menuItem.addActionListener(new ActionListener()
{
@Override
}
SequenceGroup sg = ap.av.getSelectionGroup();
- boolean isDefinedGroup = (sg != null) ? ap.av.getAlignment()
- .getGroups().contains(sg) : false;
+ boolean isDefinedGroup = (sg != null)
+ ? ap.av.getAlignment().getGroups().contains(sg) : false;
if (sg != null && sg.getSize() > 0)
{
buildGroupURLMenu(sg, groupLinks);
}
// Add a 'show all structures' for the current selection
- Hashtable<String, PDBEntry> pdbe = new Hashtable<>(), reppdb = new Hashtable<>();
+ Hashtable<String, PDBEntry> pdbe = new Hashtable<>(),
+ reppdb = new Hashtable<>();
SequenceI sqass = null;
for (SequenceI sq : ap.av.getSequenceSelection())
{
}
if (pdbe.size() > 0)
{
- final PDBEntry[] pe = pdbe.values().toArray(
- new PDBEntry[pdbe.size()]), pr = reppdb.values().toArray(
- new PDBEntry[reppdb.size()]);
+ final PDBEntry[] pe = pdbe.values()
+ .toArray(new PDBEntry[pdbe.size()]),
+ pr = reppdb.values().toArray(new PDBEntry[reppdb.size()]);
final JMenuItem gpdbview, rpdbview;
}
}
showMenu.removeAll();
hideMenu.removeAll();
- final List<String> all = Arrays.asList(new String[] { MessageManager
- .getString("label.all") });
- addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true);
+ final List<String> all = Arrays
+ .asList(new String[]
+ { MessageManager.getString("label.all") });
+ addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true,
+ true);
addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true,
false);
showMenu.addSeparator();
for (int sq = 0; sq < seqs.length; sq++)
{
- int start = seqs[sq].findPosition(sg.getStartRes()), end = seqs[sq]
- .findPosition(sg.getEndRes());
+ int start = seqs[sq].findPosition(sg.getStartRes()),
+ end = seqs[sq].findPosition(sg.getEndRes());
// just collect ids from dataset sequence
// TODO: check if IDs collected from selecton group intersects with the
// current selection, too
if (((String[]) sarray[1])[sq] == null)
{
- if (!dbr[d].hasMap()
- || (dbr[d].getMap().locateMappedRange(start, end) != null))
+ if (!dbr[d].hasMap() || (dbr[d].getMap()
+ .locateMappedRange(start, end) != null))
{
((String[]) sarray[1])[sq] = dbr[d].getAccessionId();
((int[]) sarray[0])[0]++;
int type = urlLink.getGroupURLType() & 3;
// first two bits ofurlLink type bitfield are sequenceids and sequences
// TODO: FUTURE: ensure the groupURL menu structure can be generalised
- addshowLink(linkMenus[type], label
- + (((type & 1) == 1) ? ("("
- + (usingNames ? "Names" : ltarget) + ")") : ""),
+ addshowLink(linkMenus[type], label + (((type & 1) == 1)
+ ? ("(" + (usingNames ? "Names" : ltarget) + ")") : ""),
urlLink, urlset);
addMenu = true;
}
}
}
- private void addshowLinks(JMenu linkMenu, Collection<List<String>> linkset)
+ private void addshowLinks(JMenu linkMenu,
+ Collection<List<String>> linkset)
{
for (List<String> linkstrset : linkset)
{
private void addshowLink(JMenu linkMenu, String label, final String url)
{
JMenuItem item = new JMenuItem(label);
- item.setToolTipText(MessageManager.formatMessage(
- "label.open_url_param", new Object[] { url }));
+ item.setToolTipText(MessageManager.formatMessage("label.open_url_param",
+ new Object[]
+ { url }));
item.addActionListener(new ActionListener()
{
@Override
final GroupUrlLink urlgenerator, final Object[] urlstub)
{
JMenuItem item = new JMenuItem(label);
- item.setToolTipText(MessageManager.formatMessage(
- "label.open_url_seqs_param",
- new Object[] { urlgenerator.getUrl_prefix(),
- urlgenerator.getNumberInvolved(urlstub) }));
+ item.setToolTipText(
+ MessageManager.formatMessage("label.open_url_seqs_param",
+ new Object[]
+ { urlgenerator.getUrl_prefix(),
+ urlgenerator.getNumberInvolved(urlstub) }));
// TODO: put in info about what is being sent.
item.addActionListener(new ActionListener()
{
}
});
sequenceMenu.setText(MessageManager.getString("label.sequence"));
- sequenceName.setText(MessageManager
- .getString("label.edit_name_description"));
+ sequenceName.setText(
+ MessageManager.getString("label.edit_name_description"));
sequenceName.addActionListener(new ActionListener()
{
@Override
sequenceName_actionPerformed();
}
});
- chooseAnnotations.setText(MessageManager
- .getString("action.choose_annotations"));
+ chooseAnnotations
+ .setText(MessageManager.getString("action.choose_annotations"));
chooseAnnotations.addActionListener(new ActionListener()
{
@Override
chooseAnnotations_actionPerformed(e);
}
});
- sequenceDetails.setText(MessageManager
- .getString("label.sequence_details"));
+ sequenceDetails
+ .setText(MessageManager.getString("label.sequence_details"));
sequenceDetails.addActionListener(new ActionListener()
{
@Override
sequenceDetails_actionPerformed();
}
});
- sequenceSelDetails.setText(MessageManager
- .getString("label.sequence_details"));
+ sequenceSelDetails
+ .setText(MessageManager.getString("label.sequence_details"));
sequenceSelDetails.addActionListener(new ActionListener()
{
@Override
unGroupMenuItem_actionPerformed();
}
});
- createGroupMenuItem.setText(MessageManager
- .getString("action.create_group"));
+ createGroupMenuItem
+ .setText(MessageManager.getString("action.create_group"));
createGroupMenuItem.addActionListener(new ActionListener()
{
@Override
showColourText_actionPerformed();
}
});
- displayNonconserved.setText(MessageManager
- .getString("label.show_non_conserved"));
+ displayNonconserved
+ .setText(MessageManager.getString("label.show_non_conserved"));
displayNonconserved.setState(true);
displayNonconserved.addActionListener(new ActionListener()
{
changeCase(e);
}
});
- outputMenu.setText(MessageManager.getString("label.out_to_textbox")
- + "...");
- seqShowAnnotationsMenu.setText(MessageManager
- .getString("label.show_annotations"));
- seqHideAnnotationsMenu.setText(MessageManager
- .getString("label.hide_annotations"));
- groupShowAnnotationsMenu.setText(MessageManager
- .getString("label.show_annotations"));
- groupHideAnnotationsMenu.setText(MessageManager
- .getString("label.hide_annotations"));
- sequenceFeature.setText(MessageManager
- .getString("label.create_sequence_feature"));
+ outputMenu.setText(
+ MessageManager.getString("label.out_to_textbox") + "...");
+ seqShowAnnotationsMenu
+ .setText(MessageManager.getString("label.show_annotations"));
+ seqHideAnnotationsMenu
+ .setText(MessageManager.getString("label.hide_annotations"));
+ groupShowAnnotationsMenu
+ .setText(MessageManager.getString("label.show_annotations"));
+ groupHideAnnotationsMenu
+ .setText(MessageManager.getString("label.hide_annotations"));
+ sequenceFeature.setText(
+ MessageManager.getString("label.create_sequence_feature"));
sequenceFeature.addActionListener(new ActionListener()
{
@Override
sequenceFeature_actionPerformed();
}
});
+ hmmBuildGroup.setText(MessageManager.getString("label.group_hmmbuild"));
+ hmmBuildGroup.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hmmBuildGroup_actionPerformed();
+ }
+ });
jMenu1.setText(MessageManager.getString("label.group"));
- pdbStructureDialog.setText(MessageManager
- .getString("label.show_pdbstruct_dialog"));
+ pdbStructureDialog.setText(
+ MessageManager.getString("label.show_pdbstruct_dialog"));
pdbStructureDialog.addActionListener(new ActionListener()
{
@Override
}
});
- rnaStructureMenu.setText(MessageManager
- .getString("label.view_rna_structure"));
+ rnaStructureMenu
+ .setText(MessageManager.getString("label.view_rna_structure"));
// colStructureMenu.setText("Colour By Structure");
- editSequence.setText(MessageManager.getString("label.edit_sequence")
- + "...");
+ editSequence.setText(
+ MessageManager.getString("label.edit_sequence") + "...");
editSequence.addActionListener(new ActionListener()
{
@Override
editSequence_actionPerformed(actionEvent);
}
});
- makeReferenceSeq.setText(MessageManager
- .getString("label.mark_as_representative"));
+ makeReferenceSeq.setText(
+ MessageManager.getString("label.mark_as_representative"));
makeReferenceSeq.addActionListener(new ActionListener()
{
}
});
- hideInsertions.setText(MessageManager
- .getString("label.hide_insertions"));
+ hideInsertions
+ .setText(MessageManager.getString("label.hide_insertions"));
hideInsertions.addActionListener(new ActionListener()
{
jMenu1.add(outline);
jMenu1.add(displayNonconserved);
}
-
+
+ protected void hmmBuildGroup_actionPerformed()
+ {
+ new Thread(new HMMBuildThread(ap.alignFrame)).start();
+ ap.repaint();
+
+ }
+
+ protected void selectHMM_actionPerformed(ActionEvent e)
+ {
+ HiddenMarkovModel hmm = ap.av.getSequenceSelection()[0].getHMM();
+ ap.av.setSelectedHMM(hmm);
+ }
+
/**
* Constructs the entries for the colour menu
*/
}
});
- abovePIDColour.setText(MessageManager
- .getString("label.above_identity_threshold"));
+ abovePIDColour.setText(
+ MessageManager.getString("label.above_identity_threshold"));
abovePIDColour.addActionListener(new ActionListener()
{
@Override
}
});
- modifyPID.setText(MessageManager
- .getString("label.modify_identity_threshold"));
+ modifyPID.setText(
+ MessageManager.getString("label.modify_identity_threshold"));
modifyPID.addActionListener(new ActionListener()
{
@Override
}
});
- conservationMenuItem.setText(MessageManager
- .getString("action.by_conservation"));
+ conservationMenuItem
+ .setText(MessageManager.getString("action.by_conservation"));
conservationMenuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- conservationMenuItem_actionPerformed(conservationMenuItem
- .isSelected());
+ conservationMenuItem_actionPerformed(
+ conservationMenuItem.isSelected());
}
});
// int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
// .getName());
// sg.cs.setThreshold(threshold, ap.av.isIgnoreGapsConsensus());
- SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
- .getName());
+ SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup().getName());
SliderPanel.showPIDSlider();
}
}
SortedMap<String, String> tipEntries = new TreeMap<>();
final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>();
AlignmentI al = this.ap.av.getAlignment();
- AlignmentUtils.findAddableReferenceAnnotations(forSequences,
- tipEntries, candidates, al);
+ AlignmentUtils.findAddableReferenceAnnotations(forSequences, tipEntries,
+ candidates, al);
if (!candidates.isEmpty())
{
StringBuilder tooltip = new StringBuilder(64);
for (SequenceI seq : sequences)
{
contents.append("<p><h2>"
- + MessageManager
- .formatMessage(
- "label.create_sequence_details_report_annotation_for",
- new Object[] { seq.getDisplayId(true) })
+ + MessageManager.formatMessage(
+ "label.create_sequence_details_report_annotation_for",
+ new Object[]
+ { seq.getDisplayId(true) })
+ "</h2></p><p>");
new SequenceAnnotationReport(null)
- .createSequenceAnnotationReport(
- contents,
- seq,
- true,
- true,
- (ap.getSeqPanel().seqCanvas.fr != null) ? ap
- .getSeqPanel().seqCanvas.fr.getMinMax()
+ .createSequenceAnnotationReport(contents, seq, true, true,
+ (ap.getSeqPanel().seqCanvas.fr != null)
+ ? ap.getSeqPanel().seqCanvas.fr.getMinMax()
: null);
contents.append("</p>");
}
Desktop.addInternalFrame(cap, MessageManager.formatMessage(
"label.sequence_details_for",
- (sequences.length == 1 ? new Object[] { sequences[0]
- .getDisplayId(true) } : new Object[] { MessageManager
- .getString("label.selection") })), 500, 400);
+ (sequences.length == 1
+ ? new Object[]
+ { sequences[0].getDisplayId(true) }
+ : new Object[]
+ { MessageManager.getString("label.selection") })), 500, 400);
}
sg.getStartRes(), sg.getEndRes() + 1));
int threshold = SliderPanel.setPIDSliderSource(ap,
- sg.getGroupColourScheme(), getGroup()
- .getName());
+ sg.getGroupColourScheme(), getGroup().getName());
sg.cs.setThreshold(threshold, ap.av.isIgnoreGapsConsensus());
if (selected)
{
// JBPNote: Conservation name shouldn't be i18n translated
- Conservation c = new Conservation("Group", sg.getSequences(ap.av
- .getHiddenRepSequences()), sg.getStartRes(),
- sg.getEndRes() + 1);
+ Conservation c = new Conservation("Group",
+ sg.getSequences(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1);
c.calculate();
c.verdict(false, ap.av.getConsPercGaps());
SequenceGroup sg = getGroup();
EditNameDialog dialog = new EditNameDialog(sg.getName(),
- sg.getDescription(), " "
- + MessageManager.getString("label.group_name") + " ",
+ sg.getDescription(),
+ " " + MessageManager.getString("label.group_name") + " ",
MessageManager.getString("label.group_description") + " ",
MessageManager.getString("label.edit_group_name_description"),
ap.alignFrame);
{
if (dialog.getName().indexOf(" ") > -1)
{
- JvOptionPane
- .showMessageDialog(
- ap,
- MessageManager
- .getString("label.spaces_converted_to_backslashes"),
- MessageManager
- .getString("label.no_spaces_allowed_sequence_name"),
- JvOptionPane.WARNING_MESSAGE);
+ JvOptionPane.showMessageDialog(ap,
+ MessageManager
+ .getString("label.spaces_converted_to_backslashes"),
+ MessageManager
+ .getString("label.no_spaces_allowed_sequence_name"),
+ JvOptionPane.WARNING_MESSAGE);
}
sequence.setName(dialog.getName().replace(' ', '_'));
sequence.setDescription(dialog.getDescription());
- ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
- .getSequences());
+ ap.av.firePropertyChange("alignment", null,
+ ap.av.getAlignment().getSequences());
}
ap.alignFrame.addHistoryItem(caseCommand);
- ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
- .getSequences());
+ ap.av.firePropertyChange("alignment", null,
+ ap.av.getAlignment().getSequences());
}
}
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
cap.setForInput(null);
- Desktop.addInternalFrame(cap, MessageManager.formatMessage(
- "label.alignment_output_command",
- new Object[] { e.getActionCommand() }), 600, 500);
+ Desktop.addInternalFrame(cap,
+ MessageManager.formatMessage("label.alignment_output_command",
+ new Object[]
+ { e.getActionCommand() }), 600, 500);
String[] omitHidden = null;
// or we simply trust the user wants
// wysiwig behaviour
- FileFormatI fileFormat = FileFormats.getInstance().forName(e.getActionCommand());
- cap.setText(new FormatAdapter(ap).formatSequences(fileFormat, ap, true));
+ FileFormatI fileFormat = FileFormats.getInstance()
+ .forName(e.getActionCommand());
+ cap.setText(
+ new FormatAdapter(ap).formatSequences(fileFormat, ap, true));
}
public void sequenceFeature_actionPerformed()
if (start <= end)
{
seqs.add(sg.getSequenceAt(i).getDatasetSequence());
- features.add(new SequenceFeature(null, null, null, start, end, null));
+ features.add(
+ new SequenceFeature(null, null, null, start, end, null));
}
}
EditNameDialog dialog = new EditNameDialog(
sequence.getSequenceAsString(sg.getStartRes(),
- sg.getEndRes() + 1), null,
- MessageManager.getString("label.edit_sequence"), null,
+ sg.getEndRes() + 1),
+ null, MessageManager.getString("label.edit_sequence"), null,
MessageManager.getString("label.edit_sequence"),
ap.alignFrame);
{
EditCommand editCommand = new EditCommand(
MessageManager.getString("label.edit_sequences"),
- Action.REPLACE, dialog.getName().replace(' ',
- ap.av.getGapCharacter()),
+ Action.REPLACE,
+ dialog.getName().replace(' ', ap.av.getGapCharacter()),
sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment());
ap.alignFrame.addHistoryItem(editCommand);
- ap.av.firePropertyChange("alignment", null, ap.av.getAlignment()
- .getSequences());
+ ap.av.firePropertyChange("alignment", null,
+ ap.av.getAlignment().getSequences());
}
}
}