changeset 1:b0d6eb76ad87 draft

planemo upload for repository https://github.com/stamatak/standard-RAxML commit 80c5ab90ac30fe083328ef7ad507d2e578daea90
author iuc
date Sat, 25 Jun 2016 19:34:35 -0400
parents 934206441123
children 6f7ff8a3bd79
files raxml.py test-data/RAxML_parsimonyTree.galaxy.multi
diffstat 2 files changed, 50 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/raxml.py	Mon Nov 30 22:03:09 2015 -0500
+++ b/raxml.py	Sat Jun 25 19:34:35 2016 -0400
@@ -3,23 +3,31 @@
 Runs RAxML on a sequence file.
 For use with RAxML version 8.2.4
 """
-import os, shutil, subprocess, sys, optparse, fnmatch, glob
+import fnmatch
+import glob
+import optparse
+import os
+import subprocess
+import sys
+
 
 def stop_err(msg):
     sys.stderr.write("%s\n" % msg)
     sys.exit()
 
+
 def getint(name):
     basename = name.partition('RUN.')
     if basename[2] != '':
         num = basename[2]
         return int(num)
 
+
 def __main__():
     usage = "usage: %prog -T <threads> -s <input> -n <output> -m <model> [optional arguments]"
 
     # Parse the primary wrapper's command line options
-    parser = optparse.OptionParser(usage = usage)
+    parser = optparse.OptionParser(usage=usage)
     # raxml binary name, hardcoded in the xml file
     parser.add_option("--binary", action="store", type="string", dest="binary", help="Command to run")
     # (-a)
@@ -118,11 +126,11 @@
     # Source
     source = "-s %s" % options.source
     cmd.append(source)
-    #Hardcode to "galaxy" first to simplify the output part of the wrapper
-    #name = "-n %s" % options.name
+    # Hardcode to "galaxy" first to simplify the output part of the wrapper
+    # name = "-n %s" % options.name
     name = "-n galaxy"
     cmd.append(name)
-    ## Model
+    # Model
     model_type = options.model_type
     base_model = options.base_model
     aa_search_matrix = options.aa_search_matrix
@@ -160,7 +168,7 @@
         cmd.append(weightfile)
     # (-A)
     if options.secondary_structure_model:
-        secondary_structure_model  = "-A %s" % options.secondary_structure_model
+        secondary_structure_model = "-A %s" % options.secondary_structure_model
         cmd.append(secondary_structure_model )
     # (-b)
     if options.bootseed:
@@ -191,7 +199,7 @@
         enable_evol_heuristics = "-G %f" % options.enable_evol_heuristics
         cmd.append(enable_evol_heuristics )
     if options.initial_rearrangement_setting:
-        initial_rearrangement_setting  = "-i %s" % options.initial_rearrangement_setting
+        initial_rearrangement_setting = "-i %s" % options.initial_rearrangement_setting
         cmd.append(initial_rearrangement_setting)
     if options.posterior_bootstopping_analysis:
         posterior_bootstopping_analysis = "-I %s" % options.posterior_bootstopping_analysis
@@ -225,7 +233,7 @@
         bin_model_parameter_file_name = "RAxML_binaryModelParameters.galaxy"
         os.symlink(options.bin_model_parameter_file, bin_model_parameter_file_name )
         bin_model_parameter_file = "-R %s" % options.bin_model_parameter_file
-        #Needs testing. Is the hardcoded name or the real path needed?
+        # Needs testing. Is the hardcoded name or the real path needed?
         cmd.append(bin_model_parameter_file)
     if options.secondary_structure_file:
         secondary_structure_file = "-S %s" % options.secondary_structure_file
@@ -260,7 +268,7 @@
 
     try:
         proc = subprocess.Popen(args=full_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    except Exception, err:
+    except Exception as err:
         sys.stderr.write("Error invoking command: \n%s\n\n%s\n" % (cmd, err))
         sys.exit(1)
     stdout, stderr = proc.communicate()
@@ -274,13 +282,13 @@
         sys.stdout.write(stdout)
         sys.stdout.write(stderr)
 
-    #Multiple runs - concatenate
+    # Multiple runs - concatenate
     if number_of_runs_opt > 0:
         if (bootseed == 0) and (rapid_bootstrap_random_seed == 0 ):
             runfiles = glob.glob('RAxML*RUN*')
             runfiles.sort(key=getint)
         # Logs
-            outfile = open('RAxML_log.galaxy','w')
+            outfile = open('RAxML_log.galaxy', 'w')
             for filename in runfiles:
                 if fnmatch.fnmatch(filename, 'RAxML_log.galaxy.RUN.*'):
                     infile = open(filename, 'r')
@@ -291,7 +299,7 @@
                     infile.close()
             outfile.close()
         # Parsimony Trees
-            outfile = open('RAxML_parsimonyTree.galaxy','w')
+            outfile = open('RAxML_parsimonyTree.galaxy', 'w')
             for filename in runfiles:
                 if fnmatch.fnmatch(filename, 'RAxML_parsimonyTree.galaxy.RUN.*'):
                     infile = open(filename, 'r')
@@ -302,7 +310,7 @@
                     infile.close()
             outfile.close()
         # Results
-            outfile = open('RAxML_result.galaxy','w')
+            outfile = open('RAxML_result.galaxy', 'w')
             for filename in runfiles:
                 if fnmatch.fnmatch(filename, 'RAxML_result.galaxy.RUN.*'):
                     infile = open(filename, 'r')
@@ -317,7 +325,7 @@
         files = glob.glob('RAxML_bestTree.galaxy.PARTITION.*')
         if len(files) > 0:
             files.sort(key=getint)
-            outfile = open('RAxML_bestTreePartitions.galaxy','w')
+            outfile = open('RAxML_bestTreePartitions.galaxy', 'w')
             # Best Tree Partitions
             for filename in files:
                 if fnmatch.fnmatch(filename, 'RAxML_bestTree.galaxy.PARTITION.*'):
@@ -329,7 +337,7 @@
                     infile.close()
             outfile.close()
         else:
-            outfile = open('RAxML_bestTreePartitions.galaxy','w')
+            outfile = open('RAxML_bestTreePartitions.galaxy', 'w')
             outfile.write("No partition files were produced.\n")
             outfile.close()
 
@@ -337,7 +345,7 @@
         files = glob.glob('RAxML_result.galaxy.PARTITION.*')
         if len(files) > 0:
             files.sort(key=getint)
-            outfile = open('RAxML_resultPartitions.galaxy','w')
+            outfile = open('RAxML_resultPartitions.galaxy', 'w')
             for filename in files:
                 if fnmatch.fnmatch(filename, 'RAxML_result.galaxy.PARTITION.*'):
                     infile = open(filename, 'r')
@@ -348,14 +356,15 @@
                     infile.close()
             outfile.close()
         else:
-            outfile = open('RAxML_resultPartitions.galaxy','w')
+            outfile = open('RAxML_resultPartitions.galaxy', 'w')
             outfile.write("No partition files were produced.\n")
             outfile.close()
 
     # DEBUG options
-    infof = open('RAxML_info.galaxy','a')
+    infof = open('RAxML_info.galaxy', 'a')
     infof.write('\nOM: CLI options DEBUG START:\n')
     infof.write(options.__repr__())
     infof.write('\nOM: CLI options DEBUG END\n')
 
-if __name__=="__main__": __main__()
+if __name__ == "__main__":
+    __main__()
--- a/test-data/RAxML_parsimonyTree.galaxy.multi	Mon Nov 30 22:03:09 2015 -0500
+++ b/test-data/RAxML_parsimonyTree.galaxy.multi	Sat Jun 25 19:34:35 2016 -0400
@@ -45,43 +45,43 @@
 
 RAxML was called as follows:
 
-raxmlHPC -s /tmp/tmp_D_Wx1/files/000/dataset_7.dat -n galaxy -m GTRCAT -N 5 -f d -p 1234567890 
+raxmlHPC -s /tmp/tmpS1corm/files/000/dataset_7.dat -n galaxy -m GTRCAT -N 5 -f d -p 1234567890 
 
 
 Partition: 0 with name: No Name Provided
 Base frequencies: 0.325 0.288 0.168 0.218 
 
-Inference[0]: Time 0.384667 CAT-based likelihood -318.296661, best rearrangement setting 5
-alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 156.921091 909.963678 698.791844 49.826026 1853.987180 1.000000 
-Inference[1]: Time 0.312805 CAT-based likelihood -320.216685, best rearrangement setting 5
-alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 984.966228 1693.994555 1327.595110 133.225736 5344.810756 1.000000 
-Inference[2]: Time 0.310104 CAT-based likelihood -317.720602, best rearrangement setting 5
-alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 467.622832 1755.681465 1079.971295 84.603657 3889.976834 1.000000 
-Inference[3]: Time 0.361859 CAT-based likelihood -320.856853, best rearrangement setting 5
-alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 951.251278 1754.861720 1010.715785 104.248328 4976.318155 1.000000 
-Inference[4]: Time 0.365067 CAT-based likelihood -320.068835, best rearrangement setting 5
-alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 1216.935051 2115.369469 1728.113008 157.211587 6783.037433 1.000000 
+Inference[0]: Time 0.216205 CAT-based likelihood -318.296661, best rearrangement setting 5
+alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 156.924095 909.973305 698.798586 49.826281 1854.008494 1.000000 
+Inference[1]: Time 0.156515 CAT-based likelihood -320.216706, best rearrangement setting 5
+alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 984.611489 1694.475132 1327.909793 133.166551 5344.045057 1.000000 
+Inference[2]: Time 0.168518 CAT-based likelihood -317.720618, best rearrangement setting 5
+alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 467.628294 1755.581565 1080.117186 84.613232 3889.913949 1.000000 
+Inference[3]: Time 0.151635 CAT-based likelihood -320.856852, best rearrangement setting 5
+alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 951.225250 1754.836760 1010.717630 104.250644 4976.305821 1.000000 
+Inference[4]: Time 0.148819 CAT-based likelihood -320.068842, best rearrangement setting 5
+alpha[0]: 1.000000 rates[0] ac ag at cg ct gt: 1216.938988 2115.384600 1728.203983 157.161613 6782.996281 1.000000 
 
 
 Conducting final model optimizations on all 5 trees under GAMMA-based models ....
 
-Inference[0] final GAMMA-based Likelihood: -378.273623 tree written to file /tmp/tmp_D_Wx1/job_working_directory/000/4/RAxML_result.galaxy.RUN.0
-Inference[1] final GAMMA-based Likelihood: -378.202275 tree written to file /tmp/tmp_D_Wx1/job_working_directory/000/4/RAxML_result.galaxy.RUN.1
-Inference[2] final GAMMA-based Likelihood: -377.272786 tree written to file /tmp/tmp_D_Wx1/job_working_directory/000/4/RAxML_result.galaxy.RUN.2
-Inference[3] final GAMMA-based Likelihood: -377.004344 tree written to file /tmp/tmp_D_Wx1/job_working_directory/000/4/RAxML_result.galaxy.RUN.3
-Inference[4] final GAMMA-based Likelihood: -378.202275 tree written to file /tmp/tmp_D_Wx1/job_working_directory/000/4/RAxML_result.galaxy.RUN.4
+Inference[0] final GAMMA-based Likelihood: -378.273666 tree written to file /tmp/tmpS1corm/job_working_directory/000/4/RAxML_result.galaxy.RUN.0
+Inference[1] final GAMMA-based Likelihood: -378.202304 tree written to file /tmp/tmpS1corm/job_working_directory/000/4/RAxML_result.galaxy.RUN.1
+Inference[2] final GAMMA-based Likelihood: -377.272824 tree written to file /tmp/tmpS1corm/job_working_directory/000/4/RAxML_result.galaxy.RUN.2
+Inference[3] final GAMMA-based Likelihood: -377.004321 tree written to file /tmp/tmpS1corm/job_working_directory/000/4/RAxML_result.galaxy.RUN.3
+Inference[4] final GAMMA-based Likelihood: -378.202304 tree written to file /tmp/tmpS1corm/job_working_directory/000/4/RAxML_result.galaxy.RUN.4
 
 
-Starting final GAMMA-based thorough Optimization on tree 3 likelihood -377.004344 .... 
+Starting final GAMMA-based thorough Optimization on tree 3 likelihood -377.004321 .... 
 
-Final GAMMA-based Score of best tree -377.004344
+Final GAMMA-based Score of best tree -377.004321
 
-Program execution info written to /tmp/tmp_D_Wx1/job_working_directory/000/4/RAxML_info.galaxy
-Best-scoring ML tree written to: /tmp/tmp_D_Wx1/job_working_directory/000/4/RAxML_bestTree.galaxy
+Program execution info written to /tmp/tmpS1corm/job_working_directory/000/4/RAxML_info.galaxy
+Best-scoring ML tree written to: /tmp/tmpS1corm/job_working_directory/000/4/RAxML_bestTree.galaxy
 
-Overall execution time: 1.829373 secs or 0.000508 hours or 0.000021 days
+Overall execution time: 0.917038 secs or 0.000255 hours or 0.000011 days
 
 
 OM: CLI options DEBUG START:
-<Values at 0x7fd1fab4d518: {'bootseed': None, 'groupingfile': None, 'posterior_bootstopping_analysis': None, 'print_branch_lengths': None, 'starting_tree': None, 'model_opt_precision': None, 'weightfile': None, 'use_median_approximation': None, 'majority_rule_consensus': None, 'excludefile': None, 'save_memory_gappy_alignments': None, 'binary': 'raxmlHPC', 'numofcats': None, 'multistate_sub_model': None, 'multiple_model': None, 'search_complete_random_tree': None, 'source': '/tmp/tmp_D_Wx1/files/000/dataset_7.dat', 'outgroup_name': None, 'estimate_individual_branch_lengths': None, 'ml_search_convergence': None, 'file_multiple_trees': None, 'rapid_bootstrap_random_seed': None, 'random_seed': 1234567890, 'disable_undetermined_seq_check': None, 'save_memory_cat_model': None, 'enable_evol_heuristics': None, 'aa_empirical_freq': None, 'threads': 1, 'external_protein_model': None, 'search_algorithm': 'd', 'constraint_file': None, 'secondary_structure_model': None, 'number_of_runs': 5, 'name': None, 'initial_rearrangement_setting': None, 'secondary_structure_file': None, 'model_type': 'nucleotide', 'aa_search_matrix': None, 'disable_rate_heterogeneity': None, 'base_model': 'GTRCAT', 'parsimony_starting_tree_only': None, 'number_of_runs_bootstop': None, 'sliding_window_size': None, 'bin_model_parameter_file': None}>
+<Values at 0x7f8e104919e0: {'bootseed': None, 'groupingfile': None, 'posterior_bootstopping_analysis': None, 'print_branch_lengths': None, 'starting_tree': None, 'model_opt_precision': None, 'weightfile': None, 'use_median_approximation': None, 'majority_rule_consensus': None, 'excludefile': None, 'save_memory_gappy_alignments': None, 'binary': 'raxmlHPC', 'numofcats': None, 'multistate_sub_model': None, 'multiple_model': None, 'search_complete_random_tree': None, 'source': '/tmp/tmpS1corm/files/000/dataset_7.dat', 'outgroup_name': None, 'estimate_individual_branch_lengths': None, 'ml_search_convergence': None, 'file_multiple_trees': None, 'rapid_bootstrap_random_seed': None, 'random_seed': 1234567890, 'disable_undetermined_seq_check': None, 'save_memory_cat_model': None, 'enable_evol_heuristics': None, 'aa_empirical_freq': None, 'threads': 1, 'external_protein_model': None, 'search_algorithm': 'd', 'constraint_file': None, 'secondary_structure_model': None, 'number_of_runs': 5, 'name': None, 'initial_rearrangement_setting': None, 'secondary_structure_file': None, 'model_type': 'nucleotide', 'aa_search_matrix': None, 'disable_rate_heterogeneity': None, 'base_model': 'GTRCAT', 'parsimony_starting_tree_only': None, 'number_of_runs_bootstop': None, 'sliding_window_size': None, 'bin_model_parameter_file': None}>
 OM: CLI options DEBUG END