Skip to content

Commit 9a2ca57

Browse files
committed
Move downloaded Nextclade executable to data/nextclade
Avoids clash of downloaded Nextclade executable with the Nextclade command available in the environment. Includes the side-effect of the downloaded executable being removed as part of `bin/clean` when running the workflow without the `keep_all_files=True` config param. This ensures that the workflow will start from a clean slate.
1 parent 6c6a4ff commit 9a2ca57

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

workflow/snakemake_rules/nextclade.smk

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if config.get("s3_dst") and config.get("s3_src"):
6565

6666
rule use_nextclade_cache:
6767
input:
68-
nextclade="./nextclade",
68+
nextclade="data/nextclade",
6969
nextclade_dataset=lambda w: f"data/nextclade_data/sars-cov-2{w.reference.replace('_','-')}.zip",
7070
params:
7171
dst_source=config["s3_dst"],
@@ -166,40 +166,40 @@ rule get_sequences_without_nextclade_annotations:
166166
rule download_nextclade_executable:
167167
"""Download Nextclade"""
168168
output:
169-
nextclade="nextclade",
169+
nextclade="data/nextclade",
170170
benchmark:
171171
f"benchmarks/download_nextclade_executable_{database}.txt"
172172
shell:
173173
"""
174174
if [ "$(uname)" = "Darwin" ]; then
175-
curl -fsSL "https://github.com/nextstrain/nextclade/releases/latest/download/nextclade-x86_64-apple-darwin" -o "nextclade"
175+
curl -fsSL "https://github.com/nextstrain/nextclade/releases/latest/download/nextclade-x86_64-apple-darwin" -o {output.nextclade:q}
176176
177177
else
178-
curl -fsSL "https://github.com/nextstrain/nextclade/releases/latest/download/nextclade-x86_64-unknown-linux-gnu" -o "nextclade"
178+
curl -fsSL "https://github.com/nextstrain/nextclade/releases/latest/download/nextclade-x86_64-unknown-linux-gnu" -o {output.nextclade:q}
179179
fi
180-
chmod +x nextclade
180+
chmod +x {output.nextclade:q}
181181
182-
if ! command -v ./nextclade &>/dev/null; then
182+
if ! command -v {output.nextclade:q} &>/dev/null; then
183183
echo "[ERROR] Nextclade executable not found"
184184
exit 1
185185
fi
186186
187-
NEXTCLADE_VERSION="$(./nextclade --version)"
187+
NEXTCLADE_VERSION="$({output.nextclade:q} --version)"
188188
echo "[ INFO] Nextclade version: $NEXTCLADE_VERSION"
189189
"""
190190

191191

192192
rule download_nextclade_dataset:
193193
"""Download Nextclade dataset"""
194194
input:
195-
"nextclade",
195+
nextclade="data/nextclade",
196196
output:
197197
dataset="data/nextclade_data/{dataset_name}.zip",
198198
benchmark:
199199
f"benchmarks/download_nextclade_dataset_{database}_{{dataset_name}}.txt"
200200
shell:
201201
"""
202-
./nextclade dataset get --name="{wildcards.dataset_name}" --output-zip={output.dataset} --verbose
202+
{input.nextclade:q} dataset get --name="{wildcards.dataset_name}" --output-zip={output.dataset} --verbose
203203
"""
204204

205205

@@ -210,7 +210,7 @@ rule run_wuhan_nextclade:
210210
metrics which will ultimately end up in metadata.tsv.
211211
"""
212212
input:
213-
nextclade_path="nextclade",
213+
nextclade_path="data/nextclade",
214214
dataset="data/nextclade_data/sars-cov-2.zip",
215215
sequences=f"data/{database}/nextclade.sequences.fasta",
216216
params:
@@ -245,7 +245,7 @@ rule run_21L_nextclade:
245245
Like wuhan nextclade, but TSV only, no alignments output
246246
"""
247247
input:
248-
nextclade_path="nextclade",
248+
nextclade_path="data/nextclade",
249249
dataset=lambda w: f"data/nextclade_data/sars-cov-2-21L.zip",
250250
sequences=f"data/{database}/nextclade_21L.sequences.fasta",
251251
output:
@@ -266,6 +266,7 @@ rule run_21L_nextclade:
266266

267267
rule nextclade_tsv_concat_versions:
268268
input:
269+
nextclade="data/nextclade",
269270
tsv=f"data/{database}/nextclade{{reference}}_new_raw.tsv",
270271
dataset=lambda w: f"data/nextclade_data/sars-cov-2{w.reference.replace('_','-')}.zip",
271272
output:
@@ -276,7 +277,7 @@ rule nextclade_tsv_concat_versions:
276277
"""
277278
if [ -s {input.tsv} ]; then
278279
# Get version numbers
279-
nextclade_version="$(./nextclade --version)"
280+
nextclade_version="$({input.nextclade:q} --version)"
280281
dataset_version="$(unzip -p {input.dataset} pathogen.json | jq -r '.version.tag')"
281282
timestamp="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
282283

0 commit comments

Comments
 (0)