From bd5b9f08122cb0854741f9d526daabe800f3ad5c Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 30 Apr 2010 11:52:23 +0000 Subject: [PATCH] sort by length --- src/jalview/appletgui/AlignFrame.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 954648e..56948e3 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -85,6 +85,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { sortPairwiseMenuItem_actionPerformed(); } + else if (param.equalsIgnoreCase("Length")) + { + sortLengthMenuItem_actionPerformed(); + } } param = applet.getParameter("wrap"); @@ -905,6 +909,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { sortIDMenuItem_actionPerformed(); } + else if (source == sortLengthMenuItem) + { + sortLengthMenuItem_actionPerformed(); + } else if (source == sortGroupMenuItem) { sortGroupMenuItem_actionPerformed(); @@ -2268,6 +2276,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, alignPanel.paintAlignment(true); } + public void sortLengthMenuItem_actionPerformed() + { + SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + AlignmentSorter.sortByLength(viewport.getAlignment()); + addHistoryItem(new OrderCommand("Length Sort", oldOrder, viewport.alignment)); + alignPanel.paintAlignment(true); + } + public void sortGroupMenuItem_actionPerformed() { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); @@ -2620,6 +2636,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, MenuItem sortIDMenuItem = new MenuItem(); + MenuItem sortLengthMenuItem = new MenuItem(); + MenuItem sortGroupMenuItem = new MenuItem(); MenuItem removeRedundancyMenuItem = new MenuItem(); @@ -2797,6 +2815,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, sortPairwiseMenuItem.addActionListener(this); sortIDMenuItem.setLabel("by ID"); sortIDMenuItem.addActionListener(this); + sortLengthMenuItem.setLabel("by Length"); + sortLengthMenuItem.addActionListener(this); sortGroupMenuItem.setLabel("by Group"); sortGroupMenuItem.addActionListener(this); removeRedundancyMenuItem.setLabel("Remove Redundancy..."); @@ -3040,6 +3060,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, pasteMenu.add(pasteNew); pasteMenu.add(pasteThis); sort.add(sortIDMenuItem); + sort.add(sortLengthMenuItem); sort.add(sortByTreeMenu); sort.add(sortGroupMenuItem); sort.add(sortPairwiseMenuItem); -- 1.7.10.2