X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=1a367c5e58d494e8354f494db9ba1e9ad797ea25;hb=8f2bef6f91e7a6e47e41e78a82f45f7e406ef90a;hp=8197688f7c9dd6ab6f6f19b4f3774c61f321a7cb;hpb=ecb2c593fb296f6908deb65492835fac476b2378;p=jalview.git
diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java
index 8197688..1a367c5 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.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, 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
@@ -24,7 +24,6 @@ import java.awt.event.*;
import javax.swing.*;
-import MCview.*;
import jalview.analysis.*;
import jalview.commands.*;
import jalview.datamodel.*;
@@ -69,10 +68,11 @@ public class PopupMenu extends JPopupMenu
protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
-
+
protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
-
- //protected JRadioButtonMenuItem covariationColour = new JRadioButtonMenuItem();
+
+ // protected JRadioButtonMenuItem covariationColour = new
+ // JRadioButtonMenuItem();
JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();
@@ -84,7 +84,11 @@ public class PopupMenu extends JPopupMenu
JMenuItem sequenceName = new JMenuItem();
- Sequence sequence;
+ JMenuItem sequenceDetails = new JMenuItem();
+
+ JMenuItem sequenceSelDetails = new JMenuItem();
+
+ SequenceI sequence;
JMenuItem unGroupMenuItem = new JMenuItem();
@@ -161,8 +165,8 @@ public class PopupMenu extends JPopupMenu
* @param links
* @param groupLinks
*/
- public PopupMenu(final AlignmentPanel ap, Sequence 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
@@ -188,7 +192,7 @@ public class PopupMenu extends JPopupMenu
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
colours.add(purinePyrimidineColour);
- //colours.add(covariationColour);
+ // colours.add(covariationColour);
for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)
{
@@ -214,11 +218,11 @@ public class PopupMenu extends JPopupMenu
e.printStackTrace();
}
+ JMenuItem menuItem;
if (seq != null)
{
sequenceMenu.setText(sequence.getName());
- JMenuItem menuItem;
if (seq.getDatasetSequence().getPDBId() != null
&& seq.getDatasetSequence().getPDBId().size() > 0)
{
@@ -235,8 +239,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);
}
@@ -253,40 +259,68 @@ public class PopupMenu extends JPopupMenu
}
}
else
- {
- //JAN structureMenu.remove(viewStructureMenu);
+ {
+ if (ap.av.getAlignment().isNucleotide() == false)
+ {
+ structureMenu.remove(viewStructureMenu);
+ }
// structureMenu.remove(colStructureMenu);
}
-
- //if(seq.getAnnotation()[0].annotations[0].secondaryStructure == 'S'){
- //TODO: Something to check if it's an RNA
- //like: if(seq.getAnnotation()[0].annotations[0].secondaryStructure == 'S')
- final SequenceI seqI = seq.getDatasetSequence();
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
-
-
- //for(int i=0; iAnnotation 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("
"); + } + cap.setText("" + contents.toString() + ""); + + Desktop.instance.addInternalFrame(cap, "Sequence Details for " + + (sequences.length == 1 ? sequences[0].getDisplayId(true) + : "Selection"), 500, 400); + + } + protected void showNonconserved_actionPerformed() { getGroup().setShowNonconserved(displayNonconserved.isSelected()); @@ -1246,9 +1359,7 @@ public class PopupMenu extends JPopupMenu protected void clustalColour_actionPerformed() { SequenceGroup sg = getGroup(); - sg.cs = new ClustalxColourScheme( - sg.getSequences(ap.av.hiddenRepSequences), - ap.av.alignment.getWidth()); + sg.cs = new ClustalxColourScheme(sg, ap.av.getHiddenRepSequences()); refresh(); } @@ -1347,19 +1458,17 @@ public class PopupMenu extends JPopupMenu getGroup().cs = new NucleotideColourScheme(); refresh(); } - + protected void purinePyrimidineColour_actionPerformed() { getGroup().cs = new PurinePyrimidineColourScheme(); refresh(); } + /* - protected void covariationColour_actionPerformed() - { - getGroup().cs = new CovariationColourScheme(sequence.getAnnotation()[0]); - refresh(); - } -*/ + * protected void covariationColour_actionPerformed() { getGroup().cs = new + * CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); } + */ /** * DOCUMENT ME! * @@ -1377,8 +1486,8 @@ public class PopupMenu extends JPopupMenu if (abovePIDColour.isSelected()) { sg.cs.setConsensus(AAFrequency.calculate( - sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(), - sg.getEndRes() + 1)); + sg.getSequences(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1)); int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup() .getName()); @@ -1431,8 +1540,8 @@ public class PopupMenu extends JPopupMenu SequenceGroup sg = getGroup(); sg.cs = new PIDColourScheme(); sg.cs.setConsensus(AAFrequency.calculate( - sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(), - sg.getEndRes() + 1)); + sg.getSequences(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1)); refresh(); } @@ -1449,8 +1558,8 @@ public class PopupMenu extends JPopupMenu sg.cs = new Blosum62ColourScheme(); sg.cs.setConsensus(AAFrequency.calculate( - sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(), - sg.getEndRes() + 1)); + sg.getSequences(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1)); refresh(); } @@ -1484,12 +1593,12 @@ public class PopupMenu extends JPopupMenu if (conservationMenuItem.isSelected()) { Conservation c = new Conservation("Group", - ResidueProperties.propHash, 3, - sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(), + ResidueProperties.propHash, 3, sg.getSequences(ap.av + .getHiddenRepSequences()), sg.getStartRes(), sg.getEndRes() + 1); c.calculate(); - c.verdict(false, ap.av.ConsPercGaps); + c.verdict(false, ap.av.getConsPercGaps()); sg.cs.setConservation(c); @@ -1559,7 +1668,7 @@ public class PopupMenu extends JPopupMenu // this method won't add a new group if it already exists if (sg != null) { - ap.av.alignment.addGroup(sg); + ap.av.getAlignment().addGroup(sg); } return sg; @@ -1613,7 +1722,7 @@ public class PopupMenu extends JPopupMenu void unGroupMenuItem_actionPerformed() { SequenceGroup sg = ap.av.getSelectionGroup(); - ap.av.alignment.deleteGroup(sg); + ap.av.getAlignment().deleteGroup(sg); ap.av.setSelectionGroup(null); refresh(); } @@ -1767,8 +1876,8 @@ public class PopupMenu extends JPopupMenu } ChangeCaseCommand caseCommand = new ChangeCaseCommand(description, - sg.getSequencesAsArray(ap.av.hiddenRepSequences), startEnd, - caseChange); + sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), + startEnd, caseChange); ap.alignFrame.addHistoryItem(caseCommand); @@ -1794,7 +1903,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.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] nala = ap.av.getAlignment() + .getAlignmentAnnotation(); if (nala != null) { for (int i = 0; i < nala.length; i++) @@ -1813,8 +1923,10 @@ public class PopupMenu extends JPopupMenu 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); @@ -1822,7 +1934,8 @@ 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); } } @@ -1843,9 +1956,9 @@ public class PopupMenu extends JPopupMenu public void discoverPDB_actionPerformed() { - final SequenceI[] sequences = ((ap.av.selectionGroup == null) ? new Sequence[] + final SequenceI[] sequences = ((ap.av.getSelectionGroup() == null) ? new SequenceI[] { sequence } - : ap.av.selectionGroup.getSequencesInOrder(ap.av.alignment)); + : ap.av.getSequenceSelection()); Thread discpdb = new Thread(new Runnable() { public void run() @@ -1908,16 +2021,16 @@ 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); - ap.av.alignment.addAnnotation(an); + ap.av.getAlignment().addAnnotation(an); an.createSequenceMapping(sequence, 0, true); // an.adjustForAlignment(); - ap.av.alignment.setAnnotationIndex(an, 0); + ap.av.getAlignment().setAnnotationIndex(an, 0); ap.adjustAnnotationHeight(); @@ -1944,8 +2057,8 @@ public class PopupMenu extends JPopupMenu EditCommand editCommand = new EditCommand("Edit Sequences", EditCommand.REPLACE, dialog.getName().replace(' ', ap.av.getGapCharacter()), - sg.getSequencesAsArray(ap.av.hiddenRepSequences), - sg.getStartRes(), sg.getEndRes() + 1, ap.av.alignment); + sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment()); ap.alignFrame.addHistoryItem(editCommand);