and additional leaves from sequences not present in the associated
alignment.
</p>
-<p>The view menu contains options controlling the way a tree is
-rendered and labelled:
+<p>The view menu mostly contains options controlling the way a tree is
+rendered and labeled:
<ul>
<li><strong>Fit to Window</strong><p>
The tree layout will be scaled to fit in the display
indicate that there is no sequence corresponding to that leaf in the
associated alignment.
</p></li>
-<li><strong>Associate Leaves with ...</strong><p>
-Only visible when there are <a href="../features/multipleviews.html">multiple views</a> of the same
-alignment to show and edit which alignment views are associated with
-the leaves of the displayed tree.
-</p>
-</ul>
+ <li><strong>Sort Alignment By Tree</strong>
+ <p>
+ Sorts any associated alignment views using the current tree. (<em>Only
+ available in the Jalview Desktop</em>)
+ </p>
+ </li>
+ <li><strong>Associate Leaves with ...</strong>
+ <p>
+ Only visible when there are <a href="../features/multipleviews.html">multiple
+ views</a> of the same alignment to show and edit which alignment views
+ are associated with the leaves of the displayed tree.
+ </p>
+ </ul>
</p>
</body>
</html>
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
-<head><title>Alignment Window Menus</title></head>
+<head>
+<title>Alignment Window Menus</title>
+</head>
<body>
-<p><strong>Alignment Window Calculate Menu</strong></p>
-<ul>
- <li><strong>Sort </strong>
- <ul>
- <li><strong>by ID</strong><em><br>
- This will sort the sequences according to sequence name. If the sort is
- repeated, the order of the sorted sequences will be inverted. </em></li>
- <li><strong>by Length</strong><em><br>
- This will sort the sequences according to their length (excluding gap characters). If the sort is
- repeated, the order of the sorted sequences will be inverted. </em></li>
- <li><strong>by Group</strong><strong><br>
- </strong><em>This will sort the sequences according to sequence name.
- If the sort is repeated, the order of the sorted sequences will be inverted.
- </em><strong></strong></li>
- <li><strong>by Pairwise Identity<br>
- </strong><em>This will sort the selected sequences by their percentage
- identity to the consensus sequence. The most similar sequence is put at
- the top. </em></li>
- <li><em>The <a href="../calculations/sorting.html">Sort menu</a> will have
- some additional options if the alignment has any associated
- score annotation, or you have just done a multiple alignment calculation
- or opened a tree viewer window.</em><br>
- </li>
- </ul>
- </li>
- <li><strong>Calculate Tree </strong> <br>
- <em>Functions for calculating trees on the alignment or the currently selected
- region. See <a
- href="../calculations/tree.html">calculating trees</a>.</em>
- <ul>
- <li><strong>Average Distance Using % Identity</strong></li>
- <li><strong>Neighbour Joining Using % Identity</strong></li>
- <li><strong>Average Distance Using Blosum62</strong></li>
- <li><strong>Neighbour Joining Using Blosum62<br>
- </strong></li>
- </ul>
- </li>
- <li><strong>Pairwise Alignments</strong><br>
- <em>Applies Smith and Waterman algorithm to selected sequences. See <a href="../calculations/pairwise.html">pairwise
- alignments</a>.</em><br>
- </li>
- <li><strong>Principal Component Analysis</strong><br>
- <em>Shows a spatial clustering of the sequences based on the BLOSUM62 scores
- in the alignment. See <a href="../calculations/pca.html">Principal Component
- Analysis</a>.</em> <br>
- </li>
- <li><strong>Extract Scores ... (optional)</strong><br>
- <em>This option is only visible if Jalview detects one or more white-space separated values in the description line of the alignment sequences.<br>
- When selected, these numbers are parsed into sequence associated annotation which can
- then be used to sort the alignment via the Sort by→Score menu.</em> <br>
- </li>
-
- <li><strong>Autocalculate Consensus</strong><br>
- <em>For large alignments it can be useful to deselect "Autocalculate
- Consensus" when editing. This prevents the sometimes lengthy calculations
- performed after each sequence edit.</em> <br>
- </li>
-</ul>
- </body>
+ <p>
+ <strong>Alignment Window Calculate Menu</strong>
+ </p>
+ <ul>
+ <li><strong>Sort </strong>
+ <ul>
+ <li><strong>by ID</strong><em><br> This will sort the
+ sequences according to sequence name. If the sort is repeated, the
+ order of the sorted sequences will be inverted. </em>
+ </li>
+ <li><strong>by Length</strong><em><br> This will sort
+ the sequences according to their length (excluding gap
+ characters). If the sort is repeated, the order of the sorted
+ sequences will be inverted. </em>
+ </li>
+ <li><strong>by Group</strong><strong><br> </strong><em>This
+ will sort the sequences according to sequence name. If the sort is
+ repeated, the order of the sorted sequences will be inverted. </em><strong></strong>
+ </li>
+ <li><strong>by Pairwise Identity<br> </strong><em>This
+ will sort the selected sequences by their percentage identity to
+ the consensus sequence. The most similar sequence is put at the
+ top. </em>
+ </li>
+ <li><em>The <a href="../calculations/sorting.html">Sort
+ menu</a> will have some additional options if the alignment has any
+ associated score annotation, or you have just done a multiple
+ alignment calculation or opened a tree viewer window.</em><br></li>
+ </ul></li>
+ <li><strong>Calculate Tree </strong> <br> <em>Functions
+ for calculating trees on the alignment or the currently selected
+ region. See <a href="../calculations/tree.html">calculating
+ trees</a>.</em>
+ <ul>
+ <li><strong>Average Distance Using % Identity</strong>
+ </li>
+ <li><strong>Neighbour Joining Using % Identity</strong>
+ </li>
+ <li><strong>Average Distance Using Blosum62</strong>
+ </li>
+ <li><strong>Neighbour Joining Using Blosum62<br>
+ </strong>
+ </li>
+ </ul></li>
+ <li><strong>Pairwise Alignments</strong><br> <em>Applies
+ Smith and Waterman algorithm to selected sequences. See <a
+ href="../calculations/pairwise.html">pairwise alignments</a>.</em><br>
+ </li>
+ <li><strong>Principal Component Analysis</strong><br> <em>Shows
+ a spatial clustering of the sequences based on the BLOSUM62 scores
+ in the alignment. See <a href="../calculations/pca.html">Principal
+ Component Analysis</a>.</em> <br></li>
+ <li><strong>Extract Scores ... (optional)</strong><br> <em>This
+ option is only visible if Jalview detects one or more white-space
+ separated values in the description line of the alignment sequences.<br>
+ When selected, these numbers are parsed into sequence associated
+ annotation which can then be used to sort the alignment via the Sort
+ by→Score menu.</em> <br></li>
+
+ <li><strong>Autocalculate Consensus</strong><br> <em>For
+ large alignments it can be useful to deselect "Autocalculate
+ Consensus" when editing. This prevents the sometimes lengthy
+ calculations performed after each sequence edit.</em> <br></li>
+ <li><strong>Sort Alignment With New Tree</strong><br> <em>If
+ this option is selected, the alignment will be automatically sorted
+ whenever a new tree is calculated or loaded.</em> <br>
+ </li>
+ </ul>
+</body>
</html>
{\r
viewport.autocalculateConsensus = autoCalculate.getState();\r
}\r
+ else if (evt.getSource() == sortByTree)\r
+ {\r
+ viewport.sortByTree = sortByTree.getState();\r
+ }\r
else if (evt.getSource() == this.centreColumnLabelFlag)\r
{\r
centreColumnLabelFlag_stateChanged();\r
sortByTree(treePanel, title); // treePanel.getTitle());\r
}\r
});\r
-\r
+ \r
treePanel.addWindowListener(new WindowAdapter()\r
{\r
public void windowOpened(WindowEvent e)\r
alignPanel.paintAlignment(true);\r
return true;\r
}\r
+\r
protected void documentation_actionPerformed()\r
{\r
alignPanel.av.applet.openJalviewHelpUrl();\r
CheckboxMenuItem autoCalculate = new CheckboxMenuItem(\r
"Autocalculate Consensus", true);\r
\r
+ CheckboxMenuItem sortByTree = new CheckboxMenuItem(\r
+ "Sort Alignment With New Tree", true);\r
+\r
Menu sortByTreeMenu = new Menu();\r
\r
Menu sort = new Menu();\r
sort.setLabel("Sort");\r
calculate.setLabel("Calculate Tree");\r
autoCalculate.addItemListener(this);\r
+ sortByTree.addItemListener(this);\r
inputText.setLabel("Input from textbox");\r
inputText.addActionListener(this);\r
centreColumnLabelFlag.setLabel("Centre column labels");\r
calculateMenu.add(pairwiseAlignmentMenuItem);\r
calculateMenu.add(PCAMenuItem);\r
calculateMenu.add(autoCalculate);\r
+ calculateMenu.add(sortByTree);\r
this.add(statusBar, BorderLayout.SOUTH);\r
pasteMenu.add(pasteNew);\r
pasteMenu.add(pasteThis);\r
applyToAllGroups.setState(av.colourAppliesToAllGroups);
showNpFeatsMenuitem.setSelected(av.isShowNpFeats());
showDbRefsMenuitem.setSelected(av.isShowDbRefs());
+ autoCalculate.setSelected(av.autoCalculateConsensus);
+ sortByTree.setSelected(av.sortByTree);
setShowProductsEnabled();
.getAlignment().getSequences());
}
}
+ public void sortByTreeOption_actionPerformed(ActionEvent e)
+ {
+ viewport.sortByTree = sortByTree.isSelected();
+ }
/**
* DOCUMENT ME!
for (i = 0; i < treePanels.size(); i++)
{
- TreePanel tp = (TreePanel) treePanels.elementAt(i);
+ final TreePanel tp = (TreePanel) treePanels.elementAt(i);
final JMenuItem item = new JMenuItem(tp.getTitle());
final NJTree tree = ((TreePanel) treePanels.elementAt(i)).getTree();
item.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
- SequenceI[] oldOrder = viewport.getAlignment()
- .getSequencesArray();
- AlignmentSorter.sortByTree(viewport.getAlignment(), tree);
-
- addHistoryItem(new OrderCommand("Tree Sort", oldOrder,
- viewport.alignment));
-
- alignPanel.paintAlignment(true);
+ tp.sortByTree_actionPerformed(null);
+ addHistoryItem(tp.sortAlignmentIn(alignPanel));
+
}
});
.getDefault("SHOW_NPFEATS_TOOLTIP", true));
showDbRefTooltip.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP",
true));
-
+ sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++)
{
colour.addItem(ColourSchemeProperty.getColourName(i));
Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS",
Boolean.toString(autoCalculateConsCheck.isSelected()));
+ Cache.applicationProperties.setProperty("SORT_BY_TREE",
+ Boolean.toString(sortByTree.isSelected()));
Cache.applicationProperties.setProperty("PAD_GAPS",
Boolean.toString(padGaps.isSelected()));
import org.jibble.epsgraphics.*;
import jalview.analysis.*;
+import jalview.commands.CommandI;
import jalview.commands.OrderCommand;
import jalview.datamodel.*;
import jalview.io.*;
*/
public void sortByTree_actionPerformed(ActionEvent e)
{
- AlignmentPanel ap = av.getAlignPanel();
- SequenceI[] oldOrder = av.getAlignment().getSequencesArray();
- AlignmentSorter.sortByTree(av.getAlignment(), tree);
-
- ap.alignFrame.addHistoryItem(new OrderCommand("Tree Sort", oldOrder,
- av.alignment));
+
+ if (treeCanvas.applyToAllViews)
+ {
+ final ArrayList<CommandI> commands = new ArrayList<CommandI>();
+ for (AlignmentPanel ap: PaintRefresher.getAssociatedPanels(av
+ .getSequenceSetId()))
+ {
+ commands.add(sortAlignmentIn(ap.av.getAlignPanel()));
+ }
+ av.getAlignPanel().alignFrame.addHistoryItem(new CommandI()
+ {
+
+ @Override
+ public void undoCommand(AlignmentI[] views)
+ {
+ for (CommandI tsort:commands)
+ {
+ tsort.undoCommand(views);
+ }
+ }
+
+ @Override
+ public int getSize()
+ {
+ return commands.size();
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return "Tree Sort (many views)";
+ }
+
+ @Override
+ public void doCommand(AlignmentI[] views)
+ {
- ap.paintAlignment(true);
+ for (CommandI tsort:commands)
+ {
+ tsort.doCommand(views);
+ }
+ }
+ });
+ for (AlignmentPanel ap: PaintRefresher.getAssociatedPanels(av
+ .getSequenceSetId()))
+ {
+ // ensure all the alignFrames refresh their GI after adding an undo item
+ ap.alignFrame.updateEditMenuBar();
+ }
+ } else {
+ treeCanvas.ap.alignFrame.addHistoryItem(sortAlignmentIn(treeCanvas.ap));
+ }
}
+ public CommandI sortAlignmentIn(AlignmentPanel ap)
+ {
+ AlignViewport av = ap.av;
+ SequenceI[] oldOrder = av.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByTree(av.getAlignment(), tree);
+ CommandI undo;
+ undo=new OrderCommand("Tree Sort", oldOrder,
+ av.alignment);
+ ap.paintAlignment(true);
+ return undo;
+ }
/**
* DOCUMENT ME!
*
protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
+
JMenu addSequenceMenu = new JMenu();
JMenuItem addFromFile = new JMenuItem();
autoCalculate_actionPerformed(e);
}
});
+ sortByTree.setText("Sort Alignment With New Tree");
+ sortByTree.setToolTipText("<html>Enable this to automatically sort<br>the alignment when you open<br> a new tree.");
+ sortByTree.setState(jalview.bin.Cache.getDefault(
+ "SORT_BY_TREE", false));
+ sortByTree.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ sortByTreeOption_actionPerformed(e);
+ }
+ });
+
addSequenceMenu.setText("Add Sequences");
addFromFile.setText("From File");
addFromFile.addActionListener(new ActionListener()
calculateMenu.add(showTranslation);
calculateMenu.add(showProducts);
calculateMenu.add(autoCalculate);
+ calculateMenu.add(sortByTree);
calculateMenu.addSeparator();
calculateMenu.add(extractScores);
webServiceNoServices = new JMenuItem("<No Services>");
}
+ public void sortByTreeOption_actionPerformed(ActionEvent e)
+ {
+
+ }
+
public void showAllSeqs_actionPerformed(ActionEvent e)
{
protected JCheckBox followHighlight = new JCheckBox();
+ protected JCheckBox sortByTree= new JCheckBox();
+
/**
* Creates a new GPreferences object.
*/
maxColour_actionPerformed();
}
});
+
startupCheckbox.setText("Open file");
startupCheckbox.setFont(verdana11);
startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
autoCalculateConsCheck.setText("AutoCalculate Consensus");
autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
padGaps.setFont(JvSwingUtils.getLabelFont());
- padGaps.setText("Pad gaps when editing");
+ padGaps.setText("Pad Gaps When Editing");
padGaps.setBounds(new Rectangle(22, 94, 168, 23));
+ sortByTree.setFont(JvSwingUtils.getLabelFont());
+ sortByTree.setText("Sort Alignment With New Tree");
+ sortByTree.setToolTipText("When selected, any trees calculated or laoded onto the alignment will automatically sort the alignment.");
+ sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
modellerOutput.setFont(JvSwingUtils.getLabelFont());
modellerOutput.setText("Use Modeller Output");
modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
tabbedPane.add(calcTab, "Editing");
calcTab.add(autoCalculateConsCheck);
calcTab.add(padGaps);
+ calcTab.add(sortByTree);
+
tabbedPane.add(dasPanel, "DAS Settings");
tabbedPane.add(wsPanel, "Web Services");
public JMenuItem font = new JMenuItem();
+ public JMenuItem sortAssocViews = new JMenuItem();
+
public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();
public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();
{
}
});
+ sortAssocViews.setText("Sort Alignment By Tree");
+ sortAssocViews.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ sortByTree_actionPerformed(e);
+ }
+ });
font.setText("Font...");
font.addActionListener(new java.awt.event.ActionListener()
{
viewMenu.add(distanceMenu);
viewMenu.add(bootstrapMenu);
viewMenu.add(placeholdersMenu);
+ viewMenu.add(sortAssocViews);
viewMenu.add(associateLeavesMenu);
saveAsMenu.add(saveAsNewick);
saveAsMenu.add(epsTree);
public void viewMenu_menuSelected()
{
}
+ public void sortByTree_actionPerformed(ActionEvent e)
+ {
+
+ }
+
}