X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=f46bd4e03807c86517b2de8d93dd9c198469f7cb;hb=586ade46bdcd05ff028a1cff82c3c527326d28ec;hp=4469b43a969b9e87aaffc50b6481fe181fcc1df4;hpb=54f6fe32b978af0932428981a56c9960b0df44a7;p=jalview.git diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 4469b43..f46bd4e 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -64,11 +64,13 @@ import jalview.datamodel.DBRefEntry; import jalview.datamodel.HiddenColumns; import jalview.datamodel.MappedFeatures; import jalview.datamodel.PDBEntry; +import jalview.datamodel.ResidueCount; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.ColourMenuHelper.ColourChangeListener; import jalview.gui.JalviewColourChooser.ColourChooserListener; +import jalview.io.CountReader; import jalview.io.FileFormatI; import jalview.io.FileFormats; import jalview.io.FormatAdapter; @@ -87,6 +89,9 @@ import jalview.util.StringUtils; import jalview.util.UrlLink; import jalview.viewmodel.seqfeatures.FeatureRendererModel; +import java.io.IOException; +import java.net.MalformedURLException; + /** * The popup menu that is displayed on right-click on a sequence id, or in the * sequence alignment. @@ -545,6 +550,36 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } } + if (seq.hasHMMProfile()) + { + menuItem = new JMenuItem(MessageManager + .getString("action.add_background_frequencies")); + menuItem.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + try + { + ResidueCount counts = CountReader.getBackgroundFrequencies(ap, + seq); + if (counts != null) + { + seq.getHMM().setBackgroundFrequencies(counts); + ap.alignFrame.buildColourMenu(); + } + } catch (MalformedURLException e1) + { + e1.printStackTrace(); + } catch (IOException e1) + { + e1.printStackTrace(); + } + } + }); + add(menuItem); + } + menuItem = new JMenuItem( MessageManager.getString("action.hide_sequences")); menuItem.addActionListener(new ActionListener() @@ -669,7 +704,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener buildGroupURLMenu(sg, groupLinks); } // Add a 'show all structures' for the current selection - Hashtable pdbe = new Hashtable<>(), reppdb = new Hashtable<>(); + Hashtable pdbe = new Hashtable<>(); + Hashtable reppdb = new Hashtable<>(); SequenceI sqass = null; for (SequenceI sq : alignPanel.av.getSequenceSelection())