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;
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.
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
JvOptionPane.WARNING_MESSAGE);
}
/**
- * Constructor for a PopupMenu for a click in the alignment panel (on a
- * residue)
+ * Constructor for a PopupMenu for a click in the alignment panel (on a residue)
*
* @param ap
- * the panel in which the mouse is clicked
+ * the panel in which the mouse is clicked
* @param seq
- * the sequence under the mouse
+ * the sequence under the mouse
* @throws NullPointerException
- * if seq is null
+ * if seq is null
*/
public PopupMenu(final AlignmentPanel ap, SequenceI seq, int column)
{
* Constructor for a PopupMenu for a click in the sequence id panel
*
* @param alignPanel
- * the panel in which the mouse is clicked
+ * the panel in which the mouse is clicked
* @param seq
- * the sequence under the mouse click
+ * the sequence under the mouse click
* @param groupLinks
- * templates for sequence external links
+ * templates for sequence external links
* @throws NullPointerException
- * if seq is null
+ * if seq is null
*/
public PopupMenu(final AlignmentPanel alignPanel, final SequenceI seq,
List<String> groupLinks)
* @param alignPanel
* @param seq
* @param column
- * aligned column position (0...)
+ * aligned column position (0...)
* @param groupLinks
*/
- private PopupMenu(boolean fromIdPanel, final AlignmentPanel alignPanel,
+ private PopupMenu(boolean fromIdPanel,
+ final AlignmentPanel alignPanel,
final SequenceI seq, final int column, List<String> groupLinks)
{
Objects.requireNonNull(seq);
/*
* And repeat for the current selection group (if there is one):
*/
- final List<SequenceI> selectedGroup = (alignPanel.av
- .getSelectionGroup() == null
- ? Collections.<SequenceI> emptyList()
- : alignPanel.av.getSelectionGroup().getSequences());
+ final List<SequenceI> selectedGroup = (alignPanel.av.getSelectionGroup() == null
+ ? Collections.<SequenceI> emptyList()
+ : alignPanel.av.getSelectionGroup().getSequences());
buildAnnotationTypesMenus(groupShowAnnotationsMenu,
groupHideAnnotationsMenu, selectedGroup);
configureReferenceAnnotationsMenu(groupAddReferenceAnnotations,
}
}
+ 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()
{
buildGroupURLMenu(sg, groupLinks);
}
+ // TODO REMOVE FOR 2.12 ?
// Add a 'show all structures' for the current selection
- Hashtable<String, PDBEntry> pdbe = new Hashtable<>(),
- reppdb = new Hashtable<>();
+ Hashtable<String, PDBEntry> pdbe = new Hashtable<>();
+ Hashtable<String, PDBEntry> reppdb = new Hashtable<>();
SequenceI sqass = null;
for (SequenceI sq : alignPanel.av.getSequenceSelection())
{
createGroupMenuItem.setVisible(true);
unGroupMenuItem.setVisible(false);
- editGroupMenu
- .setText(MessageManager.getString("action.edit_new_group"));
+ editGroupMenu.setText(MessageManager.getString("action.edit_new_group"));
}
else
{
* <li>positional feature links (alignment panel popup menu)</li>
* <li>feature details links (alignment panel popup menu)</li>
* </ul>
- * If this panel is also showed complementary (CDS/protein) features, then
- * links to their feature details are also added.
+ * If this panel is also showed complementary (CDS/protein) features, then links
+ * to their feature details are also added.
*
* @param seq
* @param column
if (((String[]) sarray[1])[sq] == null)
{
- if (!e.hasMap()
- || (e.getMap().locateMappedRange(start, end) != null))
+ if (!e.hasMap() || (e.getMap()
+ .locateMappedRange(start, end) != null))
{
((String[]) sarray[1])[sq] = e.getAccessionId();
((int[]) sarray[0])[0]++;
}
inserts.and(sq.getInsertionsAsBits());
}
- hidden.clearAndHideColumns(inserts,
- ap.av.getSelectionGroup().getStartRes(),
+ hidden.clearAndHideColumns(inserts, ap.av.getSelectionGroup().getStartRes(),
ap.av.getSelectionGroup().getEndRes());
}
/**
* Shows a dialog where the sequence name and description may be edited. If a
- * name containing spaces is entered, these are converted to underscores, with
- * a warning message.
+ * name containing spaces is entered, these are converted to underscores, with a
+ * warning message.
*/
void sequenceName_actionPerformed()
{
sequence.getDescription(),
MessageManager.getString("label.sequence_name"),
MessageManager.getString("label.sequence_description"));
- dialog.showDialog(ap.alignFrame, MessageManager.getString(
- "label.edit_sequence_name_description"), new Runnable()
+ dialog.showDialog(ap.alignFrame,
+ MessageManager.getString(
+ "label.edit_sequence_name_description"),
+ new Runnable()
{
@Override
public void run()
ap.paintAlignment(false, false);
}
sequence.setDescription(dialog.getDescription());
- ap.av.firePropertyChange("alignment", null,
- ap.av.getAlignment().getSequences());
+ ap.av.notifyAlignment();
}
});
}
*/
protected void outline_actionPerformed()
{
- String title = MessageManager.getString("label.select_outline_colour");
+ String title = MessageManager
+ .getString("label.select_outline_colour");
ColourChooserListener listener = new ColourChooserListener()
{
@Override
refresh();
}
};
- JalviewColourChooser.showColourChooser(Desktop.getDesktop(), title,
- Color.BLUE, listener);
+ JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(),
+ title, Color.BLUE, listener);
}
/**
startEnd, caseChange);
ap.alignFrame.addHistoryItem(caseCommand);
+ ap.av.notifyAlignment();
- ap.av.firePropertyChange("alignment", null,
- ap.av.getAlignment().getSequences());
}
}
sg.getStartRes(), sg.getEndRes() + 1,
ap.av.getAlignment());
ap.alignFrame.addHistoryItem(editCommand);
- ap.av.firePropertyChange("alignment", null,
- ap.av.getAlignment().getSequences());
+ ap.av.notifyAlignment();
}
});
}