inprogress
[jalview.git] / forester / ruby / evoruby / lib / evo / tool / phylogenies_decorator.rb
index 535b1fa..a6ba133 100644 (file)
@@ -203,19 +203,31 @@ module Evoruby
            ' -p -f=m ' + phylogeny_file + ' ' +
            seqs_file_name  + ' ' + TMP_FILE_1
           puts cmd
-          execute_cmd( cmd, log )
+          begin
+            execute_cmd( cmd, log )
+          rescue Error
+            Util.fatal_error( PRG_NAME, 'error: ' + $! )
+          end
 
           cmd = decorator + ' ' + DECORATOR_OPTIONS_DOMAINS + ' ' +
            '-f=d ' + TMP_FILE_1 + ' ' +
            domains_mapfile_name + ' ' +TMP_FILE_2
           puts cmd
-          execute_cmd( cmd, log )
+          begin
+            execute_cmd( cmd, log )
+          rescue Error
+            Util.fatal_error( PRG_NAME, 'error: ' + $! )
+          end
 
           cmd = decorator + ' ' +  DECORATOR_OPTIONS_SEQ_NAMES + ' ' +
            '-f=n ' + TMP_FILE_2 + ' ' +
            ids_mapfile_name + ' ' + outfile
           puts cmd
-          execute_cmd( cmd, log )
+          begin
+            execute_cmd( cmd, log )
+          rescue Error
+            Util.fatal_error( PRG_NAME, 'error: ' + $! )
+          end
 
           File.delete( TMP_FILE_1 )
           File.delete( TMP_FILE_2 )
@@ -241,8 +253,12 @@ module Evoruby
 
 
     def get_id( phylogeny_file_name )
-      phylogeny_file_name =~ /^(.+?)__/
-      $1
+      if phylogeny_file_name =~ /^(.+?)__/
+        return $1
+      elsif phylogeny_file_name =~ /^(.+?)_/
+        return $1
+      end
+      nil
     end
 
     def get_file( files_in_dir, phylogeny_id, suffix_pattern )
@@ -276,18 +292,18 @@ module Evoruby
         if ( !File.directory?( file ) &&
              file !~ /^\./ &&
              file !~ /^00/ &&
-             ( file =~ /^#{phylogeny_id}__.+\d$/ || file =~ /^#{phylogeny_id}__.*\.fasta$/ ) )
+             ( file =~ /^#{phylogeny_id}__.+\d$/ || file =~ /^#{phylogeny_id}_.*\.fasta$/ ) )
           matching_files << file
         end
       }
 
       if matching_files.length < 1
         Util.fatal_error( PRG_NAME, 'no seq file matching [' +
-           phylogeny_id + '__] present in current directory' )
+           phylogeny_id + '_] present in current directory' )
       end
       if matching_files.length > 1
         Util.fatal_error( PRG_NAME, 'more than one seq file matching [' +
-           phylogeny_id + '__] present in current directory' )
+           phylogeny_id + '_] present in current directory' )
       end
       matching_files[ 0 ]
     end