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

bugfix output location of fasta in download_annotations; pass NCBI API key to tasks: download_fasta, download_annotations #481

Open
wants to merge 5 commits into
base: master
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
30 changes: 25 additions & 5 deletions pipes/WDL/tasks/tasks_ncbi.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,31 @@ task download_fasta {
String out_prefix
Array[String]+ accessions
String emailAddress
String apiKeyNCBI

String docker = "quay.io/broadinstitute/viral-phylo:2.1.20.2"
}

parameter_meta {
out_prefix: { description: "basename of the output fasta file. Will contain multiple sequences if multiple accessions are specified" }
accessions: { description: "accessions of sequences to download" }
apiKeyNCBI: { description: "NCBI API key for more frequent requests; see: https://support.nlm.nih.gov/knowledgebase/article/KA-05317/en-us" }
}

command {
ncbi.py --version | tee VERSION
mkdir -p combined
ncbi.py fetch_fastas \
--combinedFilePrefix "tmp.${out_prefix}" \
~{'--api_key ' + apiKeyNCBI} \
${emailAddress} \
. \
${sep=' ' accessions} \
--combinedFilePrefix ${out_prefix} \
${sep=' ' accessions}
mv "tmp.${out_prefix}.fasta" "combined/${out_prefix}.fasta"
}

output {
File sequences_fasta = "${out_prefix}.fasta"
File sequences_fasta = "combined/${out_prefix}.fasta"
String viralngs_version = read_string("VERSION")
}

Expand All @@ -36,27 +46,37 @@ task download_annotations {
input {
Array[String]+ accessions
String emailAddress
String apiKeyNCBI
String combined_out_prefix

String docker = "quay.io/broadinstitute/viral-phylo:2.1.20.2"
}

parameter_meta {
combined_out_prefix: { description: "basename of the output fasta file. Will contain multiple sequences if multiple accessions are specified" }
accessions: { description: "accessions for which sequences and feature tables will be downloaded" }
apiKeyNCBI: { description: "NCBI API key for more frequent requests; see: https://support.nlm.nih.gov/knowledgebase/article/KA-05317/en-us" }
}

command <<<
set -ex -o pipefail
ncbi.py --version | tee VERSION
ncbi.py fetch_feature_tables \
~{'--api_key ' + apiKeyNCBI} \
~{emailAddress} \
./ \
~{sep=' ' accessions} \
--loglevel DEBUG
mkdir -p combined
ncbi.py fetch_fastas \
--combinedFilePrefix "temp.~{combined_out_prefix}" \
~{'--api_key ' + apiKeyNCBI} \
--forceOverwrite \
~{emailAddress} \
./ \
~{sep=' ' accessions} \
--combinedFilePrefix "combined/~{combined_out_prefix}" \
--forceOverwrite \
--loglevel DEBUG
mv "temp.~{combined_out_prefix}.fasta" "combined/~{combined_out_prefix}.fasta"
>>>

output {
Expand Down
Loading