Skip to content

Commit c30ba2c

Browse files
committed
Add seed param to IQTREE rules
Also updates the style of the shell directive and adds -nm where relevant
1 parent 245ba23 commit c30ba2c

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

workflow/rules/asr.smk

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ rule reconstruct_ancestral_sequence:
22
threads: 4
33
conda: "../envs/iqtree.yaml"
44
params:
5+
seed = 7291,
56
seqtype = "DNA",
67
name = OUTPUT_NAME,
78
outgroup = config["ALIGNMENT_REFERENCE"],
@@ -14,13 +15,11 @@ rule reconstruct_ancestral_sequence:
1415
log:
1516
LOGDIR / "reconstruct_ancestral_sequence" / "log.txt"
1617
shell:
17-
"""
18-
mkdir -p {output.folder}
19-
iqtree2 \
20-
-asr \
21-
-o {params.outgroup} -T AUTO --threads-max {threads} -s {input.fasta} \
22-
--seqtype {params.seqtype} -m {params.model} --prefix {output.folder}/{params.name} >{log} 2>&1
23-
"""
18+
"mkdir -p {output.folder} && "
19+
"iqtree2 -seed {params.seed} "
20+
"-asr "
21+
"-o {params.outgroup} -T AUTO --threads-max {threads} -s {input.fasta} "
22+
"--seqtype {params.seqtype} -m {params.model} --prefix {output.folder}/{params.name} >{log} 2>&1"
2423

2524

2625
rule ancestor_fasta:

workflow/rules/context.smk

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ rule ml_context_tree:
7474
conda: "../envs/iqtree.yaml"
7575
shadow: "shallow"
7676
params:
77+
seed = 7291,
7778
seqtype = "DNA",
7879
name = OUTPUT_NAME,
7980
ufboot = config["UFBOOT"]["REPS"],
8081
alrt = config["SHALRT"]["REPS"],
8182
outgroup = config["ALIGNMENT_REFERENCE"],
82-
model = config["TREE_MODEL"]
83+
model = config["TREE_MODEL"],
84+
max_iterations_convergence = 1000,
8385
input:
8486
fasta = OUTDIR/"nextalign"/f"{OUTPUT_NAME}.aligned.masked.fasta",
8587
outgroup_aln = OUTDIR/"context"/"nextalign"/"context_sequences.aligned.masked.fasta"
@@ -89,14 +91,11 @@ rule ml_context_tree:
8991
log:
9092
LOGDIR / "ml_context_tree" / "log.txt"
9193
shell:
92-
"""
93-
exec >{log}
94-
exec 2>&1
95-
96-
awk '/^>/{{p=seen[$0]++}}!p' {input.fasta} {input.outgroup_aln} > aln.fasta
97-
mkdir -p {output.folder}
98-
iqtree2 \
99-
-B {params.ufboot} -alrt {params.alrt} \
100-
-o {params.outgroup} -T AUTO --threads-max {threads} -s aln.fasta \
101-
--seqtype {params.seqtype} -m {params.model} --prefix {output.folder}/{params.name}
102-
"""
94+
"exec >{log} && exec 2>&1; "
95+
"awk '/^>/{{p=seen[$0]++}}!p' {input.fasta} {input.outgroup_aln} >aln.fasta && "
96+
"mkdir -p {output.folder} && "
97+
"iqtree2 -seed {params.seed} "
98+
"-bb {params.ufboot} -alrt {params.alrt} "
99+
"-o {params.outgroup} -T AUTO --threads-max {threads} -s aln.fasta "
100+
"-nm {params.max_iterations_convergence} "
101+
"--seqtype {params.seqtype} -m {params.model} --prefix {output.folder}/{params.name}"

0 commit comments

Comments
 (0)