From f2f7411a7b32bda18bba6eb8ee83606fa635f9e0 Mon Sep 17 00:00:00 2001
From: JasperBoom <jboom@infernum.nl>
Date: Tue, 15 Jun 2021 12:43:37 +0200
Subject: [PATCH] Add directory creation to samtools fastq.

---
 CHANGELOG.md | 3 +--
 samtools.wdl | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11a92d8..e724269 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,8 +10,7 @@ that users understand how the changes affect the new version.
 
 version 5.0.0-dev
 ---------------------------
-+ Change the way localization of the input bam files and index are handled
-  in the bam2fastx tasks.
++ Samtools: Add mkdir line to `Fastq` task.
 + Add new parameters from CCS version 6.0.0 and add two new outputs:
   `ccs_report.txt` & `zmw_metrics.json.gz`.
 + Change CutAdapt memory to `5G`.
diff --git a/samtools.wdl b/samtools.wdl
index 9042a0d..46d1eb7 100644
--- a/samtools.wdl
+++ b/samtools.wdl
@@ -122,6 +122,8 @@ task Fastq {
     }
 
     command {
+        set -e
+        mkdir -p "$(dirname ~{outputRead1})"
         samtools fastq \
         ~{true="-1" false="-s" defined(outputRead2)} ~{outputRead1} \
         ~{"-2 " + outputRead2} \
-- 
GitLab