X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=ca9903c49c0fbfe2945dbcf2827ffc4e50c2b0c0;hb=2b9c6a8948800edf58dd055631920654729fd675;hp=67995b23cae707bb68f5a360f2ddeba6d41f8ad4;hpb=1fdab090d852d60dfa5e859a1335579d43b5c7f4;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 67995b2..ca9903c 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -16,12 +16,15 @@ import jalview.schemes.*; import jalview.datamodel.*; import jalview.analysis.*; import jalview.io.*; -import MCview.*; +import jalview.ws.*; import java.awt.*; import java.awt.event.*; import java.awt.print.*; import javax.swing.*; +import javax.swing.event.*; import java.util.*; +import java.awt.datatransfer.*; + public class AlignFrame extends GAlignFrame { @@ -30,23 +33,60 @@ public class AlignFrame extends GAlignFrame public AlignFrame(AlignmentI al) { super(); - viewport = new AlignViewport(al,true,true,true,false); + viewport = new AlignViewport(al,true,true,false); + + String fontName = jalview.bin.Cache.getProperty("FONT_NAME"); + String fontStyle= jalview.bin.Cache.getProperty("FONT_STYLE"); + String fontSize = jalview.bin.Cache.getProperty("FONT_SIZE"); + if(fontName!=null && fontStyle!=null && fontSize!=null) + viewport.setFont( new Font(fontName,Integer.parseInt(fontStyle),Integer.parseInt(fontSize)) ); + + + alignPanel = new AlignmentPanel(this, viewport); getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER); - fontNameMenuItem.setText(viewport.getFont().getName()); - fontSizeMenuItem.setText(viewport.getFont().getSize()+""); + + addInternalFrameListener(new InternalFrameAdapter() + { + public void internalFrameActivated(InternalFrameEvent evt) + { + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + public void run() + { alignPanel.requestFocus(); } + }); + + } + }); + } protected void saveAs_actionPerformed(ActionEvent e) { - JFileChooser chooser = new JFileChooser(jalview.bin.Cache.LAST_DIRECTORY); + String suffix = ""; + if(e.getActionCommand().equals("FASTA")) + suffix = "fa"; + else if(e.getActionCommand().equals("MSF")) + suffix = "msf"; + else if(e.getActionCommand().equals("CLUSTAL")) + suffix = "aln"; + else if(e.getActionCommand().equals("BLC")) + suffix = "blc"; + else if(e.getActionCommand().equals("PIR")) + suffix = "pir"; + else if(e.getActionCommand().equals("PFAM")) + suffix = "pfam"; + + JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY") + , new String[]{suffix}, e.getActionCommand()+" file"); + chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Save Alignment to file - "+e.getActionCommand() +" format."); chooser.setToolTipText("Save"); int value = chooser.showSaveDialog(this); - if(value == JFileChooser.APPROVE_OPTION) + if(value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.LAST_DIRECTORY = choice; + jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); String output = FormatAdapter.get(e.getActionCommand(), viewport.getAlignment().getSequences()); try{ java.io.PrintWriter out = new java.io.PrintWriter( new java.io.FileWriter( choice ) ); @@ -70,10 +110,21 @@ public class AlignFrame extends GAlignFrame protected void htmlMenuItem_actionPerformed(ActionEvent e) { - HTMLOutput htmlOutput = new HTMLOutput(viewport.getAlignment(), alignPanel.seqPanel.getColourScheme()); + HTMLOutput htmlOutput = new HTMLOutput(viewport); htmlOutput = null; } + protected void createPNG_actionPerformed(ActionEvent e) + { + alignPanel.makePNG(); + } + + protected void epsFile_actionPerformed(ActionEvent e) + { + alignPanel.makeEPS(); + } + + public void printMenuItem_actionPerformed(ActionEvent e) { //Putting in a thread avoids Swing painting problems @@ -113,8 +164,9 @@ public class AlignFrame extends GAlignFrame }catch(Exception ex){} } - ArrayList historyList = new ArrayList(); - ArrayList redoList = new ArrayList(); + Stack historyList = new Stack(); + Stack redoList = new Stack(); + JMenuBar jMenuBar1 = new JMenuBar(); void updateEditMenuBar() { @@ -179,6 +231,167 @@ public class AlignFrame extends GAlignFrame alignPanel.RefreshPanels(); } + public void moveSelectedSequences(boolean up) + { + SequenceGroup sg = viewport.getSelectionGroup(); + if (sg == null) + return; + + if (up) + { + for (int i = 1; i < viewport.alignment.getHeight(); i++) + { + SequenceI seq = viewport.alignment.getSequenceAt(i); + if (!sg.sequences.contains(seq)) + continue; + + SequenceI temp = viewport.alignment.getSequenceAt(i - 1); + if (sg.sequences.contains(temp)) + continue; + + viewport.alignment.getSequences().setElementAt(temp, i); + viewport.alignment.getSequences().setElementAt(seq, i - 1); + } + } + else + { + for (int i = viewport.alignment.getHeight() - 2; i > -1; i--) + { + SequenceI seq = viewport.alignment.getSequenceAt(i); + if (!sg.sequences.contains(seq)) + continue; + + SequenceI temp = viewport.alignment.getSequenceAt(i + 1); + if (sg.sequences.contains(temp)) + continue; + + viewport.alignment.getSequences().setElementAt(temp, i); + viewport.alignment.getSequences().setElementAt(seq, i + 1); + } + } + + alignPanel.RefreshPanels(); + } + + + + protected void copy_actionPerformed(ActionEvent e) + { + if(viewport.getSelectionGroup()==null) + return; + + SequenceGroup sg = viewport.getSelectionGroup(); + + Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); + StringBuffer buffer= new StringBuffer(); + + for(int i=0; i 500) + newHeight = 500; + Desktop.addInternalFrame(af, "Copied sequences", 700, newHeight); + } + else + { + viewport.setEndSeq(viewport.alignment.getHeight()); + viewport.alignment.getWidth(); + alignPanel.RefreshPanels(); + } + + }catch(Exception ex){}// could be anything being pasted in here + + } + + + protected void cut_actionPerformed(ActionEvent e) + { + copy_actionPerformed(null); + delete_actionPerformed(null); + } + + protected void delete_actionPerformed(ActionEvent e) + { + addHistoryItem("Delete"); + if (viewport.getSelectionGroup() == null) + return; + + SequenceGroup sg = viewport.getSelectionGroup(); + for (int i=0;i < sg.sequences.size(); i++) + { + SequenceI seq = sg.getSequenceAt(i); + int index = viewport.getAlignment().findIndex(seq); + seq.deleteChars(sg.getStartRes(), sg.getEndRes()+1); + + if(seq.getSequence().length()<1) + viewport.getAlignment().deleteSequence(seq); + else + viewport.getAlignment().getSequences().setElementAt(seq, index); + } + + viewport.setSelectionGroup(null); + viewport.alignment.deleteGroup(sg); + viewport.resetSeqLimits( alignPanel.seqPanel.seqCanvas.getHeight()); + if(viewport.getAlignment().getHeight()<1) + try + { + this.setClosed(true); + }catch(Exception ex){} + alignPanel.RefreshPanels(); + + } + + protected void redoMenuItem_actionPerformed(ActionEvent e) { @@ -190,7 +403,6 @@ public class AlignFrame extends GAlignFrame } - public void groupsMenuItem_actionPerformed(ActionEvent e) { GroupEditor geditor = new GroupEditor(viewport, alignPanel); @@ -200,72 +412,41 @@ public class AlignFrame extends GAlignFrame frame.setResizable(false); } - public void groupEditingMenuItem_actionPerformed(ActionEvent e) + protected void deleteGroups_actionPerformed(ActionEvent e) { - viewport.setGroupEdit( groupEditingMenuItem.isSelected() ); + viewport.alignment.deleteAllGroups(); + viewport.setSelectionGroup(null); + + alignPanel.RefreshPanels(); } + + public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) { - Selection sel = viewport.getSelection(); + SequenceGroup sg = new SequenceGroup(); for (int i=0; i500) - newHeight=500; - Desktop.addInternalFrame(af, "Copied sequences", 700,newHeight); - } public void deselectAllColumnsMenuItem_actionPerformed(ActionEvent e) { @@ -318,7 +499,7 @@ public class AlignFrame extends GAlignFrame current = viewport.getAlignment().getSequenceAt(i); jSize = current.getLength(); for (int j=0; j < jSize; j++) - if (current.getCharAt(j)=='-' || current.getCharAt(j)=='.' || current.getCharAt(j)==' ') + if(jalview.util.Comparison.isGap(current.getCharAt(j))) { current.deleteCharAt(j); j--; @@ -345,64 +526,29 @@ public class AlignFrame extends GAlignFrame public void findMenuItem_actionPerformed(ActionEvent e) { - JOptionPane op = new JOptionPane(); - JInternalFrame frame = op.createInternalFrame(this, "Find"); - Finder finder = new Finder(viewport, alignPanel, frame); - frame.setContentPane(finder); - frame.setSize(300,110); - frame.setVisible(true); - } - - - - public void fontNameMenuItem_actionPerformed(ActionEvent e) - { - String fonts[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); - - - String selection = JOptionPane.showInternalInputDialog(this, - "Select font", - "Font selection", - JOptionPane.QUESTION_MESSAGE, - null,fonts - ,fontNameMenuItem.getText()).toString(); - if(selection!=null) - { - fontNameMenuItem.setText(selection); - SetFont(); - } + JInternalFrame frame = new JInternalFrame(); + Finder finder = new Finder(viewport, alignPanel, frame); + frame.setContentPane(finder); + Desktop.addInternalFrame(frame, "Find", 340,110); } - public void fontSizeMenuItem_actionPerformed(ActionEvent e) + + public void font_actionPerformed(ActionEvent e) { - String selection = JOptionPane.showInternalInputDialog(this, - "Select font size", - "Font size", - JOptionPane.QUESTION_MESSAGE, - null, new String[]{"1","2","4","6","8","10","12","14","16","18","20"} - ,fontSizeMenuItem.getText()).toString(); - if(selection!=null) - { - fontSizeMenuItem.setText(selection); - SetFont(); - } + // JOptionPane op = new JOptionPane(); + JInternalFrame frame = new JInternalFrame(); + FontChooser fc = new FontChooser( alignPanel, frame ); + frame.setContentPane(fc); + Desktop.addInternalFrame(frame, "Change Font", 480,100); } - public void fontStyleMenuItem_actionPerformed(ActionEvent e) + protected void fullSeqId_actionPerformed(ActionEvent e) { - String selection = JOptionPane.showInternalInputDialog(this, - "Select font style", - "Font style", - JOptionPane.QUESTION_MESSAGE, - null, new String[]{"plain", "bold", "italic"} - ,fontStyleMenuItem.getText()).toString(); - if(selection!=null) - { - fontStyleMenuItem.setText(selection); - SetFont(); - } + viewport.setShowFullId( fullSeqId.isSelected() ); + alignPanel.idPanel.idCanvas.setPreferredSize( alignPanel.calculateIdWidth() ); + alignPanel.RefreshPanels(); } protected void colourTextMenuItem_actionPerformed(ActionEvent e) @@ -411,25 +557,10 @@ public class AlignFrame extends GAlignFrame alignPanel.RefreshPanels(); } - void SetFont() - { - int style = java.awt.Font.PLAIN; - if(fontStyleMenuItem.getText().equals("bold")) - style = java.awt.Font.BOLD; - else if(fontStyleMenuItem.getText().equals("italic")) - style = java.awt.Font.ITALIC; - - viewport.setFont(new java.awt.Font(fontNameMenuItem.getText(), - style, - Integer.parseInt(fontSizeMenuItem.getText()))); - alignPanel.RefreshPanels(); - - } - protected void wrapMenuItem_actionPerformed(ActionEvent e) { viewport.setWrapAlignment( wrapMenuItem.isSelected() ); - alignPanel.RefreshPanels(); + alignPanel.setWrapAlignment( wrapMenuItem.isSelected() ); } @@ -452,43 +583,16 @@ public class AlignFrame extends GAlignFrame alignPanel.RefreshPanels(); } - - /* void updateResidueView() + public void sequenceFeatures_actionPerformed(ActionEvent evt) { - if (viewport.getSelection().size() == 0) - { - for (int i = 0; i < viewport.alignment.getGroups().size(); i++) - { - SequenceGroup sg = (SequenceGroup) viewport.alignment.getGroups().elementAt(i); - sg.setDisplayBoxes( viewBoxesMenuItem.isSelected() ); - sg.setDisplayText( viewTextMenuItem.isSelected() ); - sg.setColourText( colourTextMenuItem.isSelected() ); - } - } - else - { - SequenceGroup sg = viewport.alignment.findGroup( (Sequence) viewport.sel.sequenceAt(0)); - if (alignPanel.seqPanel.isNewSelection(sg)) - { - sg = viewport.getAlignment().addGroup(); - for (int i = 0; i < viewport.getSelection().size(); i++) - { - viewport.alignment.removeFromGroup(viewport.alignment.findGroup( ( - Sequence) viewport.sel.sequenceAt(i)), - (Sequence) viewport.sel.sequenceAt( - i)); - viewport.alignment.addToGroup(sg, - (Sequence) viewport.sel.sequenceAt(i)); - } - } - - sg.setDisplayBoxes(viewBoxesMenuItem.isSelected()); - sg.setDisplayText(viewTextMenuItem.isSelected()); - sg.setColourText(colourTextMenuItem.isSelected()); - } + viewport.showSequenceFeatures(sequenceFeatures.isSelected()); + if(viewport.showSequenceFeatures && !((Alignment)viewport.alignment).featuresAdded) + { + AlignmentUtil.fetchSequenceFeatures( viewport.alignment , alignPanel); + ((Alignment)viewport.alignment).featuresAdded = true; + } alignPanel.RefreshPanels(); - }*/ - + } public void consensusGraphMenuItem_actionPerformed(ActionEvent e) { @@ -497,6 +601,8 @@ public class AlignFrame extends GAlignFrame public void overviewMenuItem_actionPerformed(ActionEvent e) { + if (alignPanel.overviewPanel != null) + return; JInternalFrame frame = new JInternalFrame(); OverviewPanel overview = alignPanel.getOverviewPanel(); @@ -526,83 +632,195 @@ public class AlignFrame extends GAlignFrame protected void noColourmenuItem_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme(null, false); + changeColour( null ); } public void clustalColour_actionPerformed(ActionEvent e) { - // alignPanel.setColourScheme( new ClustalxColourScheme() ); + abovePIDThreshold.setSelected(false); + changeColour(new ClustalxColourScheme(viewport.alignment.getSequences(), viewport.alignment.getWidth())); } public void zappoColour_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme( new ZappoColourScheme(), conservationMenuItem.isSelected() ); + changeColour(new ZappoColourScheme()); } public void taylorColour_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme( new TaylorColourScheme(),conservationMenuItem.isSelected() ); + changeColour(new TaylorColourScheme()); } public void hydrophobicityColour_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme( new HydrophobicColourScheme(),conservationMenuItem.isSelected() ); + changeColour( new HydrophobicColourScheme() ); } public void helixColour_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme( new HelixColourScheme(),conservationMenuItem.isSelected() ); + changeColour(new HelixColourScheme() ); } public void strandColour_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme( new StrandColourScheme() ,conservationMenuItem.isSelected() ); + changeColour(new StrandColourScheme()); } public void turnColour_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme( new TurnColourScheme() ,conservationMenuItem.isSelected() ); + changeColour(new TurnColourScheme()); } public void buriedColour_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme( new BuriedColourScheme() ,conservationMenuItem.isSelected() ); + changeColour(new BuriedColourScheme() ); } + public void nucleotideColour_actionPerformed(ActionEvent e) + { + changeColour(new NucleotideColourScheme()); + } - protected void conservationMenuItem_actionPerformed(ActionEvent e) + + protected void applyToAllGroups_actionPerformed(ActionEvent e) { - alignPanel.setColourScheme ( alignPanel.seqPanel.getColourScheme(),conservationMenuItem.isSelected() ); - conservationColourIncMenuItem.setEnabled( conservationMenuItem.isSelected() ); + viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected()); } - public void conservationColourIncMenuItem_actionPerformed(ActionEvent e) + void changeColour(ColourSchemeI cs) + { + + if(viewport.getColourAppliesToAllGroups()) + { + Vector groups = viewport.alignment.getGroups(); + for(int i=0; i0) + + if( (viewport.getSelectionGroup()!=null && viewport.getSelectionGroup().getSize()<4 && viewport.getSelectionGroup().getSize()>0) || viewport.getAlignment().getHeight()<4) { JOptionPane.showInternalMessageDialog(this, "Principal component analysis must take\n" @@ -728,73 +946,179 @@ public class AlignFrame extends GAlignFrame void NewTreePanel(String type, String pwType, String title) { - JInternalFrame frame = new javax.swing.JInternalFrame(); + //are the sequences aligned? + if(!viewport.alignment.isAligned()) + { + JOptionPane.showMessageDialog(Desktop.desktop, "The sequences must be aligned before creating a tree.", + "Sequences not aligned", JOptionPane.WARNING_MESSAGE); + return; + } + TreePanel tp=null; - if (viewport.getSelection() != null && viewport.getSelection().size() > 3) + if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize() > 3) { - tp = new TreePanel(viewport, viewport.getSelection().asVector(),type, pwType, - viewport.getStartRes(), viewport.getEndRes()); + tp = new TreePanel(viewport, viewport.getSelectionGroup().sequences,type, pwType, + 0, viewport.alignment.getWidth()); } else { tp = new TreePanel(viewport, viewport.getAlignment().getSequences(), - type, pwType, viewport.getStartRes(), - viewport.getEndRes()); + type, pwType, 0, viewport.alignment.getWidth()); } - frame.setContentPane(tp); - Desktop.addInternalFrame(frame, title, 600, 500); + Desktop.addInternalFrame(tp, title, 600, 500); } + public void clustalAlignMenuItem_actionPerformed(ActionEvent e) { - JOptionPane.showInternalMessageDialog(this, "Jalview is currently being reengineered" - +"\nwithin the Barton Group, Dundee University." - +"\nThis will be available as a web service 2005", - "Web service", JOptionPane.INFORMATION_MESSAGE); + JInternalFrame frame = new JInternalFrame(); + ClustalThread ct = new ClustalThread(frame); + Thread t = new Thread(ct); + t.start(); + frame.setContentPane(ct); + Desktop.addInternalFrame(frame, title, 300, 80); + } - public void pdbTest_actionPerformed(ActionEvent e) + class ClustalThread extends JPanel implements Runnable { - String reply = JOptionPane.showInternalInputDialog(this, "Enter pdb code", "PDB test viewer", JOptionPane.QUESTION_MESSAGE); - - String url = "http://www.ebi.ac.uk/cgi-bin/pdbfetch?id=1a4u"; - if (reply.length()>1) - url = "http://www.ebi.ac.uk/cgi-bin/pdbfetch?id="+reply; + Image [] image; + int imageIndex = 0; + boolean webServiceRunning = false; + JInternalFrame frame; + public ClustalThread(JInternalFrame frame) + { + this.frame = frame; + image = new Image[9]; + for(int i=0; i<9; i++) + { + java.net.URL url = getClass().getResource("/images/dna" + (i+1) + ".gif"); + if (url != null) + { + image[i] = java.awt.Toolkit.getDefaultToolkit().createImage(url); + MediaTracker mt = new MediaTracker(this); + mt.addImage(image[i], i); + try{mt.waitForID(i);} + catch(Exception ex){} + } + } + DNATwirler twirler = new DNATwirler(); + twirler.start(); + webServiceRunning = true; + } - try - { - PDBfile pdb = new PDBfile(url, - "URL"); - Sequence seq = (Sequence)viewport.getAlignment().getSequenceAt(0); - seq.setPDBfile(pdb); - ( (PDBChain) pdb.chains.elementAt(seq.maxchain)).isVisible = true; - ( (PDBChain) pdb.chains.elementAt(seq.maxchain)).sequence = seq; - // ( (PDBChain) pdb.chains.elementAt(seq.maxchain)).colourBySequence(); - - rotCanvas rc = new rotCanvas(pdb); - JInternalFrame frame = new JInternalFrame(); - frame.setContentPane(rc); - Desktop.addInternalFrame(frame, url, 400,400); - } - catch (Exception ex) - { - ex.printStackTrace(); - } + class DNATwirler extends Thread + { + public void run() + { + while(webServiceRunning) + { + try{ + Thread.sleep(100); + imageIndex++; + imageIndex %=9; + repaint(); + } + catch(Exception ex){} + } + } + } - } + // JBPNote + // Should check to see if the server settings are valid + // Need visual-delay indication here. + public void run() + { + /* jalview.ws.Jemboss jemboss = new jalview.ws.Jemboss(); + Vector sv = viewport.getAlignment().getSequences(); + SequenceI[] seqs = new SequenceI[sv.size()]; + int i = 0; + do + { + seqs[i] = (SequenceI) sv.elementAt(i); + } + while (++i < sv.size()); - public void doKeyPressed(KeyEvent evt) - { + SequenceI[] alignment = jemboss.clustalW(seqs); // gaps removed within method - System.out.println(evt.getKeyChar()); - if(evt.isControlDown() && evt.getKeyChar()=='f') - findMenuItem_actionPerformed(null); + if (alignment != null) + { + AlignFrame af = new AlignFrame(new Alignment(alignment)); + af.clustalColour.setSelected(true); + af.clustalColour_actionPerformed(null); + Desktop.addInternalFrame(af, getTitle().concat(" - ClustalW Alignment"), + 700, 500); // JBPNote - is there a new window geom. property ? + } + else + JOptionPane.showMessageDialog(Desktop.desktop, "Problem obtaining clustal alignment", "Web service error", + JOptionPane.WARNING_MESSAGE); + + webServiceRunning = false; + try{ + frame.setClosed(true); + }catch(Exception ex){} + } + public void paintComponent(Graphics g) + { + g.setColor(Color.white); + g.fillRect(0,0,getWidth(), getHeight()); + if(image!=null) + { + g.drawImage(image[imageIndex],10,10,this); + } + g.setFont(new Font("Arial", Font.BOLD, 12)); + g.setColor(Color.black); + g.drawString("Clustal Alignment Web Service running", 30,30); + } } + public void jpredMenuItem_actionPerformed(ActionEvent e) + { + // JInternalFrame frame = new JInternalFrame(); +// JPredClient ct = new JPredClient((SequenceI) + /// viewport.getAlignment().getSequences().elementAt(0)); + } + +*/}} + protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) { + // Pick the tree file + JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. + getProperty("LAST_DIRECTORY")); + chooser.setFileView(new JalviewFileView()); + chooser.setDialogTitle("Select a newick-like tree file"); + chooser.setToolTipText("Load a tree file"); + int value = chooser.showOpenDialog(null); + if (value == JalviewFileChooser.APPROVE_OPTION) + { + String choice = chooser.getSelectedFile().getPath(); + jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); + TreePanel treepanel = null; + try + { + jalview.io.NewickFile fin = new jalview.io.NewickFile(choice, "File"); + fin.parse(); + if (fin.getTree() != null) + { + TreePanel tp = null; + tp = new TreePanel(viewport, viewport.getAlignment().getSequences(), + fin, "FromFile", choice); + Desktop.addInternalFrame(tp, title, 600, 500); + } + } + catch (Exception ex) + { + JOptionPane.showMessageDialog(Desktop.desktop, + "Problem reading tree file", + ex.getMessage(), + JOptionPane.WARNING_MESSAGE); + ex.printStackTrace(); + } + } + } }