in progress
authorcmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sun, 20 May 2012 06:26:16 +0000 (06:26 +0000)
committercmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sun, 20 May 2012 06:26:16 +0000 (06:26 +0000)
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java
forester/java/src/org/forester/msa/Mafft.java

index 2b39eee..bb896ae 100644 (file)
@@ -62,6 +62,10 @@ public final class Configuration {
     private boolean                         _use_tabbed_display                                    = false;
     private boolean                         _hide_controls_and_menus                               = false;
     private CLADOGRAM_TYPE                  _cladogram_type                                        = Constants.CLADOGRAM_TYPE_DEFAULT;
+    private File _mafft = null;
+    private File _clustalo = null;
+    private File _fastme = null;
+    
     private SortedMap<String, WebLink>      _weblinks                                              = null;
     private SortedMap<String, Color>        _display_colors                                        = null;
     private boolean                         _antialias_screen                                      = true;
@@ -927,6 +931,18 @@ public final class Configuration {
                 _ui = UI.UNKNOWN;
             }
         }
+        else if ( key.equals( "path_to_mafft" ) ) {
+            setPathToMafft( new File( (String) st.nextElement() ) );
+        }
+        else if ( key.equals( "path_to_clustalo" ) ) {
+            setPathToClustalOmega( new File( (String) st.nextElement() ) );
+        }
+        else if ( key.equals( "path_to_fastme" ) ) {
+            setPathToFastME( new File( (String) st.nextElement() ) );
+        }
+        else if ( key.equals( "path_to_mafft" ) ) {
+            setPathToMafft( new File( (String) st.nextElement() ) );
+        }
         else if ( key.equals( VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA ) ) {
             setValidatePhyloXmlAgainstSchema( parseBoolean( ( String ) st.nextElement() ) );
         }
@@ -1502,6 +1518,38 @@ public final class Configuration {
         return DEFAULT_FONT_FAMILY;
     }
 
+   
+    public File getPathToMafft() {
+        return _mafft;
+    }
+
+    
+
+    public File getPathToClustalOmega() {
+        return _clustalo;
+    }
+
+   
+    public File getPathToFastME() {
+        return _fastme;
+    }
+    
+    
+    public void setPathToMafft( final File mafft ) {
+        _mafft = mafft;
+    }
+
+    
+
+    public void setPathToClustalOmega(  final File clustalo ) {
+         _clustalo = clustalo ;
+    }
+
+   
+    public void setPathToFastME( final File fastme ) {
+         _fastme = fastme;
+    }
+
     static enum TRIPLET {
         TRUE, FALSE, UNKNOWN
     }
index 981e3c8..7e0ec77 100644 (file)
@@ -64,6 +64,7 @@ public class PhylogeneticInferrer implements Runnable {
     private final MainFrameApplication         _mf;
     private final PhylogeneticInferenceOptions _options;
     private final List<Sequence>               _seqs;
+    private final boolean DEBUG = true;
     public final static String                 MSA_FILE_SUFFIX = ".aln";
     public final static String                 PWD_FILE_SUFFIX = ".pwd";
 
@@ -87,9 +88,11 @@ public class PhylogeneticInferrer implements Runnable {
 
     private Msa inferMsa() throws IOException, InterruptedException {
         final File temp_seqs_file = File.createTempFile( "__msa__temp__", ".fasta" );
+        if ( DEBUG ) {
         System.out.println();
         System.out.println( "temp file: " + temp_seqs_file );
         System.out.println();
+        }
         //final File temp_seqs_file = new File( _options.getTempDir() + ForesterUtil.FILE_SEPARATOR + "s.fasta" );
         final BufferedWriter writer = new BufferedWriter( new FileWriter( temp_seqs_file ) );
         SequenceWriter.writeSeqs( _seqs, writer, SEQ_FORMAT.FASTA, 100 );
@@ -160,12 +163,28 @@ public class PhylogeneticInferrer implements Runnable {
             }
             catch ( final IOException e ) {
                 JOptionPane.showMessageDialog( _mf,
-                                               "Could not create multiple sequence alignment with "
-                                                       + _options.getMsaPrg() + "\nand the following parameters:\n\""
-                                                       + _options.getMsaPrgParameters() + "\"\nError:"
+                                               "Could not create multiple sequence alignment with \""
+                                                       + _options.getMsaPrg() + "\" and the following parameters:\n\""
+                                                       + _options.getMsaPrgParameters() + "\"\nError: "
                                                        + e.getLocalizedMessage(),
                                                "Failed to Calculate MSA",
                                                JOptionPane.ERROR_MESSAGE );
+                if ( DEBUG ) {
+                e.printStackTrace();
+                }
+                return;
+            }
+            catch ( final Exception e ) {
+                JOptionPane.showMessageDialog( _mf,
+                                               "Could not create multiple sequence alignment with \""
+                                                       + _options.getMsaPrg() + "\" and the following parameters:\n\""
+                                                       + _options.getMsaPrgParameters() + "\"\nError: "
+                                                       + e.getLocalizedMessage(),
+                                               "Unexpected Exception During MSA Calculation",
+                                               JOptionPane.ERROR_MESSAGE );
+                if ( DEBUG ) {
+                e.printStackTrace();
+                }
                 return;
             }
             if ( msa == null ) {
@@ -177,8 +196,10 @@ public class PhylogeneticInferrer implements Runnable {
                                                JOptionPane.ERROR_MESSAGE );
                 return;
             }
+            if ( DEBUG ) {
             System.out.println( msa.toString() );
             System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
+            }
             final MsaMethods msa_tools = MsaMethods.createInstance();
             if ( _options.isExecuteMsaProcessing() ) {
                 msa = msa_tools.removeGapColumns( _options.getMsaProcessingMaxAllowedGapRatio(),
@@ -194,9 +215,11 @@ public class PhylogeneticInferrer implements Runnable {
                     return;
                 }
             }
+            if ( DEBUG ) {
             System.out.println( msa_tools.getIgnoredSequenceIds() );
             System.out.println( msa.toString() );
             System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
+            }
             _msa = msa;
         }
         final int n = _options.getBootstrapSamples();
index b56ca1e..6fc1675 100644 (file)
@@ -41,11 +41,11 @@ public final class Mafft implements MsaInferrer {
     private int                 _exit_code;
     private final String        _path_to_prg;
 
-    public static MsaInferrer createInstance() {
+    public static MsaInferrer createInstance() throws IOException {
         return createInstance( getPathToCmd() );
     }
 
-    public static MsaInferrer createInstance( final String path_to_prg ) {
+    public static MsaInferrer createInstance( final String path_to_prg ) throws IOException {
         return new Mafft( path_to_prg );
     }
 
@@ -71,9 +71,9 @@ public final class Mafft implements MsaInferrer {
         return SystemCommandExecutor.isExecuteableFile( new File( getPathToCmd() ) );
     }
 
-    private Mafft( final String path_to_prg ) {
+    private Mafft( final String path_to_prg ) throws IOException {
         if ( !SystemCommandExecutor.isExecuteableFile( new File( path_to_prg ) ) ) {
-            throw new IllegalArgumentException( "cannot execute MAFFT via [" + path_to_prg + "]" );
+            throw new IOException( "cannot execute MAFFT with \"" + path_to_prg + "\"" );
         }
         _path_to_prg = new String( path_to_prg );
         init();