src/org/gel/mauve/gui/AlignFrame.java

Go to the documentation of this file.
00001 
00009 package org.gel.mauve.gui;
00010 
00011 import java.awt.Component;
00012 import java.awt.Dimension;
00013 import java.awt.Insets;
00014 import java.awt.Point;
00015 import java.io.File;
00016 import java.io.IOException;
00017 import java.io.PrintStream;
00018 
00019 import javax.swing.DefaultListModel;
00020 import javax.swing.JButton;
00021 import javax.swing.JCheckBox;
00022 import javax.swing.JFileChooser;
00023 import javax.swing.JLabel;
00024 import javax.swing.JOptionPane;
00025 import javax.swing.JPanel;
00026 import javax.swing.JScrollPane;
00027 import javax.swing.JSlider;
00028 import javax.swing.JTabbedPane;
00029 import javax.swing.JTextField;
00030 import javax.swing.JList;
00031 
00032 import org.gel.mauve.MyConsole;
00033 import org.gel.mauve.contigs.ContigOrderer;
00034 import org.gel.mauve.gui.dnd.DnDList;
00035 
00041 public class AlignFrame extends java.awt.Panel implements AlignmentProcessListener
00042 {
00043     // Use for post-alignment file loading
00044     protected String read_filename;
00045     
00046     // used when in GUI mode
00047     protected java.awt.Frame frame;
00048 
00049     // member declarations
00050     JPanel parameterPanel = new JPanel();
00051     JCheckBox defaultSeedCheckBox = new JCheckBox();
00052     JCheckBox determineLCBsCheckBox = new JCheckBox();
00053     protected JSlider seedLengthSlider = new JSlider();
00054     JLabel seedLengthLabel = new JLabel();
00055     JCheckBox recursiveCheckBox = new JCheckBox();
00056     JLabel minLcbWeightLabel = new JLabel();
00057     protected JTextField minLcbWeightText = new JTextField();
00058     JCheckBox collinearCheckBox = new JCheckBox();
00059 
00060     public JButton alignButton = new JButton();
00061     public JButton cancelButton = new JButton();
00062 
00063     protected JPanel sequencesPanel = new JPanel();
00064     protected JButton addButton = new JButton();
00065     protected JButton removeButton = new JButton();
00066     protected JTextField outputFileText = new JTextField();
00067     protected JButton outputButton = new JButton();
00068     protected JList sequenceList = null;
00069     protected JLabel outputLabel = new JLabel();
00070     JLabel sequencesLabel = new JLabel();
00071 
00072     JPanel parentPanel = new JPanel();
00073     JTabbedPane alignmentOptionPane = new JTabbedPane();
00076     protected JFileChooser fc;
00077     protected JScrollPane listScrollPane = new JScrollPane();
00078     protected DefaultListModel sequenceListModel = new DefaultListModel();
00079     Dimension d;
00080 
00081     protected Mauve mauve;
00082     protected AlignWorker worker;
00083     
00084     public AlignFrame(Mauve mauve)
00085     {
00086         this(mauve, true);
00087     }
00088     public AlignFrame(Mauve mauve, boolean gui)
00089     {
00090         if(gui){
00091                 frame  = new java.awt.Frame ();
00092                 frame.setResizable(false);
00093         }
00094          fc = new JFileChooser() {
00095                 public void updateUI () {
00096                         if (frame != null)
00097                                 super.updateUI();
00098                 }
00099             };
00100         this.mauve = mauve;
00101     }
00102     public void initComponents()
00103     {
00104 
00105         // the following code sets the frame's initial state
00106         parameterPanel.setSize(new java.awt.Dimension(350, 150));
00107         parameterPanel.setLocation(new java.awt.Point(0, 210));
00108         parameterPanel.setVisible(true);
00109         parameterPanel.setLayout(null);
00110         defaultSeedCheckBox.setVisible(true);
00111         defaultSeedCheckBox.setSize(new java.awt.Dimension(160, 20));
00112         defaultSeedCheckBox.setText("Default seed weight");
00113         defaultSeedCheckBox.setSelected(true);
00114         defaultSeedCheckBox.setLocation(new java.awt.Point(10, 10));
00115         defaultSeedCheckBox.setToolTipText("Selecting this will cause Mauve to choose the minimum seed size automatically.");
00116         determineLCBsCheckBox.setVisible(true);
00117         determineLCBsCheckBox.setSize(new java.awt.Dimension(140, 20));
00118         determineLCBsCheckBox.setText("Determine LCBs");
00119         determineLCBsCheckBox.setSelected(true);
00120         determineLCBsCheckBox.setLocation(new java.awt.Point(10, 90));
00121         determineLCBsCheckBox.setToolTipText("Selecting this will cause Mauve to determine Locally Collinear Blocks.  Without this option, all multi-MUMs will be displayed.");
00122         seedLengthSlider.setSize(new java.awt.Dimension(130, 50));
00123         seedLengthSlider.setLocation(new java.awt.Point(200, 30));
00124         seedLengthSlider.setVisible(true);
00125         seedLengthSlider.setMajorTickSpacing(4);
00126         seedLengthSlider.setMinorTickSpacing(2);
00127         seedLengthSlider.setMinimum(3);
00128         seedLengthSlider.setMaximum(21);
00129         seedLengthSlider.setPaintLabels(true);
00130         seedLengthSlider.setPaintTicks(true);
00131         seedLengthSlider.setSnapToTicks(true);
00132         seedLengthSlider.setValue(15);
00133         seedLengthSlider.setEnabled(false);
00134         seedLengthSlider.setToolTipText("This sets the minimum size of multi-MUMs found during the first pass of match detection");
00135         seedLengthLabel.setSize(new java.awt.Dimension(120, 20));
00136         seedLengthLabel.setLocation(new java.awt.Point(210, 10));
00137         seedLengthLabel.setVisible(true);
00138         seedLengthLabel.setText("Match Seed Weight:");
00139         seedLengthLabel.setEnabled(false);
00140         recursiveCheckBox.setVisible(true);
00141         recursiveCheckBox.setSize(new java.awt.Dimension(120, 20));
00142         recursiveCheckBox.setText("Full Alignment");
00143         recursiveCheckBox.setSelected(true);
00144         recursiveCheckBox.setLocation(new java.awt.Point(10, 145));
00145         recursiveCheckBox.setToolTipText("This enables recursive anchor search and gapped alignment using MUSCLE");
00146         collinearCheckBox.setVisible(true);
00147         collinearCheckBox.setSize(new java.awt.Dimension(195, 20));
00148         collinearCheckBox.setText("Assume collinear genomes");
00149         collinearCheckBox.setSelected(false);
00150         collinearCheckBox.setLocation(new java.awt.Point(10, 110));
00151         collinearCheckBox.setToolTipText("Set this when the input sequences do not have rearrangements");
00152         minLcbWeightLabel.setText("Min LCB weight:");
00153         minLcbWeightLabel.setHorizontalAlignment(JLabel.RIGHT);
00154         d = minLcbWeightLabel.getPreferredSize();
00155         minLcbWeightLabel.setSize(new Dimension( d.width, 20 ));
00156         minLcbWeightLabel.setLocation(new java.awt.Point(265 - d.width, 90));
00157         minLcbWeightLabel.setVisible(true);
00158         minLcbWeightText.setVisible(true);
00159         minLcbWeightText.setSize(new java.awt.Dimension(60, 20));
00160         minLcbWeightText.setLocation(new java.awt.Point(270, 90));
00161         minLcbWeightText.setText("default");
00162         minLcbWeightText.setToolTipText("LCBs below this weight will be removed from the alignment");
00163         alignButton.setVisible(true);
00164         alignButton.setSize(new java.awt.Dimension(80, 30));
00165         alignButton.setText("Align...");
00166         alignButton.setLocation(new java.awt.Point(250, 320));
00167         cancelButton.setVisible(true);
00168         cancelButton.setEnabled(false);
00169         cancelButton.setSize(new java.awt.Dimension(145, 30));
00170         cancelButton.setText("Cancel alignment");
00171         cancelButton.setLocation(new java.awt.Point(100, 320));
00172         sequencesPanel.setSize(new java.awt.Dimension(350, 210));
00173         sequencesPanel.setLocation(new java.awt.Point(0, 0));
00174         sequencesPanel.setVisible(true);
00175         sequencesPanel.setLayout(null);
00176         addButton.setVisible(true);
00177         addButton.setSize(new java.awt.Dimension(145, 20));
00178         addButton.setText("Add Sequence...");
00179         addButton.setLocation(new java.awt.Point(30, 150));
00180         removeButton.setVisible(true);
00181         removeButton.setSize(new java.awt.Dimension(145, 20));
00182         removeButton.setText("Remove Sequence");
00183         removeButton.setLocation(new java.awt.Point(185, 150));
00184         outputFileText.setVisible(true);
00185         outputFileText.setSize(new java.awt.Dimension(220, 20));
00186         outputFileText.setLocation(new java.awt.Point(85, 180));
00187         outputFileText.setToolTipText("The path and base file name for output files");
00188         outputButton.setVisible(true);
00189         outputButton.setSize(new java.awt.Dimension(20, 20));
00190         outputButton.setText("...");
00191         outputButton.setLocation(new java.awt.Point(310, 180));
00192         outputButton.setToolTipText("Set the output file location");
00193         if(frame!=null){
00194                 sequenceList = new DnDList();
00195         }else{
00196                 sequenceList = new JList();
00197         }
00198         sequenceList.setModel(sequenceListModel);
00199         sequenceList.setVisible(true);
00200         sequenceList.setSize(new java.awt.Dimension(320, 110));
00201         //              sequenceList.setLocation(new java.awt.Point(10, 30));
00202         listScrollPane.getViewport().setView(sequenceList);
00203         listScrollPane.setSize(new java.awt.Dimension(320, 110));
00204         listScrollPane.setLocation(new java.awt.Point(10, 30));
00205         outputLabel.setSize(new java.awt.Dimension(75, 20));
00206         outputLabel.setLocation(new java.awt.Point(10, 180));
00207         outputLabel.setVisible(true);
00208         outputLabel.setText("Output File:");
00209         sequencesLabel.setSize(new java.awt.Dimension(130, 20));
00210         sequencesLabel.setLocation(new java.awt.Point(10, 10));
00211         sequencesLabel.setVisible(true);
00212         sequencesLabel.setText("Sequences to align:");
00213         setLocation(new java.awt.Point(0, 0));
00214         setLayout(null);
00215         
00216         // if we're not on Mac or Windows then use the current dir as default
00217         String osname = System.getProperty("os.name");
00218         if(osname.indexOf("indow")==-1&&osname.indexOf("Mac")==-1)
00219                 fc.setCurrentDirectory(new File(System.getProperty("user.dir")));
00220         
00221         parameterPanel.add(defaultSeedCheckBox);
00222         parameterPanel.add(determineLCBsCheckBox);
00223         parameterPanel.add(collinearCheckBox);
00224         parameterPanel.add(seedLengthSlider);
00225         parameterPanel.add(seedLengthLabel);
00226         parameterPanel.add(recursiveCheckBox);
00227         parameterPanel.add(minLcbWeightLabel);
00228         parameterPanel.add(minLcbWeightText);
00229         sequencesPanel.add(addButton);
00230         sequencesPanel.add(removeButton);
00231         sequencesPanel.add(outputFileText);
00232         sequencesPanel.add(outputButton);
00233         sequencesPanel.add(listScrollPane);
00234         sequencesPanel.add(outputLabel);
00235         sequencesPanel.add(sequencesLabel);
00236         //              add(parameterPanel);
00237         //              add(sequencesPanel);
00238 
00239         parentPanel.setSize(new java.awt.Dimension(350, 360));
00240         parentPanel.setLocation(new java.awt.Point(0, 0));
00241         parentPanel.setVisible(true);
00242         parentPanel.setLayout(null);
00243 
00244         alignmentOptionPane.addTab("Files", sequencesPanel);
00245         alignmentOptionPane.addTab("Parameters", parameterPanel);
00246         //              alignmentOptionPane.setSelectedIndex( 0 );
00247         alignmentOptionPane.setSize(new java.awt.Dimension(350, 310));
00248         alignmentOptionPane.setLocation(new java.awt.Point(0, 0));
00249         alignmentOptionPane.setVisible(true);
00250 
00251         parentPanel.add(alignmentOptionPane);
00252         parentPanel.add(alignButton);
00253         parentPanel.add(cancelButton);
00254 
00255         add(parentPanel);
00256 
00257         setSize(new java.awt.Dimension(343, 383));
00258 
00259         if(frame != null){
00260                         frame.setIconImage(MauveFrame.mauve_icon.getImage());
00261                         frame.setTitle("Align sequences...");
00262                         frame.setLocation(new java.awt.Point(0, 0));
00263                         frame.setLayout(null);
00264                         frame.add(this);
00265                         frame.setSize(new java.awt.Dimension(400, 383));
00266         }
00267         // event handling
00268 
00269         defaultSeedCheckBox.addActionListener(new java.awt.event.ActionListener()
00270         {
00271             public void actionPerformed(java.awt.event.ActionEvent e)
00272             {
00273                 defaultSeedCheckBoxActionPerformed(e);
00274             }
00275         });
00276 
00277         determineLCBsCheckBox.addActionListener(new java.awt.event.ActionListener()
00278         {
00279             public void actionPerformed(java.awt.event.ActionEvent e)
00280             {
00281                 determineLCBsCheckBoxActionPerformed(e);
00282             }
00283         });
00284 
00285         collinearCheckBox.addActionListener(new java.awt.event.ActionListener()
00286                 {
00287                     public void actionPerformed(java.awt.event.ActionEvent e)
00288                     {
00289                         collinearCheckBoxActionPerformed(e);
00290                     }
00291                 });
00292 
00293         addButton.addActionListener(new java.awt.event.ActionListener()
00294         {
00295             public void actionPerformed(java.awt.event.ActionEvent e)
00296             {
00297                 addButtonActionPerformed(e);
00298             }
00299         });
00300 
00301         removeButton.addActionListener(new java.awt.event.ActionListener()
00302         {
00303             public void actionPerformed(java.awt.event.ActionEvent e)
00304             {
00305                 removeButtonActionPerformed(e);
00306             }
00307         });
00308 
00309         outputButton.addActionListener(new java.awt.event.ActionListener()
00310         {
00311             public void actionPerformed(java.awt.event.ActionEvent e)
00312             {
00313                 outputButtonActionPerformed(e);
00314             }
00315         });
00316 
00317         if (frame != null) {
00318                 frame.addWindowListener(new java.awt.event.WindowAdapter()
00319                 {
00320                     public void windowClosing(java.awt.event.WindowEvent e)
00321                     {
00322                         thisWindowClosing(e);
00323                     }
00324                     public void windowClosed(java.awt.event.WindowEvent e)
00325                     {
00326                         thisWindowClosed(e);
00327                     }
00328                 });
00329         }
00330 
00331         // delete the file in case the user chooses a different file name
00332         alignButton.addActionListener(new java.awt.event.ActionListener()
00333         {
00334             public void actionPerformed(java.awt.event.ActionEvent e)
00335             {
00336                 alignButtonActionPerformed(e);
00337             }
00338         });
00339         cancelButton.addActionListener(new java.awt.event.ActionListener()
00340                 {
00341                     public void actionPerformed(java.awt.event.ActionEvent e)
00342                     {
00343                         cancelButtonActionPerformed(e);
00344                     }
00345                 });
00346     }
00347     
00348     File getDefaultFile() throws IOException
00349     {
00350         return File.createTempFile("mauve", ".mln");
00351     }
00352 
00353     /*
00354      * Build a platform-dependent path to the aligner binary
00355      * @param name      The name of the aligner binary
00356      */
00357     public static String getBinaryPath(String name)
00358     {
00359         String os_type = System.getProperty("os.name");
00360         String os_arch = System.getProperty("os.arch");
00361 
00362         //MyConsole.out().println("OS name is: " + os_type + " arch: " + os_arch);
00363         if (os_type.startsWith("Windows"))
00364         {
00365                 if(os_arch.indexOf("64") >= 0)
00366                         return "win64\\" + name;
00367                 else
00368                 {
00369                         // check for a win32 folder to support running in the dev environment
00370                         File f = new File("win32\\" + name);
00371                         if(f.exists())
00372                                 return "win32\\" + name;
00373                         return name;
00374                 }
00375         }
00376         else if (os_type.startsWith("Mac"))
00377         {
00378             String mauve_path = System.getProperty("user.dir");
00379             mauve_path += "/Mauve.app/Contents/MacOS/" + name;
00380                 File f = new File(mauve_path);
00381                 if( f.exists()){
00382                         return mauve_path;
00383                 } else {
00384                         mauve_path = System.getProperty("user.dir") + "/osx/" + name;
00385                         f = new File(mauve_path);
00386                         if (f.exists())
00387                                 return mauve_path;
00388                 }
00389                 return name;
00390         }
00391         else
00392         {
00393                 String mauvedir = System.getProperty("mauveDir");
00394                 if(mauvedir == null)    mauvedir = "./";
00395                 String pname = mauvedir + name;
00396                 System.out.println("trying path " + pname);
00397                 if(os_arch.indexOf("64") >= 0)
00398                         pname = mauvedir + "linux-x64/" + name;
00399                 File f = new File(pname);
00400                 if( f.exists())
00401                         return pname;
00402                 else
00403                         return name;
00404         }
00405     }
00406     
00413         public static void printCommand(String[] cmd, PrintStream out){
00414                 StringBuilder sb = new StringBuilder();
00415                 sb.append("  "+cmd[0]+"\n");
00416                 for (int i = 1; i < cmd.length; i++){
00417                         sb.append("    "+cmd[i]+"\n");
00418                 }
00419                 out.print(sb.toString());
00420         }
00421 
00428     public void alignButtonActionPerformed(java.awt.event.ActionEvent evt)
00429     {
00430         File outfile = new File(this.getOutput());
00431         // if outfile not selected, query until selected.
00432         while(this.getOutput().length()==0 || outfile.isDirectory())
00433         {
00434                 fc.setDialogTitle("Save alignment file");
00435                 fc.setSelectedFile(new File( "" ));
00436             int returnVal = fc.showSaveDialog(this);
00437 
00438             if (returnVal == JFileChooser.APPROVE_OPTION)
00439             {
00440                 outfile = fc.getSelectedFile();
00441                 outputFileText.setText(outfile.getPath());
00442             }else
00443                 return;
00444         }
00445         
00446         alignButton.setEnabled(false);
00447         
00448         String[] mauve_cmd = makeAlignerCommand();
00449 
00450         // No command means there was an error.
00451         if (mauve_cmd == null)
00452         {
00453             alignButton.setEnabled(true);
00454             return;
00455         }
00456         MyConsole.showConsole();
00457       //  printCommand(mauve_cmd);
00458         worker = new AlignWorker(this, mauve_cmd, true);
00459         System.out.println("Running alignment.\nExecuting ");
00460         AlignFrame.printCommand(worker.mauve_cmd, System.out);
00461         worker.start();
00462         cancelButton.setEnabled(true);
00463     }
00464     
00465     public void completeAlignment(int retcode)
00466     {
00467         alignButton.setEnabled(true);
00468         cancelButton.setEnabled(false);
00469         
00470         if (retcode == 0)
00471         {
00472             File readFile = new File(read_filename);
00473             if(!readFile.exists() || readFile.length() == 0)
00474             {
00475                 if(frame!=null){
00476                         JOptionPane.showMessageDialog(null, "The aligner failed to produce an alignment.  The sequences may not contain any homologous regions.", "An error occurred", JOptionPane.ERROR_MESSAGE);
00477                 }else{
00478                         System.err.println("The aligner failed to produce an alignment.  The sequences may not contain any homologous regions.");
00479                 }
00480             }
00481             System.out.println("Alignment complete!");
00482             mauve.loadFile(new File(read_filename));
00483             setVisible(false);
00484         }
00485         else if(!worker.getKilled())
00486         {
00487             JOptionPane.showMessageDialog(null, "mauveAligner exited with an error code.  Check the log window for details", "An error occurred", JOptionPane.ERROR_MESSAGE);
00488         }
00489         worker = null;
00490     }
00491     public void cancelButtonActionPerformed(java.awt.event.ActionEvent evt)
00492     {
00493         worker.interrupt();
00494         alignButton.setEnabled(true);
00495         cancelButton.setEnabled(false);
00496     }
00497     
00498     protected String[] makeAlignerCommand()
00499     {
00500         return new String[0];
00501     }
00502     
00503     protected void printCommand(String[] mauve_cmd)
00504     {
00505         // Make a readable version of command.
00506   /*      String mauve_str = new String();
00507         for (int cmdI = 0; cmdI < mauve_cmd.length; cmdI++)
00508         {
00509             mauve_str += mauve_cmd[cmdI] + " ";
00510         } */
00511         MyConsole.out().println("Executing: ");
00512 //        MyConsole.out().println(mauve_str);
00513         AlignFrame.printCommand(mauve_cmd, MyConsole.out());
00514     }
00515     
00516     private boolean mShown = false;
00517 
00518     public void addNotify()
00519     {
00520         super.addNotify();
00521 
00522         if (mShown)
00523             return;
00524 
00525         // move components to account for insets
00526         Insets insets = getInsets();
00527         Component[] components = getComponents();
00528         for (int i = 0; i < components.length; i++)
00529         {
00530             Point location = components[i].getLocation();
00531             location.move(location.x, location.y + insets.top);
00532             components[i].setLocation(location);
00533         }
00534 
00535         mShown = true;
00536     }
00537 
00538     // Close the window when the close box is clicked
00539     void thisWindowClosing(java.awt.event.WindowEvent e)
00540     {
00541         if(cancelButton.isEnabled())
00542         {
00543                 // ask the user whether they would like to cancel the alignment
00544             int choice = JOptionPane.showConfirmDialog(null, "An alignment is in progress.  Closing this window will terminate the alignment.  Would you like to proceed?\n", "Alignment in progress", JOptionPane.YES_NO_OPTION);
00545                 if(choice == JOptionPane.NO_OPTION)
00546                         return;
00547         }
00548         frame.setVisible(false);
00549         frame.dispose();
00550     }
00551     void thisWindowClosed(java.awt.event.WindowEvent e)
00552     {
00553         if(cancelButton.isEnabled())
00554                 worker.interrupt();
00555     }
00556 
00557     public void defaultSeedCheckBoxActionPerformed(java.awt.event.ActionEvent e)
00558     {
00559         if (defaultSeedCheckBox.isSelected())
00560         {
00561             seedLengthSlider.setEnabled(false);
00562             seedLengthLabel.setEnabled(false);
00563         }
00564         else
00565         {
00566             seedLengthSlider.setEnabled(true);
00567             seedLengthLabel.setEnabled(true);
00568         }
00569     }
00570 
00571     public void determineLCBsCheckBoxActionPerformed(java.awt.event.ActionEvent e)
00572     {
00573         if (determineLCBsCheckBox.isSelected())
00574         {
00575             recursiveCheckBox.setEnabled(true);
00576             if (!collinearCheckBox.isSelected())
00577             {
00578                     minLcbWeightLabel.setEnabled(true);
00579                     minLcbWeightText.setEnabled(true);
00580             }
00581             collinearCheckBox.setEnabled(true);
00582         }
00583         else
00584         {
00585             recursiveCheckBox.setEnabled(false);
00586             minLcbWeightLabel.setEnabled(false);
00587             minLcbWeightText.setEnabled(false);
00588             collinearCheckBox.setEnabled(false);
00589         }
00590     }
00591 
00592     public void collinearCheckBoxActionPerformed(java.awt.event.ActionEvent e)
00593     {
00594         if (collinearCheckBox.isSelected())
00595         {
00596             minLcbWeightLabel.setEnabled(false);
00597             minLcbWeightText.setEnabled(false);
00598         }
00599         else
00600         {
00601                 if( determineLCBsCheckBox.isSelected() ){
00602                     minLcbWeightLabel.setEnabled(true);
00603                     minLcbWeightText.setEnabled(true);
00604                 }
00605         }
00606     }
00607 
00608     public void addButtonActionPerformed(java.awt.event.ActionEvent e)
00609     {
00610         fc.setDialogTitle("Select a genome sequence");
00611         fc.setMultiSelectionEnabled(true);
00612         int returnVal = fc.showOpenDialog(this);
00613 
00614         if (returnVal == JFileChooser.APPROVE_OPTION)
00615         {
00616                 File[] sfs = fc.getSelectedFiles();
00617                 for(File seq_file : sfs){
00618                     int sel_index = sequenceList.getSelectedIndex();
00619                     if (sel_index >= 0)
00620                         sequenceListModel.add(sel_index, seq_file.getPath());
00621                     else
00622                         sequenceListModel.addElement(seq_file.getPath());
00623                 }
00624         }
00625     }
00626 
00627     public void removeButtonActionPerformed(java.awt.event.ActionEvent e)
00628     {
00629         int[] selection = sequenceList.getSelectedIndices();
00630         for (int selI = selection.length; selI > 0; selI--)
00631         {
00632             sequenceListModel.removeElementAt(selection[selI - 1]);
00633         }
00634     }
00635 
00636     public void outputButtonActionPerformed(java.awt.event.ActionEvent e)
00637     {
00638         fc.setDialogTitle("Save alignment file");
00639         fc.setName("");
00640         fc.setSelectedFile(new File( outputFileText.getText() ));
00641         int returnVal = fc.showSaveDialog(this);
00642 
00643         if (returnVal == JFileChooser.APPROVE_OPTION)
00644         {
00645             File seq_file = fc.getSelectedFile();
00646             outputFileText.setText(seq_file.getPath());
00647         }
00648     }
00649 
00650     public boolean getRecursive()
00651     {
00652         return recursiveCheckBox.isSelected();
00653     }
00654 
00655     public boolean getCollinear()
00656     {
00657         return collinearCheckBox.isSelected();
00658     }
00659 
00660     public int getSeedWeight()
00661     {
00662         if (!defaultSeedCheckBox.isSelected())
00663             return seedLengthSlider.getValue();
00664         else
00665             return -1;
00666     }
00667 
00668     public boolean isLCBSearchEnabled()
00669     {
00670         return determineLCBsCheckBox.isSelected();
00671     }
00672 
00673     public int getMinLcbWeight()
00674     {
00675         try
00676         {
00677             return Integer.parseInt(minLcbWeightText.getText());
00678         }
00679         catch (NumberFormatException nfe)
00680         {
00681             return -1;
00682         }
00683     }
00684 
00685     public String getOutput()
00686     {
00687         return outputFileText.getText();
00688     }
00689 
00690     public void setOutput(String filename)
00691     {
00692         outputFileText.setText(filename);
00693         outputFileText.setCaretPosition (filename.length ());
00694     }
00695 
00696     public String[] getSequences()
00697     {
00698         String[] seqs = new String[sequenceListModel.getSize()];
00699         for (int seqI = 0; seqI < seqs.length; seqI++)
00700             seqs[seqI] = (String) (sequenceListModel.get(seqI));
00701         return seqs;
00702     }
00703         public void setVisible (boolean show) {
00704                 super.setVisible (show);
00705                 if (show && frame != null)
00706                         frame.setVisible(true);
00707         }
00708 }

Generated on Mon Aug 19 06:03:41 2013 for Mauve by doxygen 1.3.6