From e4df02fb3bb0ff2b76039ed82d9ddeb4099802ff Mon Sep 17 00:00:00 2001 From: Sarah Wait Zaranek Date: Tue, 16 Jun 2020 01:40:20 +0000 Subject: [PATCH] Adding code to get fastqs from directory Arvados-DCO-1.1-Signed-off-by: Sarah Wait Zaranek no issue # --- cwl/helper/getfastq.cwl | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 cwl/helper/getfastq.cwl diff --git a/cwl/helper/getfastq.cwl b/cwl/helper/getfastq.cwl new file mode 100644 index 0000000..a38bc91 --- /dev/null +++ b/cwl/helper/getfastq.cwl @@ -0,0 +1,49 @@ +$namespaces: + arv: "http://arvados.org/cwl#" + cwltool: "http://commonwl.org/cwltool#" +class: ExpressionTool +cwlVersion: v1.1 +label: Create array of gvcfs to process +requirements: + InlineJavascriptRequirement: {} +inputs: + fastjdir: + type: Directory + label: Input directory of fastj + loadListing: 'shallow_listing' +outputs: + fastq1: + type: File[] + fastq2: + type: File[] +expression: | + ${function compare(a, b) { + var baseA = a.basename; + var baseB = b.basename; + + var comparison = 0; + if (baseA > baseB) { + comparison = 1; + } else if (baseA < baseB) { + comparison = -1; + } + return comparison; + } + + var fastq1 = []; + var fastq2 = []; + for (var i = 0; i < inputs.fastjdir.listing.length; i++) { + var name = inputs.fastjdir.listing[i]; + if (name.basename.indexOf('_1.fastq.gz') != -1 ) { + fastq1.push(name); + } + if (name.basename.indexOf('_2.fastq.gz') != -1 ) { + fastq2.push(name); + } + } + + fastq1 = fastq1.sort(compare) + fastq2 = fastq2.sort(compare) + + return {"fastq1": fastq1, "fastq2": fastq2}; + } -- 2.30.2