Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove automatic Nextclade dataset updates and improve provenance tracking #38

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions modules/clade_calling.nf
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,27 @@ process clade_calling {

script:
"""
printf -- "process_name: nextclade\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- "tools:\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " - tool_name: nextclade\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " tool_version: \$(nextclade --version 2>&1 | cut -d ' ' -f 2)\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " subcommand: run\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- "- process_name: nextclade\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " tools:\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " - tool_name: nextclade\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " tool_version: \$(nextclade --version 2>&1 | cut -d ' ' -f 2)\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " subcommand: run\\n" >> ${sample_id}_clade_calling_provenance.yml


if [ `grep "H1" ${ha_consensus_seq}` ]; then
if [ ${params.h1_dataset} == "NO_FILE" ]; then
dataset="flu_h1n1pdm_ha"
nextclade dataset get --name \$dataset --output-dir \$dataset
echo "WARNING: H1 subtype detected in the HA consensus file, but no H1 dataset provided. Please provide an H1 nextclade dataset with the --h1_dataset flag."
exit 10
else
dataset=${params.h1_dataset}
fi
dataset=${params.h1_dataset}
fi
elif [ `grep "H3" ${ha_consensus_seq}` ]; then
if [ ${params.h3_dataset} == "NO_FILE" ]; then
dataset="flu_h3n2_ha"
nextclade dataset get --name \$dataset --output-dir \$dataset
echo "WARNING: H3 subtype detected in the HA consensus file, but no H3 dataset provided. Please provide an H3 nextclade dataset with the --h3_dataset flag."
exit 10
else
dataset=${params.h3_dataset}
fi
dataset=${params.h3_dataset}
fi
elif [ `grep "H5" ${ha_consensus_seq}` ]; then
if [ ${params.h5_dataset} == "NO_FILE" ]; then
echo "WARNING: H5 subtype detected in the HA consensus file, but no H5 dataset provided. Please provide an H5 nextclade dataset with the --h5_dataset flag."
Expand All @@ -46,12 +47,18 @@ process clade_calling {
dataset=${params.h5_dataset}
fi
else
echo "WARNING: None of H1, H3, or H5 were detected in the HA consensus file. No dataset available. Exiting."
echo "WARNING: None of H1, H3, or H5 were detected in the HA consensus file. Exiting."
exit 10
fi

printf -- " databases:\\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " - database_name: \$(grep 'dbname' \${dataset}/metadata.json | cut -d'\"' -f4) \\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " database_path: \${dataset} \\n" >> ${sample_id}_clade_calling_provenance.yml
printf -- " database_sha256: \$(sha256sum \${dataset}/tree.json | cut -d' ' -f1) \\n" >> ${sample_id}_clade_calling_provenance.yml


nextclade run \
--input-dataset \$dataset \
--input-dataset \$dataset \
--output-fasta=${sample_id}_nextclade.aligned.fasta.gz \
--output-json=${sample_id}_nextclade.json \
--output-ndjson=${sample_id}_nextclade.ndjson \
Expand Down