-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ingest: Add optional Nextclade rules
Add rules for running Nextclade as a part of the ingest workflow. These rules are optional because not every pathogen will have a Nextclade dataset to be able to run Nextclade as a part of ingest.
- Loading branch information
1 parent
3493a93
commit 6c4b21d
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
This part of the workflow handles running Nextclade on the curated metadata | ||
and sequences. | ||
See Nextclade docs for more details on usage, inputs, and outputs if you would | ||
like to customize the rules: | ||
https://docs.nextstrain.org/projects/nextclade/en/stable/user/nextclade-cli.html | ||
""" | ||
DATASET_NAME = config["nextclade"]["dataset_name"] | ||
|
||
|
||
rule get_nextclade_dataset: | ||
"""Download Nextclade dataset""" | ||
output: | ||
dataset=f"data/nextclade_data/{DATASET_NAME}.zip", | ||
params: | ||
dataset_name=DATASET_NAME | ||
shell: | ||
""" | ||
nextclade dataset get \ | ||
--name={params.dataset_name:q} \ | ||
--output-zip={output.dataset} \ | ||
--verbose | ||
""" | ||
|
||
|
||
rule run_nextclade: | ||
input: | ||
dataset=f"data/nextclade_data/{DATASET_NAME}.zip", | ||
sequences="results/sequences.fasta", | ||
output: | ||
nextclade="results/nextclade.tsv", | ||
alignment="results/alignment.fasta", | ||
translations="results/translations.zip", | ||
params: | ||
# The lambda is used to deactivate automatic wildcard expansion. | ||
# https://github.com/snakemake/snakemake/blob/384d0066c512b0429719085f2cf886fdb97fd80a/snakemake/rules.py#L997-L1000 | ||
translations=lambda w: "results/translations/{gene}.fasta", | ||
shell: | ||
""" | ||
nextclade run \ | ||
{input.sequences} \ | ||
--input-dataset {input.dataset} \ | ||
--output-tsv {output.nextclade} \ | ||
--output-fasta {output.alignment} \ | ||
--output-translations {params.translations} | ||
zip -rj {output.translations} results/translations | ||
""" | ||
|