X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=037f0070997b302d4913198437b53744c3d9a477;hb=6fb502e4a8749d1d98f5442c3b8156ab47996b77;hp=c35496433f92978d338d81e03c7b7e80ec3bdf87;hpb=27e20b88d0c73ced06e9c20a6e0fa14e27fed179;p=jalview.git
diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java
index c354964..037f007 100644
--- a/src/jalview/gui/PopupMenu.java
+++ b/src/jalview/gui/PopupMenu.java
@@ -1,13 +1,13 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -23,16 +23,7 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.xml.sax.SAXException;
-import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
-import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
-import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
-import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
-
-import MCview.*;
import jalview.analysis.*;
import jalview.commands.*;
import jalview.datamodel.*;
@@ -93,12 +84,13 @@ public class PopupMenu extends JPopupMenu
JMenu sequenceMenu = new JMenu();
JMenuItem sequenceName = new JMenuItem();
-
+
JMenuItem sequenceDetails = new JMenuItem();
+
JMenuItem sequenceSelDetails = new JMenuItem();
SequenceI sequence;
-
+ JMenuItem createGroupMenuItem = new JMenuItem();
JMenuItem unGroupMenuItem = new JMenuItem();
JMenuItem outline = new JMenuItem();
@@ -130,7 +122,11 @@ public class PopupMenu extends JPopupMenu
JMenu pdbMenu = new JMenu();
JMenuItem pdbFromFile = new JMenuItem();
-
+ // JBPNote: Commented these out - Should add these services via the web services menu system.
+ // JMenuItem ContraFold = new JMenuItem();
+
+ // JMenuItem RNAFold = new JMenuItem();
+
JMenuItem enterPDB = new JMenuItem();
JMenuItem discoverPDB = new JMenuItem();
@@ -174,8 +170,8 @@ public class PopupMenu extends JPopupMenu
* @param links
* @param groupLinks
*/
- public PopupMenu(final AlignmentPanel ap, final SequenceI seq, Vector links,
- Vector groupLinks)
+ public PopupMenu(final AlignmentPanel ap, final SequenceI seq,
+ Vector links, Vector groupLinks)
{
// /////////////////////////////////////////////////////////
// If this is activated from the sequence panel, the user may want to
@@ -249,8 +245,10 @@ public class PopupMenu extends JPopupMenu
{
public void actionPerformed(ActionEvent e)
{
- // TODO re JAL-860: optionally open dialog or provide a menu entry allowing user to open just one structure per sequence
- new AppJmol(pdb, ap.av.collateForPDB(new PDBEntry[] { pdb })[0], null, ap);
+ // TODO re JAL-860: optionally open dialog or provide a menu entry
+ // allowing user to open just one structure per sequence
+ new AppJmol(pdb, ap.av.collateForPDB(new PDBEntry[]
+ { pdb })[0], null, ap);
// new PDBViewer(pdb, seqs2, null, ap, AppletFormatAdapter.FILE);
}
@@ -270,22 +268,23 @@ public class PopupMenu extends JPopupMenu
{
if (ap.av.getAlignment().isNucleotide() == false)
{
- structureMenu.remove(viewStructureMenu);
+ structureMenu.remove(viewStructureMenu);
}
// structureMenu.remove(colStructureMenu);
}
if (ap.av.getAlignment().isNucleotide() == true)
{
- AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment()
+ .getAlignmentAnnotation();
for (int i = 0; i < aa.length; i++)
{
if (aa[i].getRNAStruc() != null)
{
final String rnastruc = aa[i].getRNAStruc();
- final String structureLine=aa[i].label;
+ final String structureLine = aa[i].label;
menuItem = new JMenuItem();
- menuItem.setText("2D RNA "+structureLine);
+ menuItem.setText("2D RNA " + structureLine);
menuItem.addActionListener(new java.awt.event.ActionListener()
{
@@ -320,19 +319,19 @@ public class PopupMenu extends JPopupMenu
if (seqAnno[i].getRNAStruc() != null)
{
final String rnastruc = seqAnno[i].getRNAStruc();
-
- // TODO: make rnastrucF a bit more nice
+
+ // TODO: make rnastrucF a bit more nice
menuItem = new JMenuItem();
- menuItem.setText("2D RNA - "+seq.getName());
+ menuItem.setText("2D RNA - " + seq.getName());
menuItem.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
// TODO: VARNA does'nt print gaps in the sequence
- //new AppVarna(seq.getName()+" structure",seq,rnastruc,seq.getRNA(), seq.getName(), ap);
- new AppVarna(seq.getName()+" structure",seq,seq.getSequenceAsString(), rnastruc, seq
- .getName(), ap);
+ new AppVarna(seq.getName() + " structure", seq, seq
+ .getSequenceAsString(), rnastruc, seq.getName(),
+ ap);
}
});
viewStructureMenu.add(menuItem);
@@ -340,7 +339,6 @@ public class PopupMenu extends JPopupMenu
}
}
-
}
menuItem = new JMenuItem("Hide Sequences");
@@ -391,7 +389,8 @@ public class PopupMenu extends JPopupMenu
}
}
// for the case when no sequences are even visible
- if (ap.av.hasHiddenRows()) {
+ if (ap.av.hasHiddenRows())
+ {
{
menuItem = new JMenuItem("Reveal All");
menuItem.addActionListener(new ActionListener()
@@ -412,10 +411,11 @@ public class PopupMenu extends JPopupMenu
}
SequenceGroup sg = ap.av.getSelectionGroup();
+ boolean isDefinedGroup = (sg!=null) ? ap.av.getAlignment().getGroups().contains(sg) : false;
- if (sg != null&& sg.getSize()>0)
- {
- groupName.setText("Name: "+sg.getName());
+ if (sg != null && sg.getSize() > 0)
+ {
+ groupName.setText("Name: " + sg.getName());
groupName.setText("Edit name and description of current group.");
if (sg.cs instanceof ZappoColourScheme)
@@ -467,10 +467,7 @@ public class PopupMenu extends JPopupMenu
purinePyrimidineColour.setSelected(true);
}
- else if (sg.cs instanceof RNAInteractionColourScheme)
- {
- RNAInteractionColour.setSelected(true);
- }
+
/*
* else if (sg.cs instanceof CovariationColourScheme) {
* covariationColour.setSelected(true); }
@@ -494,36 +491,43 @@ public class PopupMenu extends JPopupMenu
buildGroupURLMenu(sg, groupLinks);
}
// Add a 'show all structures' for the current selection
- HashtableAnnotation for "+seq.getDisplayId(true)+"
"); - new SequenceAnnotationReport(null) - .createSequenceAnnotationReport( - contents, - seq, - true, - true,false, - (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.minmax - : null); - contents.append("
"); + for (SequenceI seq : sequences) + { + contents.append(""); + new SequenceAnnotationReport(null) + .createSequenceAnnotationReport( + contents, + seq, + true, + true, + false, + (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.minmax + : null); + contents.append("
"); } cap.setText("" + contents.toString() + ""); - - Desktop.instance.addInternalFrame(cap, - "Sequence Details for " + (sequences.length==1 ? sequences[0].getDisplayId(true) : "Selection") -, 500, 400); - + + Desktop.instance.addInternalFrame(cap, "Sequence Details for " + + (sequences.length == 1 ? sequences[0].getDisplayId(true) + : "Selection"), 500, 400); + } protected void showNonconserved_actionPerformed() @@ -1403,8 +1428,7 @@ public class PopupMenu extends JPopupMenu protected void clustalColour_actionPerformed() { SequenceGroup sg = getGroup(); - sg.cs = new ClustalxColourScheme( - sg,ap.av.getHiddenRepSequences()); + sg.cs = new ClustalxColourScheme(sg, ap.av.getHiddenRepSequences()); refresh(); } @@ -1510,11 +1534,7 @@ public class PopupMenu extends JPopupMenu refresh(); } - protected void RNAInteractionColour_actionPerformed() - { - getGroup().cs = new RNAInteractionColourScheme(); - refresh(); - } + /* * protected void covariationColour_actionPerformed() { getGroup().cs = new * CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); } @@ -1536,8 +1556,8 @@ public class PopupMenu extends JPopupMenu if (abovePIDColour.isSelected()) { sg.cs.setConsensus(AAFrequency.calculate( - sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(), - sg.getEndRes() + 1)); + sg.getSequences(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1)); int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup() .getName()); @@ -1590,8 +1610,8 @@ public class PopupMenu extends JPopupMenu SequenceGroup sg = getGroup(); sg.cs = new PIDColourScheme(); sg.cs.setConsensus(AAFrequency.calculate( - sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(), - sg.getEndRes() + 1)); + sg.getSequences(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1)); refresh(); } @@ -1608,8 +1628,8 @@ public class PopupMenu extends JPopupMenu sg.cs = new Blosum62ColourScheme(); sg.cs.setConsensus(AAFrequency.calculate( - sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(), - sg.getEndRes() + 1)); + sg.getSequences(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1)); refresh(); } @@ -1643,8 +1663,8 @@ public class PopupMenu extends JPopupMenu if (conservationMenuItem.isSelected()) { Conservation c = new Conservation("Group", - ResidueProperties.propHash, 3, - sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(), + ResidueProperties.propHash, 3, sg.getSequences(ap.av + .getHiddenRepSequences()), sg.getStartRes(), sg.getEndRes() + 1); c.calculate(); @@ -1676,7 +1696,7 @@ public class PopupMenu extends JPopupMenu sequence.getAnnotation()[0], null, AnnotationColourGradient.NO_THRESHOLD); - acg.predefinedColours = true; + acg.setPredefinedColours(true); sg.cs = acg; refresh(); @@ -1776,6 +1796,11 @@ public class PopupMenu extends JPopupMenu ap.av.setSelectionGroup(null); refresh(); } + void createGroupMenuItem_actionPerformed() + { + getGroup(); // implicitly creates group - note - should apply defaults / use standard alignment window logic for this + refresh(); + } /** * DOCUMENT ME! @@ -1926,8 +1951,8 @@ public class PopupMenu extends JPopupMenu } ChangeCaseCommand caseCommand = new ChangeCaseCommand(description, - sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), startEnd, - caseChange); + sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), + startEnd, caseChange); ap.alignFrame.addHistoryItem(caseCommand); @@ -1953,7 +1978,8 @@ public class PopupMenu extends JPopupMenu ColumnSelection csel = new ColumnSelection(ap.av.getColumnSelection()); omitHidden = ap.av.getViewAsString(true); Alignment oal = new Alignment(ap.av.getSequenceSelection()); - AlignmentAnnotation[] nala = ap.av.getAlignment().getAlignmentAnnotation(); + AlignmentAnnotation[] nala = ap.av.getAlignment() + .getAlignmentAnnotation(); if (nala != null) { for (int i = 0; i < nala.length; i++) @@ -1967,13 +1993,15 @@ public class PopupMenu extends JPopupMenu oal = null; } - public void pdbFromFile_actionPerformed() throws ExceptionFileFormatOrSyntax, ParserConfigurationException, SAXException, ExceptionPermissionDenied, ExceptionLoadingFailed, InterruptedException, ExceptionUnmatchedClosingParentheses + public void pdbFromFile_actionPerformed() { jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new jalview.io.JalviewFileView()); - chooser.setDialogTitle("Select a PDB file for "+sequence.getDisplayId(false)); - chooser.setToolTipText("Load a PDB file and associate it with sequence '"+sequence.getDisplayId(false)+"'"); + chooser.setDialogTitle("Select a PDB file for " + + sequence.getDisplayId(false)); + chooser.setToolTipText("Load a PDB file and associate it with sequence '" + + sequence.getDisplayId(false) + "'"); int value = chooser.showOpenDialog(null); @@ -1981,11 +2009,23 @@ public class PopupMenu extends JPopupMenu { String choice = chooser.getSelectedFile().getPath(); jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); - new AssociatePdbFileWithSeq().associatePdbWithSeq(choice, jalview.io.AppletFormatAdapter.FILE, sequence, true); + new AssociatePdbFileWithSeq().associatePdbWithSeq(choice, + jalview.io.AppletFormatAdapter.FILE, sequence, true); } } - + // JBNote: commented out - these won't be instantiated here...! +// public void RNAFold_actionPerformed() throws Exception +// { +// Predict2D P2D = new Predict2D(); +// P2D.getStructure2DFromRNAFold("toto"); +// } +// +// public void ContraFold_actionPerformed() throws Exception +// { +// Predict2D P2D = new Predict2D(); +// P2D.getStructure2DFromContraFold("toto"); +// } public void enterPDB_actionPerformed() { String id = JOptionPane.showInternalInputDialog(Desktop.desktop, @@ -2067,8 +2107,8 @@ public class PopupMenu extends JPopupMenu public void colourByStructure(String pdbid) { - Annotation[] anots = ap.av.getStructureSelectionManager().colourSequenceFromStructure( - sequence, pdbid); + Annotation[] anots = ap.av.getStructureSelectionManager() + .colourSequenceFromStructure(sequence, pdbid); AlignmentAnnotation an = new AlignmentAnnotation("Structure", "Coloured by " + pdbid, anots);