Skip to content

Commit

Permalink
Convert triple-quoted shell commands to "raw" style [#39]
Browse files Browse the repository at this point in the history
  • Loading branch information
genehack committed Aug 22, 2024
1 parent bde1ef2 commit d1f4146
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions ingest/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ else:
output:
metadata="results/{virus}/metadata.tsv",
shell:
"""
r"""
mv {input.metadata:q} {output.metadata:q}
"""

Expand All @@ -42,7 +42,7 @@ rule clean:
"results",
]
shell:
"""
r"""
rm -rfv {params.targets}
"""

Expand Down
2 changes: 1 addition & 1 deletion ingest/build-configs/nextstrain-automation/upload.smk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rule upload_to_s3:
s3_dst=config["s3_dst"],
cloudfront_domain=config["cloudfront_domain"],
shell:
"""
r"""
./vendored/upload-to-s3 \
{params.quiet} \
{input.file_to_upload:q} \
Expand Down
8 changes: 4 additions & 4 deletions ingest/rules/curate.smk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rule fetch_general_geolocation_rules:
params:
geolocation_rules_url=config["curate"]["geolocation_rules_url"],
shell:
"""
r"""
curl {params.geolocation_rules_url:q} \
> {output.general_geolocation_rules:q} \
2> {log:q}
Expand All @@ -39,7 +39,7 @@ rule concat_geolocation_rules:
benchmark:
"benchmarks/concat_geolocation_rules.txt"
shell:
"""
r"""
cat {input.general_geolocation_rules:q} {input.local_geolocation_rules:q} \
> {output.all_geolocation_rules:} \
2> {log:q}
Expand Down Expand Up @@ -89,7 +89,7 @@ rule curate:
sequence_field=config["curate"]["output_sequence_field"],
shell:
# note: params.field_map intentionally not quoted
"""
r"""
(
cat {input.sequences_ndjson:q} \
| augur curate rename \
Expand Down Expand Up @@ -133,7 +133,7 @@ rule subset_metadata:
params:
metadata_fields=",".join(config["curate"]["metadata_columns"]),
shell:
"""
r"""
tsv-select -H -f {params.metadata_fields:q} \
{input.metadata:q} \
> {output.subset_metadata:q} \
Expand Down
8 changes: 4 additions & 4 deletions ingest/rules/fetch_from_ncbi.smk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rule fetch_ncbi_dataset_package:
benchmark:
"benchmarks/{virus}/fetch_ncbi_dataset_package.txt"
shell:
"""
r"""
datasets download virus genome taxon {params.ncbi_taxon_id:q} \
--no-progressbar \
--filename {output.dataset_package:q} \
Expand All @@ -35,7 +35,7 @@ rule extract_ncbi_dataset_sequences:
benchmark:
"benchmarks/{virus}/extract_ncbi_dataset_sequences.txt"
shell:
"""
r"""
unzip -jp {input.dataset_package:q} \
ncbi_dataset/data/genomic.fna \
> {output.ncbi_dataset_sequences:q} \
Expand Down Expand Up @@ -88,7 +88,7 @@ rule format_ncbi_dataset_report:
benchmark:
"benchmarks/{virus}/format_ncbi_dataset_report.txt"
shell:
"""
r"""
dataformat tsv virus-genome \
--package {input.dataset_package:q} \
--fields {params.fields_to_include:q} \
Expand All @@ -112,7 +112,7 @@ rule format_ncbi_datasets_ndjson:
benchmark:
"benchmarks/{virus}/format_ncbi_datasets_ndjson.txt"
shell:
"""
r"""
augur curate passthru \
--metadata {input.ncbi_dataset_tsv:q} \
--fasta {input.ncbi_dataset_sequences:q} \
Expand Down
2 changes: 1 addition & 1 deletion phylogenetic/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ rule clean:
"results",
]
shell:
"""
r"""
rm -rfv {params.targets}
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ rule deploy_all:
params:
deploy_url=config["deploy_url"],
shell:
"""
r"""
nextstrain remote upload {params.deploy_url} {input}
"""
4 changes: 2 additions & 2 deletions phylogenetic/rules/annotate_phylogeny.smk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rule ancestral:
params:
inference=lambda wildcards: config[wildcards.virus]["annotate_phylogeny"]["inference"],
shell:
"""
r"""
augur ancestral \
--tree {input.tree:q} \
--alignment {input.alignment:q} \
Expand All @@ -43,7 +43,7 @@ rule translate:
benchmark:
"benchmarks/{virus}/translate.txt"
shell:
"""
r"""
augur translate \
--tree {input.tree:q} \
--ancestral-sequences {input.node_data:q} \
Expand Down
4 changes: 2 additions & 2 deletions phylogenetic/rules/construct_phylogeny.smk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rule tree:
benchmark:
"benchmarks/{virus}/tree.txt"
shell:
"""
r"""
augur tree \
--alignment {input.alignment:q} \
--output {output.tree:q} \
Expand Down Expand Up @@ -46,7 +46,7 @@ rule refine:
clock_filter_iqd=lambda wildcards: config[wildcards.virus]["construct_phylogeny"]["clock_filter_iqd"],
shell:
# TODO move this conditional logic up into the params lambda (?)
"""
r"""
(
if [ "{wildcards.virus}" == "229e" ] || [ "{wildcards.virus}" == "oc43" ]; then
echo "Estimating clock rate for {wildcards.virus}"
Expand Down
2 changes: 1 addition & 1 deletion phylogenetic/rules/export.smk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rule export:
benchmark:
"benchmarks/{virus}/export.txt"
shell:
"""
r"""
augur export v2 \
--tree {input.tree:q} \
--metadata {input.metadata:q} \
Expand Down
8 changes: 4 additions & 4 deletions phylogenetic/rules/prepare_sequences.smk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rule download:
sequences_url="https://data.nextstrain.org/files/workflows/seasonal-cov/{virus}/sequences.fasta.zst",
metadata_url="https://data.nextstrain.org/files/workflows/seasonal-cov/{virus}/metadata.tsv.zst",
shell:
"""
r"""
curl -fsSL --compressed {params.sequences_url:q} --output {output.sequences}
curl -fsSL --compressed {params.metadata_url:q} --output {output.metadata}
"""
Expand All @@ -33,7 +33,7 @@ rule decompress:
sequences="data/{virus}/sequences.fasta",
metadata="data/{virus}/metadata.tsv",
shell:
"""
r"""
zstd -d -c {input.sequences} > {output.sequences}
zstd -d -c {input.metadata} > {output.metadata}
"""
Expand All @@ -55,7 +55,7 @@ rule filter:
subsample_max_sequences=lambda wildcards: config[wildcards.virus]["prepare_sequences"]["subsample_max_sequences"],
min_length=lambda wildcards: config[wildcards.virus]["prepare_sequences"]["min_length"],
shell:
"""
r"""
augur filter \
--sequences {input.sequences:q} \
--metadata {input.metadata:q} \
Expand All @@ -82,7 +82,7 @@ rule align:
benchmark:
"benchmarks/{virus}/align.txt"
shell:
"""
r"""
(
nextclade run \
--input-ref {input.reference:q} \
Expand Down

0 comments on commit d1f4146

Please sign in to comment.