Skip to content

Commit

Permalink
chore: more work on fasta ingest workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Nov 17, 2023
1 parent 90d2468 commit ab70fc1
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions bento_reference_service/workflows/wdls/ingest_fasta.wdl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version 1.0

workflow ingest_fasta {
input {
String genome_id
Expand All @@ -19,6 +21,16 @@ workflow ingest_fasta {
call ingest_into_drs as drs_fai {
input: file = s1.fai, access_token = access_token
}

call ingest_metadata_into_ref {
input:
fasta_bgzip = s1.fasta_bgzip,
fai = s1.fai,
fasta_drs_uri = drs_fasta.drs_uri,
fai_drs_uri = drs_fai.drs_uri,
reference_url = reference_url,
token = access_token
}
}

task generate_bgzipped_fasta_and_fai_if_needed {
Expand All @@ -44,22 +56,43 @@ task ingest_into_drs {
}
command <<<
TODO: ingest + output DRS Id
TODO: ingest + output DRS URI
>>>
output {
String drs_id = "TODO"
String drs_uri = "TODO"
}
}
task generate_metadata {
task ingest_metadata_into_ref {
input {
String fasta_bgzip
String fai
String fasta_drs_uri
String fai_drs_uri
String reference_url
String token
}
command <<<
fasta-checksum-utils genome.fa.gz --genome-id GRCh38 --out-format bento-json > metadata.json
fasta-checksum-utils genome.fa.gz --genome-id GRCh38 --out-format bento-json | \
jq '.fasta = "~{fasta_drs_uri}" | .fai = "~{fai_drs_uri}"' > metadata.json
RESPONSE=$(curl -X POST -k -s -w "%{http_code}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ~{token}" \
--data "@metadatajson" \
"~{reference_url}/genomes")
if [[ "${RESPONSE}" != "204" ]]
then
echo "Error: Reference service replied with ${RESPONSE}" 1>&2 # to stderr
exit 1
fi
echo ${RESPONSE}
>>>
output {
File genome = "genome.fa.gz"
File genome_index = "genome.fa.fai"
File metadata_json = "metadata.json"
String out = stdout()
String err = stderr()
}
}

0 comments on commit ab70fc1

Please sign in to comment.