Skip to content

Commit 8c4e6a3

Browse files
committed
Set threads for augur subsample
Take advantage of built-in parallelism.
1 parent 49bce21 commit 8c4e6a3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

phylogenetic/rules/prepare_sequences.smk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This part of the workflow prepares sequences for constructing the phylogenetic t
33
44
See Augur's usage docs for these commands for more details.
55
"""
6-
from augur.subsample import get_referenced_files
6+
from augur.subsample import get_referenced_files, get_parallelism
77

88
rule filter:
99
"""
@@ -22,13 +22,15 @@ rule filter:
2222
sequences = "results/genome/filtered.fasta"
2323
params:
2424
strain_id = config["strain_id_field"]
25+
threads: lambda w, input: get_parallelism(input.config, limit=workflow.cores)
2526
shell:
2627
"""
2728
augur subsample \
2829
--config {input.config} \
2930
--sequences {input.sequences} \
3031
--metadata {input.metadata} \
3132
--metadata-id-columns {params.strain_id} \
33+
--nthreads {threads} \
3234
--output-sequences {output.sequences} \
3335
"""
3436

phylogenetic/rules/prepare_sequences_N450.smk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This part of the workflow prepares sequences for constructing the phylogenetic t
33
44
See Augur's usage docs for these commands for more details.
55
"""
6-
from augur.subsample import get_referenced_files
6+
from augur.subsample import get_referenced_files, get_parallelism
77

88
rule align_and_extract_N450:
99
input:
@@ -42,12 +42,14 @@ rule filter_N450:
4242
sequences = "results/N450/aligned.fasta"
4343
params:
4444
strain_id = config["strain_id_field"]
45+
threads: lambda w, input: get_parallelism(input.config, limit=workflow.cores)
4546
shell:
4647
"""
4748
augur subsample \
4849
--config {input.config} \
4950
--sequences {input.sequences} \
5051
--metadata {input.metadata} \
5152
--metadata-id-columns {params.strain_id} \
53+
--nthreads {threads} \
5254
--output-sequences {output.sequences} \
5355
"""

0 commit comments

Comments
 (0)