Skip to content

Commit

Permalink
TheiaCoV_ONT_PHB Influenza Track (#233)
Browse files Browse the repository at this point in the history
* adding flu ont task

* update input JSON "read1" instead of "demultiplexed_reads"

* updated irma docker image to v1.1.3

* added seq_method as input to irma task
  • Loading branch information
jrotieno authored Nov 21, 2023
1 parent 5fc24ee commit ac7ba44
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 67 deletions.
27 changes: 17 additions & 10 deletions tasks/assembly/task_irma.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ version 1.0
task irma {
input {
File read1
File read2
File? read2
String seq_method
String samplename
Boolean keep_ref_deletions = true
String irma_module = "FLU"
String read_basename = basename(read1)
String docker = "us-docker.pkg.dev/general-theiagen/staphb/irma:1.0.3"
String docker = "cdcgov/irma:v1.1.3"
Int memory = 8
Int cpu = 4
Int disk_size = 100
Expand All @@ -17,7 +17,9 @@ task irma {
date | tee DATE
#capture reads as bash variables
read1=~{read1}
read2=~{read2}
if [[ "~{read2}" ]]; then
read2=~{read2}
fi
# set cat command based on compression
if [[ "~{read1}" == *".gz" ]] ; then
cat_reads="zcat"
Expand All @@ -38,15 +40,20 @@ task irma {
echo "Read headers may lead to IRMA failure; reformatting to meet IRMA input requirements"
sra_id=$(echo "~{read_basename}" | awk -F "_" '{ print $1 }')
eval "${cat_reads} ~{read1}" | awk '{print (NR%4 == 1) ? "@'${sra_id}'-" ++i " 1:1" : $0}' | gzip -c > "${sra_id}-irmafix_R1.fastq.gz"
eval "${cat_reads} ~{read2}" | awk '{print (NR%4 == 1) ? "@'${sra_id}'-" ++i " 2:2" : $0}' | gzip -c > "${sra_id}-irmafix_R2.fastq.gz"
#modify read variables
read1="${sra_id}-irmafix_R1.fastq.gz"
read2="${sra_id}-irmafix_R2.fastq.gz"
if [[ "~{read2}" ]]; then
eval "${cat_reads} ~{read2}" | awk '{print (NR%4 == 1) ? "@'${sra_id}'-" ++i " 2:2" : $0}' | gzip -c > "${sra_id}-irmafix_R2.fastq.gz"
read2="${sra_id}-irmafix_R2.fastq.gz"
fi
else
echo "Read headers match IRMA formatting requirements"
fi
# run IRMA
IRMA "~{irma_module}" "${read1}" "${read2}" ~{samplename}
# set IRMA module depending on sequencing technology
if [[ ~{seq_method} == "OXFORD_NANOPORE" ]]; then
IRMA "FLU-minion" "${read1}" ~{samplename}
else
IRMA "FLU" "${read1}" "${read2}" ~{samplename}
fi
# capture IRMA type
if compgen -G "~{samplename}/*fasta"; then
echo "Type_"$(basename "$(echo "$(find ~{samplename}/*.fasta | head -n1)")" | cut -d_ -f1) > IRMA_TYPE
Expand Down Expand Up @@ -102,4 +109,4 @@ task irma {
maxRetries: 3
preemptible: 0
}
}
}
2 changes: 1 addition & 1 deletion tests/inputs/theiacov/wf_theiacov_ont.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"theiacov_ont.samplename": "ont",
"theiacov_ont.demultiplexed_reads": "tests/data/theiacov/fastqs/ont/ont.fastq.gz",
"theiacov_ont.read1": "tests/data/theiacov/fastqs/ont/ont.fastq.gz",
"theiacov_ont.primer_bed": "tests/data/theiacov/primers/artic-v3.primers.bed"
}
1 change: 1 addition & 0 deletions workflows/theiacov/wf_theiacov_illumina_pe.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ workflow theiacov_illumina_pe {
read1 = read_QC_trim.read1_clean,
read2 = read_QC_trim.read2_clean,
samplename = samplename,
seq_method = seq_method
}
if (defined(irma.irma_assemblies)) {
call abricate.abricate_flu {
Expand Down
Loading

0 comments on commit ac7ba44

Please sign in to comment.