1
2
3
4
5 """Command-line wrapper for the tree inference program RAxML.
6
7 Derived from the help page for RAxML version 7.3 by Alexandros Stamatakis, but
8 should work for any version 7.X (and probably earlier for most options).
9 """
10 __docformat__ = "restructuredtext en"
11
12 from Bio.Application import _Option, _Switch, AbstractCommandline
13
14
16 """Command-line wrapper for the tree inference program RAxML.
17
18 The required parameters are 'sequences' (-s), 'model' (-m) and 'name' (-n).
19 The parameter 'parsimony_seed' (-p) must also be set for RAxML, but if you
20 do not specify it, this wrapper will set the seed to 10000 for you.
21
22 Example:
23
24 >>> from Bio.Phylo.Applications import RaxmlCommandline
25 >>> raxml_cline = RaxmlCommandline(sequences="Tests/Phylip/interlaced2.phy",
26 ... model="PROTCATWAG", name="interlaced2")
27 >>> print raxml_cline
28 raxmlHPC -m PROTCATWAG -n interlaced2 -p 10000 -s Tests/Phylip/interlaced2.phy
29
30 You would typically run the command line with raxml_cline() or via
31 the Python subprocess module, as described in the Biopython tutorial.
32
33 Citation:
34
35 Stamatakis A.
36 RAxML-VI-HPC: Maximum Likelihood-based Phylogenetic Analyses with
37 Thousands of Taxa and Mixed Models.
38 Bioinformatics 2006, 22(21):2688-2690.
39
40 Homepage: http://sco.h-its.org/exelixis/software.html
41 """
42
43 - def __init__(self, cmd='raxmlHPC', **kwargs):
44 self.parameters = [
45 _Option(['-a', 'weight_filename'],
46 "Name of a column weight file to assign individual weights "
47 "to each column of the alignment. Those weights must be "
48 "integers separated by any type and number of whitespaces "
49 "within a separate file.",
50 filename=True,
51 equate=False,
52 ),
53
54 _Option(['-b', 'bootstrap_seed'],
55 "Random seed for bootstrapping.",
56 equate=False,
57 ),
58
59 _Option(['-c', 'num_categories'],
60 "Number of distinct rate categories for RAxML when "
61 "evolution model is set to GTRCAT or GTRMIX."
62 "Individual per-site rates are categorized into this "
63 "many rate categories to accelerate computations. "
64 "Default: 25.",
65 equate=False,
66 ),
67
68 _Switch(['-d', 'random_starting_tree'],
69 "Start ML optimization from random starting tree."
70 ),
71
72 _Option(['-e', 'epsilon'],
73 "Set model optimization precision in log likelihood units "
74 "for final optimization of tree topology under MIX/MIXI "
75 "or GAMMA/GAMMAI."
76 "Default: 0.1 for models not using proportion of "
77 "invariant sites estimate; 0.001 for models using "
78 "proportion of invariant sites estimate.",
79 equate=False,
80 ),
81
82 _Option(['-E', 'exclude_filename'],
83 "An exclude file name, containing a specification of "
84 "alignment positions you wish to exclude. Format is "
85 "similar to Nexus, the file shall contain entries like "
86 "'100-200 300-400'; to exclude a single column write, "
87 "e.g., '100-100'. If you use a mixed model, an "
88 "appropriately adapted model file will be written.",
89 filename=True,
90 equate=False,
91 ),
92
93 _Option(['-f', 'algorithm'],
94 """Select algorithm:
95 a: Rapid Bootstrap analysis and search for best-scoring ML
96 tree in one program run.
97 b: Draw bipartition information on a tree provided with '-t'
98 based on multiple trees (e.g. form a bootstrap) in a file
99 specifed by '-z'.
100 c: Check if the alignment can be properly read by RAxML.
101 d: New rapid hill-climbing (DEFAULT).
102 e: Optimize model+branch lengths for given input tree under
103 GAMMA/GAMMAI only.
104 g: Compute per site log Likelihoods for one ore more trees
105 passed via '-z' and write them to a file that can be read
106 by CONSEL.
107 h: Compute log likelihood test (SH-test) between best tree
108 passed via '-t' and a bunch of other trees passed via '-z'.
109 i: Perform a really thorough bootstrap, refinement of final
110 bootstrap tree under GAMMA and a more exhaustive algorithm.
111 j: Generate a bunch of bootstrapped alignment files from an
112 original alignemnt file.
113 m: Compare bipartitions between two bunches of trees passed
114 via '-t' and '-z' respectively. This will return the
115 Pearson correlation between all bipartitions found in the
116 two tree files. A file called
117 RAxML_bipartitionFrequencies.outputFileName will be
118 printed that contains the pair-wise bipartition
119 frequencies of the two sets.
120 n: Compute the log likelihood score of all trees contained
121 in a tree file provided by '-z' under GAMMA or
122 GAMMA+P-Invar.
123 o: Old and slower rapid hill-climbing.
124 p: Perform pure stepwise MP addition of new sequences to an
125 incomplete starting tree.
126 s: Split up a multi-gene partitioned alignment into the
127 respective subalignments.
128 t: Do randomized tree searches on one fixed starting tree.
129 w: Compute ELW test on a bunch of trees passed via '-z'.
130 x: Compute pair-wise ML distances, ML model parameters will
131 be estimated on an MP starting tree or a user-defined
132 tree passed via '-t', only allowed for GAMMA-based models
133 of rate heterogeneity.""",
134 checker_function=(lambda x:
135 isinstance(x, basestring) and len(x) == 1),
136 equate=False,
137 ),
138
139 _Option(['-g', 'grouping_constraint'],
140 "File name of a multifurcating constraint tree. "
141 "this tree does not need to be comprehensive, i.e. "
142 "contain all taxa.",
143 filename=True,
144 equate=False,
145 ),
146
147 _Option(['-i', 'rearrangements'],
148 "Initial rearrangement setting for the subsequent "
149 "application of topological changes phase.",
150 equate=False,
151 ),
152
153 _Switch(['-j', 'checkpoints'],
154 "Write checkpoints (intermediate tree topologies)."
155 ),
156
157 _Switch(['-k', 'bootstrap_branch_lengths'],
158 "Print bootstrapped trees with branch lengths. "
159 "The bootstraps will run a bit longer, because model "
160 "parameters will be optimized at the end of each run. "
161 "Use with CATMIX/PROTMIX or GAMMA/GAMMAI."
162 ),
163
164 _Option(['-l', 'cluster_threshold'],
165 "Threshold for sequence similarity clustering. "
166 "RAxML will then print out an alignment to a file "
167 "called sequenceFileName.reducedBy.threshold that "
168 "only contains sequences <= the specified threshold "
169 "that must be between 0.0 and 1.0. RAxML uses the "
170 "QT-clustering algorithm to perform this task. "
171 "In addition, a file called "
172 "RAxML_reducedList.outputFileName will be written "
173 "that contains clustering information.",
174 equate=False,
175 ),
176
177 _Option(['-L', 'cluster_threshold_fast'],
178 "Same functionality as '-l', but uses a less "
179 "exhaustive and thus faster clustering algorithm. "
180 "This is intended for very large datasets with more "
181 "than 20,000-30,000 sequences.",
182 equate=False,
183 ),
184
185 _Option(['-m', 'model'],
186 """Model of Nucleotide or Amino Acid Substitution:
187
188 NUCLEOTIDES:
189
190 GTRCAT : GTR + Optimization of substitution rates + Optimization of site-specific
191 evolutionary rates which are categorized into numberOfCategories distinct
192 rate categories for greater computational efficiency
193 if you do a multiple analysis with '-#' or '-N' but without bootstrapping the program
194 will use GTRMIX instead
195 GTRGAMMA : GTR + Optimization of substitution rates + GAMMA model of rate
196 heterogeneity (alpha parameter will be estimated)
197 GTRMIX : Inference of the tree under GTRCAT
198 and thereafter evaluation of the final tree topology under GTRGAMMA
199 GTRCAT_GAMMA : Inference of the tree with site-specific evolutionary rates.
200 However, here rates are categorized using the 4 discrete GAMMA rates.
201 Evaluation of the final tree topology under GTRGAMMA
202 GTRGAMMAI : Same as GTRGAMMA, but with estimate of proportion of invariable sites
203 GTRMIXI : Same as GTRMIX, but with estimate of proportion of invariable sites
204 GTRCAT_GAMMAI : Same as GTRCAT_GAMMA, but with estimate of proportion of invariable sites
205
206 AMINO ACIDS:
207
208 PROTCATmatrixName[F] : specified AA matrix + Optimization of substitution rates + Optimization of site-specific
209 evolutionary rates which are categorized into numberOfCategories distinct
210 rate categories for greater computational efficiency
211 if you do a multiple analysis with '-#' or '-N' but without bootstrapping the program
212 will use PROTMIX... instead
213 PROTGAMMAmatrixName[F] : specified AA matrix + Optimization of substitution rates + GAMMA model of rate
214 heterogeneity (alpha parameter will be estimated)
215 PROTMIXmatrixName[F] : Inference of the tree under specified AA matrix + CAT
216 and thereafter evaluation of the final tree topology under specified AA matrix + GAMMA
217 PROTCAT_GAMMAmatrixName[F] : Inference of the tree under specified AA matrix and site-specific evolutionary rates.
218 However, here rates are categorized using the 4 discrete GAMMA rates.
219 Evaluation of the final tree topology under specified AA matrix + GAMMA
220 PROTGAMMAImatrixName[F] : Same as PROTGAMMAmatrixName[F], but with estimate of proportion of invariable sites
221 PROTMIXImatrixName[F] : Same as PROTMIXmatrixName[F], but with estimate of proportion of invariable sites
222 PROTCAT_GAMMAImatrixName[F] : Same as PROTCAT_GAMMAmatrixName[F], but with estimate of proportion of invariable sites
223
224 Available AA substitution models: DAYHOFF, DCMUT, JTT, MTREV, WAG, RTREV, CPREV, VT, BLOSUM62, MTMAM, GTR
225 With the optional 'F' appendix you can specify if you want to use empirical base frequencies
226 Please not that for mixed models you can in addition specify the per-gene AA model in
227 the mixed model file (see manual for details)
228 """,
229 equate=False,
230 ),
231
232 _Switch(['-M', 'partition_branch_lengths'],
233 "Switch on estimation of individual per-partition "
234 "branch lengths. Only has effect when used in "
235 "combination with 'partition_filename' ('-q'). "
236 "Branch lengths for individual partitions will be "
237 "printed to separate files. A weighted average of the "
238 "branch lengths is computed by using the respective "
239 "partition lengths. "
240 ),
241
242 _Option(['-n', 'name'],
243 "Name used in the output files.",
244 filename=True,
245 equate=False,
246 ),
247
248 _Option(['-o', 'outgroup'],
249 "Name of a single outgroup or a comma-separated list "
250 "of outgroups, eg '-o Rat' or '-o Rat,Mouse'. In case "
251 "that multiple outgroups are not monophyletic the "
252 "first name in the list will be selected as outgroup. "
253 "Don't leave spaces between taxon names!",
254 checker_function=lambda x: len(x.split()) == 1,
255 equate=False,
256 ),
257
258 _Option(['-q', 'partition_filename'],
259 "File name containing the assignment of models to "
260 "alignment partitions for multiple models of "
261 "substitution. For the syntax of this file please "
262 "consult the RAxML manual.",
263 filename=True,
264 equate=False,
265 ),
266
267 _Option(['-p', 'parsimony_seed'],
268 "Random number seed for the parsimony inferences. "
269 "This allows you to reproduce your results and will "
270 "help developers debug the program. This option HAS "
271 "NO EFFECT in the parallel MPI version.",
272 equate=False,
273 ),
274
275 _Option(['-P', 'protein_model'],
276 "File name of a user-defined AA (Protein) substitution "
277 "model. This file must contain 420 entries, the first "
278 "400 being the AA substitution rates (this must be a "
279 "symmetric matrix) and the last 20 are the empirical "
280 "base frequencies.",
281 filename=True,
282 equate=False,
283 ),
284
285 _Option(['-r', 'binary_constraint'],
286 "File name of a binary constraint tree. "
287 "This tree does not need to be comprehensive, i.e. "
288 "contain all taxa.",
289 filename=True,
290 equate=False,
291 ),
292
293 _Option(['-s', 'sequences'],
294 "Name of the alignment data file, in PHYLIP format.",
295 filename=True,
296 equate=False,
297 ),
298
299 _Option(['-t', 'starting_tree'],
300 "File name of a user starting tree, in Newick format.",
301 filename=True,
302 equate=False,
303 ),
304
305 _Option(['-T', 'threads'],
306 "Number of threads to run. "
307 "PTHREADS VERSION ONLY! "
308 "Make sure to set this at most the number of CPUs "
309 "you have on your machine, otherwise, there will be "
310 "a huge performance decrease!",
311 equate=False,
312 ),
313
314 _Option(['-u', 'num_bootstrap_searches'],
315 "Number of multiple bootstrap searches per replicate. "
316 "Use this to obtain better ML trees for each "
317 "replicate. Default: 1 ML search per bootstrap "
318 "replicate.",
319 equate=False,
320 ),
321
322 _Switch(['-v', 'version'],
323 "Display version information."
324 ),
325
326 _Option(['-w', 'working_dir'],
327 "Name of the working directory where RAxML will "
328 "write its output files. Default: current directory.",
329 filename=True,
330 equate=False,
331 ),
332
333 _Option(['-x', 'rapid_bootstrap_seed'],
334 "Random seed for rapid bootstrapping.",
335 equate=False,
336 ),
337
338 _Switch(['-y', 'parsimony'],
339 "Only compute a parsimony starting tree, then exit."
340 ),
341
342 _Option(['-z', 'bipartition_filename'],
343 "Name of a file containing multiple trees, e.g. from "
344 "a bootstrap run, that shall be used to draw "
345 "bipartition values onto a tree provided with '-t'. "
346 "It can also be used to compute per-site log "
347 "likelihoods in combination with '-f g', and to read "
348 "a bunch of trees for a couple of other options "
349 "('-f h', '-f m', '-f n').",
350 filename=True,
351 equate=False,
352 ),
353
354 _Option(['-N', '-#', 'num_replicates'],
355 "Number of alternative runs on distinct starting trees. "
356 "In combination with the '-b' option, this will invoke a "
357 "multiple bootstrap analysis. "
358 "DEFAULT: 1 single analysis."
359 "Note that '-N' has been added as an alternative since "
360 "'-#' sometimes caused problems with certain MPI job "
361 "submission systems, since '-#' is often used to start "
362 "comments. "
363 ,
364 equate=False,
365 ),
366 ]
367 AbstractCommandline.__init__(self, cmd, **kwargs)
368
369 if not self.parsimony_seed:
370 self.parsimony_seed = 10000
371