X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=8cb12d1be365795241d1fd1b761bcdbfb477d92e;hb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;hp=1f04fa3b25bd352e6f3fd9e5a70cdbfc3d4bec55;hpb=7d0ee5869e28d0cdde911336e9bbe290b143f0bc;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 1f04fa3..8cb12d1 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1,13 +1,21 @@ -/******************** - * 2004 Jalview Reengineered - * Barton Group - * Dundee University - * - * AM Waterhouse - *******************/ - - - +/* +* Jalview - A Sequence Alignment Editor and Viewer +* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle +* +* This program 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 2 +* of the License, or (at your option) any later version. +* +* This program 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 PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +*/ package jalview.gui; @@ -82,8 +90,11 @@ public class AlignFrame extends GAlignFrame if (currentFileFormat.equals("Jalview")) { - String shortName = title.replace('/', '_'); - title = title.replace('\\', '_'); + String shortName = title; + if(shortName.indexOf(java.io.File.separatorChar)>-1) + shortName = shortName.substring( + shortName.lastIndexOf(java.io.File.separatorChar)+1); + String choice = chooser.getSelectedFile().getPath(); Jalview2XML.SaveState(this, choice, shortName); // USE Jalview2XML to save this file @@ -106,9 +117,7 @@ public class AlignFrame extends GAlignFrame protected void outputText_actionPerformed(ActionEvent e) { CutAndPasteTransfer cap = new CutAndPasteTransfer(); - JInternalFrame frame = new JInternalFrame(); - frame.setContentPane(cap); - Desktop.addInternalFrame(frame, "Alignment output - "+e.getActionCommand(), 600, 500); + Desktop.addInternalFrame(cap, "Alignment output - "+e.getActionCommand(), 600, 500); cap.setText( FormatAdapter.formatSequences(e.getActionCommand(), viewport.getAlignment().getSequences())); } @@ -252,12 +261,12 @@ public class AlignFrame extends GAlignFrame viewport.alignment.deleteSequence(i); } } - viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); updateEditMenuBar(); viewport.updateConsensus(); viewport.updateConservation(); alignPanel.repaint(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences()); } public void moveSelectedSequences(boolean up) @@ -419,11 +428,12 @@ public class AlignFrame extends GAlignFrame protected void delete_actionPerformed(ActionEvent e) { boolean seqsdeleted=false; - addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment, HistoryItem.HIDE)); if (viewport.getSelectionGroup() == null) return; + addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment, HistoryItem.HIDE)); + SequenceGroup sg = viewport.getSelectionGroup(); for (int i=0;i < sg.sequences.size(); i++) { @@ -989,14 +999,14 @@ public class AlignFrame extends GAlignFrame public void sortGroupMenuItem_actionPerformed(ActionEvent e) { addHistoryItem(new HistoryItem("Group Sort", viewport.alignment, HistoryItem.SORT)); - AlignmentSorter.sortByGroup(viewport.getAlignment()); + // AlignmentSorter.sortByGroup(viewport.getAlignment()); AlignmentSorter.sortGroups(viewport.getAlignment()); alignPanel.repaint(); } public void removeRedundancyMenuItem_actionPerformed(ActionEvent e) { - RedundancyPanel sp = new RedundancyPanel(alignPanel); + RedundancyPanel sp = new RedundancyPanel(alignPanel,this); JInternalFrame frame = new JInternalFrame(); frame.setContentPane(sp); Desktop.addInternalFrame(frame, "Redundancy threshold selection", 400, 100, false); @@ -1005,7 +1015,8 @@ public class AlignFrame extends GAlignFrame public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e) { - if(viewport.getSelectionGroup().getSize()<2) + if((viewport.getSelectionGroup()==null) || + viewport.getSelectionGroup().getSize()<2) JOptionPane.showInternalMessageDialog(this, "You must select at least 2 sequences.", "Invalid Selection", JOptionPane.WARNING_MESSAGE); else { @@ -1065,32 +1076,51 @@ public class AlignFrame extends GAlignFrame void NewTreePanel(String type, String pwType, String title) { - //are the sequences aligned? - if(!viewport.alignment.isAligned()) - { - JOptionPane.showMessageDialog(Desktop.desktop, "The sequences must be aligned before creating a tree.\n" - +"Try using the Pad function in the edit menu.", - "Sequences not aligned", JOptionPane.WARNING_MESSAGE); - return; - } - + String ltitle; final TreePanel tp; if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize() > 3) { + int s=0; + SequenceGroup sg = viewport.getSelectionGroup(); + + /* Decide if the selection is a column region */ + while (s1) + { + // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface! + SequenceGroup seqs = viewport.getSelectionGroup(); + int sz; + msa = new SequenceI[sz=seqs.getSize()]; + for (int i = 0; i < sz; i++) + { + msa[i] = (SequenceI) seqs.getSequenceAt(i); + } + + } + else + { + Vector seqs = viewport.getAlignment().getSequences(); + + if (seqs.size() > 1) { + msa = new SequenceI[seqs.size()]; + for (int i = 0; i < seqs.size(); i++) + { + msa[i] = (SequenceI) seqs.elementAt(i); + } + + } + + } + if (msa!=null) { jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS", title, msa, true, true); } } + protected void jpred_actionPerformed(ActionEvent e) { SequenceI seq=null; @@ -1272,7 +1338,7 @@ public class AlignFrame extends GAlignFrame } if (msa!=null) { - MsaWSClient ct = new jalview.ws.MsaWSClient("MuscleWS",title, msa, true, true); + MsaWSClient ct = new jalview.ws.MsaWSClient("MuscleWS",title, msa, false, true); } } protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {