Mercurial > repos > iuc > raxml
annotate raxml.py @ 0:6805e85573b8 draft
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
| author | iuc | 
|---|---|
| date | Mon, 14 Nov 2016 14:03:39 -0500 | 
| parents | |
| children | ba29b5e2a4be | 
| rev | line source | 
|---|---|
| 0 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 1 #!/usr/bin/env python | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 2 """ | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 3 Runs RAxML on a sequence file. | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 4 For use with RAxML version 8.2.4 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 5 """ | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 6 import fnmatch | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 7 import glob | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 8 import optparse | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 9 import os | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 10 import subprocess | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 11 import sys | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 12 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 13 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 14 def stop_err(msg): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 15 sys.stderr.write("%s\n" % msg) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 16 sys.exit() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 17 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 18 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 19 def getint(name): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 20 basename = name.partition('RUN.') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 21 if basename[2] != '': | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 22 num = basename[2] | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 23 return int(num) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 24 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 25 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 26 def __main__(): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 27 usage = "usage: %prog -T <threads> -s <input> -n <output> -m <model> [optional arguments]" | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 28 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 29 # Parse the primary wrapper's command line options | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 30 parser = optparse.OptionParser(usage=usage) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 31 # raxml binary name, hardcoded in the xml file | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 32 parser.add_option("--binary", action="store", type="string", dest="binary", help="Command to run") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 33 # (-a) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 34 parser.add_option("--weightfile", action="store", type="string", dest="weightfile", help="Column weight file") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 35 # (-A) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 36 parser.add_option("--secondary_structure_model", action="store", type="string", dest="secondary_structure_model", help="Secondary structure model") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 37 # (-b) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 38 parser.add_option("--bootseed", action="store", type="int", dest="bootseed", help="Bootstrap random number seed") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 39 # (-c) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 40 parser.add_option("--numofcats", action="store", type="int", dest="numofcats", help="Number of distinct rate categories") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 41 # (-d) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 42 parser.add_option("--search_complete_random_tree", action="store_true", dest="search_complete_random_tree", help="Search with a complete random starting tree") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 43 # (-D) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 44 parser.add_option("--ml_search_convergence", action="store_true", dest="ml_search_convergence", help="ML search onvergence criterion") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 45 # (-e) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 46 parser.add_option("--model_opt_precision", action="store", type="float", dest="model_opt_precision", help="Model Optimization Precision (-e)") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 47 # (-E) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 48 parser.add_option("--excludefile", action="store", type="string", dest="excludefile", help="Exclude File Name") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 49 # (-f) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 50 parser.add_option("--search_algorithm", action="store", type="string", dest="search_algorithm", help="Search Algorithm") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 51 # (-F) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 52 parser.add_option("--save_memory_cat_model", action="store_true", dest="save_memory_cat_model", help="Save memory under CAT and GTRGAMMA models") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 53 # (-g) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 54 parser.add_option("--groupingfile", action="store", type="string", dest="groupingfile", help="Grouping File Name") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 55 # (-G) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 56 parser.add_option("--enable_evol_heuristics", action="store_true", dest="enable_evol_heuristics", help="Enable evol algo heuristics") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 57 # (-i) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 58 parser.add_option("--initial_rearrangement_setting", action="store", type="int", dest="initial_rearrangement_setting", help="Initial Rearrangement Setting") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 59 # (-I) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 60 parser.add_option("--posterior_bootstopping_analysis", action="store", type="string", dest="posterior_bootstopping_analysis", help="Posterior bootstopping analysis") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 61 # (-J) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 62 parser.add_option("--majority_rule_consensus", action="store", type="string", dest="majority_rule_consensus", help="Majority rule consensus") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 63 # (-k) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 64 parser.add_option("--print_branch_lengths", action="store_true", dest="print_branch_lengths", help="Print branch lengths") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 65 # (-K) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 66 parser.add_option("--multistate_sub_model", action="store", type="string", dest="multistate_sub_model", help="Multistate substitution model") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 67 # (-m) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 68 parser.add_option("--model_type", action="store", type="string", dest="model_type", help="Model Type") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 69 parser.add_option("--base_model", action="store", type="string", dest="base_model", help="Base Model") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 70 parser.add_option("--aa_empirical_freq", action="store_true", dest="aa_empirical_freq", help="Use AA Empirical base frequences") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 71 parser.add_option("--aa_search_matrix", action="store", type="string", dest="aa_search_matrix", help="AA Search Matrix") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 72 # (-n) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 73 parser.add_option("--name", action="store", type="string", dest="name", help="Run Name") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 74 # (-N/#) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 75 parser.add_option("--number_of_runs", action="store", type="int", dest="number_of_runs", help="Number of alternative runs") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 76 parser.add_option("--number_of_runs_bootstop", action="store", type="string", dest="number_of_runs_bootstop", help="Number of alternative runs based on the bootstop criteria") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 77 # (-M) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 78 parser.add_option("--estimate_individual_branch_lengths", action="store_true", dest="estimate_individual_branch_lengths", help="Estimate individual branch lengths") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 79 # (-o) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 80 parser.add_option("--outgroup_name", action="store", type="string", dest="outgroup_name", help="Outgroup Name") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 81 # (-O) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 82 parser.add_option("--disable_undetermined_seq_check", action="store_true", dest="disable_undetermined_seq_check", help="Disable undetermined sequence check") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 83 # (-p) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 84 parser.add_option("--random_seed", action="store", type="int", dest="random_seed", help="Random Number Seed") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 85 # (-P) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 86 parser.add_option("--external_protein_model", action="store", type="string", dest="external_protein_model", help="External Protein Model") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 87 # (-q) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 88 parser.add_option("--multiple_model", action="store", type="string", dest="multiple_model", help="Multiple Model File") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 89 # (-r) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 90 parser.add_option("--constraint_file", action="store", type="string", dest="constraint_file", help="Constraint File") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 91 # (-R) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 92 parser.add_option("--bin_model_parameter_file", action="store", type="string", dest="bin_model_parameter_file", help="Constraint File") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 93 # (-s) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 94 parser.add_option("--source", action="store", type="string", dest="source", help="Input file") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 95 # (-S) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 96 parser.add_option("--secondary_structure_file", action="store", type="string", dest="secondary_structure_file", help="Secondary structure file") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 97 # (-t) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 98 parser.add_option("--starting_tree", action="store", type="string", dest="starting_tree", help="Starting Tree") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 99 # (-T) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 100 parser.add_option("--threads", action="store", type="int", dest="threads", help="Number of threads to use") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 101 # (-u) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 102 parser.add_option("--use_median_approximation", action="store_true", dest="use_median_approximation", help="Use median approximation") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 103 # (-U) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 104 parser.add_option("--save_memory_gappy_alignments", action="store_true", dest="save_memory_gappy_alignments", help="Save memory in large gapped alignments") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 105 # (-V) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 106 parser.add_option("--disable_rate_heterogeneity", action="store_true", dest="disable_rate_heterogeneity", help="Disable rate heterogeneity") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 107 # (-W) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 108 parser.add_option("--sliding_window_size", action="store", type="string", dest="sliding_window_size", help="Sliding window size") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 109 # (-x) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 110 parser.add_option("--rapid_bootstrap_random_seed", action="store", type="int", dest="rapid_bootstrap_random_seed", help="Rapid Boostrap Random Seed") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 111 # (-y) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 112 parser.add_option("--parsimony_starting_tree_only", action="store_true", dest="parsimony_starting_tree_only", help="Generate a parsimony starting tree only") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 113 # (-z) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 114 parser.add_option("--file_multiple_trees", action="store", type="string", dest="file_multiple_trees", help="Multiple Trees File") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 115 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 116 (options, args) = parser.parse_args() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 117 cmd = [] | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 118 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 119 # Required parameters | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 120 binary = options.binary | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 121 cmd.append(binary) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 122 # Threads | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 123 if options.threads > 1: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 124 threads = "-T %d" % options.threads | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 125 cmd.append(threads) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 126 # Source | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 127 source = "-s %s" % options.source | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 128 cmd.append(source) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 129 # Hardcode to "galaxy" first to simplify the output part of the wrapper | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 130 # name = "-n %s" % options.name | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 131 name = "-n galaxy" | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 132 cmd.append(name) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 133 # Model | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 134 model_type = options.model_type | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 135 base_model = options.base_model | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 136 aa_search_matrix = options.aa_search_matrix | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 137 aa_empirical_freq = options.aa_empirical_freq | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 138 if model_type == 'aminoacid': | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 139 model = "-m %s%s" % (base_model, aa_search_matrix) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 140 if aa_empirical_freq: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 141 model = "-m %s%s%s" % (base_model, aa_search_matrix, 'F') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 142 # (-P) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 143 if options.external_protein_model: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 144 external_protein_model = "-P %s" % options.external_protein_model | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 145 cmd.append(external_protein_model) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 146 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 147 model = "-m %s" % base_model | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 148 cmd.append(model) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 149 if model == "GTRCAT": | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 150 # (-c) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 151 if options.numofcats: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 152 numofcats = "-c %d" % options.numofcats | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 153 cmd.append(numofcats) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 154 # Optional parameters | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 155 if options.number_of_runs_bootstop: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 156 number_of_runs_bootstop = "-N %s" % options.number_of_runs_bootstop | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 157 cmd.append(number_of_runs_bootstop) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 158 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 159 number_of_runs_bootstop = '' | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 160 if options.number_of_runs: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 161 number_of_runs_opt = "-N %d" % options.number_of_runs | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 162 cmd.append(number_of_runs_opt) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 163 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 164 number_of_runs_opt = 0 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 165 # (-a) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 166 if options.weightfile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 167 weightfile = "-a %s" % options.weightfile | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 168 cmd.append(weightfile) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 169 # (-A) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 170 if options.secondary_structure_model: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 171 secondary_structure_model = "-A %s" % options.secondary_structure_model | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 172 cmd.append(secondary_structure_model ) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 173 # (-b) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 174 if options.bootseed: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 175 bootseed = "-b %d" % options.bootseed | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 176 cmd.append(bootseed) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 177 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 178 bootseed = 0 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 179 # -C - doesn't work in pthreads version, skipped | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 180 if options.search_complete_random_tree: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 181 cmd.append("-d") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 182 if options.ml_search_convergence: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 183 cmd.append("-D" ) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 184 if options.model_opt_precision: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 185 model_opt_precision = "-e %f" % options.model_opt_precision | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 186 cmd.append(model_opt_precision) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 187 if options.excludefile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 188 excludefile = "-E %s" % options.excludefile | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 189 cmd.append(excludefile) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 190 if options.search_algorithm: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 191 search_algorithm = "-f %s" % options.search_algorithm | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 192 cmd.append(search_algorithm) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 193 if options.save_memory_cat_model: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 194 cmd.append("-F") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 195 if options.groupingfile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 196 groupingfile = "-g %s" % options.groupingfile | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 197 cmd.append(groupingfile) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 198 if options.enable_evol_heuristics: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 199 enable_evol_heuristics = "-G %f" % options.enable_evol_heuristics | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 200 cmd.append(enable_evol_heuristics ) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 201 if options.initial_rearrangement_setting: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 202 initial_rearrangement_setting = "-i %s" % options.initial_rearrangement_setting | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 203 cmd.append(initial_rearrangement_setting) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 204 if options.posterior_bootstopping_analysis: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 205 posterior_bootstopping_analysis = "-I %s" % options.posterior_bootstopping_analysis | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 206 cmd.append(posterior_bootstopping_analysis) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 207 if options.majority_rule_consensus: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 208 majority_rule_consensus = "-J %s" % options.majority_rule_consensus | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 209 cmd.append(majority_rule_consensus) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 210 if options.print_branch_lengths: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 211 cmd.append("-k") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 212 if options.multistate_sub_model: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 213 multistate_sub_model = "-K %s" % options.multistate_sub_model | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 214 cmd.append(multistate_sub_model) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 215 if options.estimate_individual_branch_lengths: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 216 cmd.append("-M") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 217 if options.outgroup_name: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 218 outgroup_name = "-o %s" % options.outgroup_name | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 219 cmd.append(outgroup_name) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 220 if options.disable_undetermined_seq_check: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 221 cmd.append("-O") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 222 if options.random_seed: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 223 random_seed = "-p %d" % options.random_seed | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 224 cmd.append(random_seed) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 225 multiple_model = None | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 226 if options.multiple_model: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 227 multiple_model = "-q %s" % options.multiple_model | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 228 cmd.append(multiple_model) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 229 if options.constraint_file: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 230 constraint_file = "-r %s" % options.constraint_file | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 231 cmd.append(constraint_file) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 232 if options.bin_model_parameter_file: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 233 bin_model_parameter_file_name = "RAxML_binaryModelParameters.galaxy" | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 234 os.symlink(options.bin_model_parameter_file, bin_model_parameter_file_name ) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 235 bin_model_parameter_file = "-R %s" % options.bin_model_parameter_file | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 236 # Needs testing. Is the hardcoded name or the real path needed? | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 237 cmd.append(bin_model_parameter_file) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 238 if options.secondary_structure_file: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 239 secondary_structure_file = "-S %s" % options.secondary_structure_file | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 240 cmd.append(secondary_structure_file) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 241 if options.starting_tree: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 242 starting_tree = "-t %s" % options.starting_tree | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 243 cmd.append(starting_tree) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 244 if options.use_median_approximation: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 245 cmd.append("-u") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 246 if options.save_memory_gappy_alignments: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 247 cmd.append("-U") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 248 if options.disable_rate_heterogeneity: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 249 cmd.append("-V") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 250 if options.sliding_window_size: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 251 sliding_window_size = "-W %d" % options.sliding_window_size | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 252 cmd.append(sliding_window_size) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 253 if options.rapid_bootstrap_random_seed: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 254 rapid_bootstrap_random_seed = "-x %d" % options.rapid_bootstrap_random_seed | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 255 cmd.append(rapid_bootstrap_random_seed) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 256 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 257 rapid_bootstrap_random_seed = 0 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 258 if options.parsimony_starting_tree_only: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 259 cmd.append("-y") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 260 if options.file_multiple_trees: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 261 file_multiple_trees = "-z %s" % options.file_multiple_trees | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 262 cmd.append(file_multiple_trees) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 263 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 264 print "cmd list: ", cmd, "\n" | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 265 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 266 full_cmd = " ".join(cmd) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 267 print "Command string: %s" % full_cmd | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 268 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 269 try: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 270 proc = subprocess.Popen(args=full_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 271 except Exception as err: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 272 sys.stderr.write("Error invoking command: \n%s\n\n%s\n" % (cmd, err)) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 273 sys.exit(1) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 274 stdout, stderr = proc.communicate() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 275 return_code = proc.returncode | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 276 if return_code: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 277 sys.stdout.write(stdout) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 278 sys.stderr.write(stderr) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 279 sys.stderr.write("Return error code %i from command:\n" % return_code) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 280 sys.stderr.write("%s\n" % cmd) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 281 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 282 sys.stdout.write(stdout) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 283 sys.stdout.write(stderr) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 284 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 285 # Multiple runs - concatenate | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 286 if number_of_runs_opt > 0: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 287 if (bootseed == 0) and (rapid_bootstrap_random_seed == 0 ): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 288 runfiles = glob.glob('RAxML*RUN*') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 289 runfiles.sort(key=getint) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 290 # Logs | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 291 outfile = open('RAxML_log.galaxy', 'w') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 292 for filename in runfiles: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 293 if fnmatch.fnmatch(filename, 'RAxML_log.galaxy.RUN.*'): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 294 infile = open(filename, 'r') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 295 filename_line = "%s\n" % filename | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 296 outfile.write(filename_line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 297 for line in infile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 298 outfile.write(line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 299 infile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 300 outfile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 301 # Parsimony Trees | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 302 outfile = open('RAxML_parsimonyTree.galaxy', 'w') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 303 for filename in runfiles: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 304 if fnmatch.fnmatch(filename, 'RAxML_parsimonyTree.galaxy.RUN.*'): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 305 infile = open(filename, 'r') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 306 filename_line = "%s\n" % filename | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 307 outfile.write(filename_line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 308 for line in infile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 309 outfile.write(line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 310 infile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 311 outfile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 312 # Results | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 313 outfile = open('RAxML_result.galaxy', 'w') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 314 for filename in runfiles: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 315 if fnmatch.fnmatch(filename, 'RAxML_result.galaxy.RUN.*'): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 316 infile = open(filename, 'r') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 317 filename_line = "%s\n" % filename | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 318 outfile.write(filename_line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 319 for line in infile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 320 outfile.write(line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 321 infile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 322 outfile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 323 # Multiple Model Partition Files | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 324 if multiple_model: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 325 files = glob.glob('RAxML_bestTree.galaxy.PARTITION.*') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 326 if len(files) > 0: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 327 files.sort(key=getint) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 328 outfile = open('RAxML_bestTreePartitions.galaxy', 'w') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 329 # Best Tree Partitions | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 330 for filename in files: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 331 if fnmatch.fnmatch(filename, 'RAxML_bestTree.galaxy.PARTITION.*'): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 332 infile = open(filename, 'r') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 333 filename_line = "%s\n" % filename | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 334 outfile.write(filename_line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 335 for line in infile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 336 outfile.write(line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 337 infile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 338 outfile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 339 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 340 outfile = open('RAxML_bestTreePartitions.galaxy', 'w') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 341 outfile.write("No partition files were produced.\n") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 342 outfile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 343 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 344 # Result Partitions | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 345 files = glob.glob('RAxML_result.galaxy.PARTITION.*') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 346 if len(files) > 0: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 347 files.sort(key=getint) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 348 outfile = open('RAxML_resultPartitions.galaxy', 'w') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 349 for filename in files: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 350 if fnmatch.fnmatch(filename, 'RAxML_result.galaxy.PARTITION.*'): | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 351 infile = open(filename, 'r') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 352 filename_line = "%s\n" % filename | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 353 outfile.write(filename_line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 354 for line in infile: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 355 outfile.write(line) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 356 infile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 357 outfile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 358 else: | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 359 outfile = open('RAxML_resultPartitions.galaxy', 'w') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 360 outfile.write("No partition files were produced.\n") | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 361 outfile.close() | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 362 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 363 # DEBUG options | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 364 infof = open('RAxML_info.galaxy', 'a') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 365 infof.write('\nOM: CLI options DEBUG START:\n') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 366 infof.write(options.__repr__()) | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 367 infof.write('\nOM: CLI options DEBUG END\n') | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 368 | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 369 if __name__ == "__main__": | 
| 
6805e85573b8
planemo upload for repository https://github.com/stamatak/standard-RAxML commit 174be06d7c7e7789df16ea5d5068f20b21257a2f
 iuc parents: diff
changeset | 370 __main__() | 
