diff --git a/library/tasks/HISAT2.wdl b/library/tasks/HISAT2.wdl index 8498401b3..d4606a7d4 100644 --- a/library/tasks/HISAT2.wdl +++ b/library/tasks/HISAT2.wdl @@ -63,6 +63,8 @@ task HISAT2PairedEnd { # --seed to fix pseudo-random number and in order to produce deterministics results # --secondary reports secondary alignments for multimapping reads. -k 10 # searches for up to 10 primary alignments for each read + mkfifo samtools_pipe + samtools view -1 -h -o "${output_basename}_unsorted.bam" samtools_pipe & pid=$! hisat2 -t \ -x ${ref_name}/${ref_name} \ -1 $FQ1 \ @@ -74,7 +76,8 @@ task HISAT2PairedEnd { --seed 12345 \ -k 10 \ --secondary \ - -p ${cpu} -S >(samtools view -1 -h -o ${output_basename}_unsorted.bam) + -p ${cpu} -S samtools_pipe + wait $pid samtools sort -@ ${cpu} -O bam -o "${output_basename}.bam" "${output_basename}_unsorted.bam" samtools index "${output_basename}.bam" } @@ -158,6 +161,8 @@ task HISAT2RSEM { # with no-splice-alignment no-softclip no-mixed options on, HISAT2 will only output concordant alignment without soft-cliping # --rdg 99999999,99999999 and --rfg 99999999,99999999 will set an infinite penalty to alignments with indels. # As a result, alignments with gaps or deletions are excluded. + mkfifo samtools_pipe + samtools view -1 -h -o "${output_basename}.bam" samtools_pipe & pid=$! hisat2 -t \ -x ${ref_name}/${ref_name} \ -1 $FQ1 \ @@ -178,7 +183,8 @@ task HISAT2RSEM { --rfg 99999999,99999999 \ --no-spliced-alignment \ --seed 12345 \ - -p ${cpu} -S >(samtools view -1 -h -o ${output_basename}.bam) + -p ${cpu} -S samtools_pipe + wait $pid } runtime { @@ -243,6 +249,8 @@ input { fi # The parameters for this task are copied from the HISAT2PairedEnd task. + mkfifo samtools_pipe + samtools view -1 -h -o "${output_basename}_unsorted.bam" samtools_pipe & pid=$! hisat2 -t \ -x ~{ref_name}/~{ref_name} \ -U $FQ \ @@ -253,9 +261,11 @@ input { --seed 12345 \ -k 10 \ --secondary \ - -p ~{cpu} -S >(samtools view -1 -h -o ~{output_basename}_unsorted.bam) + -p ~{cpu} -S samtools_pipe + wait $pid samtools sort -@ ~{cpu} -O bam -o "~{output_basename}.bam" "~{output_basename}_unsorted.bam" samtools index "~{output_basename}.bam" + } runtime { @@ -375,6 +385,8 @@ task HISAT2RSEMSingleEnd { # with no-splice-alignment no-softclip no-mixed options on, HISAT2 will only output concordant alignment without soft-cliping # --rdg 99999999,99999999 and --rfg 99999999,99999999 will set an infinite penalty to alignments with indels. # As a result, alignments with gaps or deletions are excluded. + mkfifo samtools_pipe + samtools view -1 -h -o "${output_basename}.bam" samtools_pipe & pid=$! hisat2 -t \ -x ${ref_name}/${ref_name} \ -U $FQ \ @@ -394,7 +406,8 @@ task HISAT2RSEMSingleEnd { --rfg 99999999,99999999 \ --no-spliced-alignment \ --seed 12345 \ - -p ${cpu} -S >(samtools view -1 -h -o ${output_basename}.bam) + -p ${cpu} -S samtools_pipe + wait $pid } runtime {