From 43c627f3dcc8e2b480c55eb597a7490aa1d8cb88 Mon Sep 17 00:00:00 2001 From: Ari Frantz Date: Thu, 19 Feb 2026 14:22:41 -0500 Subject: [PATCH 1/2] make strandedness optional --- workflows/rnaseq/rnaseq-core.wdl | 19 +++++++++--------- workflows/rnaseq/rnaseq-standard-fastq.wdl | 20 +++++++++---------- workflows/rnaseq/rnaseq-standard.wdl | 23 +++++++++++----------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/workflows/rnaseq/rnaseq-core.wdl b/workflows/rnaseq/rnaseq-core.wdl index b5d088317..3128c285a 100644 --- a/workflows/rnaseq/rnaseq-core.wdl +++ b/workflows/rnaseq/rnaseq-core.wdl @@ -132,7 +132,7 @@ workflow rnaseq_core { Array[File] read_one_fastqs_gz Array[File] read_two_fastqs_gz Array[String] read_groups - String strandedness + String? strandedness Boolean enable_read_trimming Boolean mark_duplicates Boolean cleanse_xenograft @@ -162,15 +162,15 @@ workflow rnaseq_core { Int chim_score_drop_max = 30 } - Map[String, String] htseq_strandedness_mapping = { + Map[String?, String] htseq_strandedness_mapping = { "Stranded-Reverse": "reverse", "Stranded-Forward": "yes", "Unstranded": "no", "Inconclusive": "undefined", # THIS WILL ERRROR (intentional) - "": "undefined", + None: "undefined", } - String provided_strandedness = strandedness + String? provided_strandedness = strandedness scatter (fq in read_one_fastqs_gz) { String read_one_names = basename(fq) @@ -253,7 +253,7 @@ workflow rnaseq_core { } String htseq_strandedness = ( - if (provided_strandedness != "") + if defined(provided_strandedness) then htseq_strandedness_mapping[provided_strandedness] else htseq_strandedness_mapping[ngsderive_strandedness.strandedness_string] ) @@ -263,11 +263,10 @@ workflow rnaseq_core { gtf, strandedness = htseq_strandedness, prefix = basename(alignment_post.processed_bam, "bam") - + ( - if provided_strandedness == "" - then ngsderive_strandedness.strandedness_string - else provided_strandedness - ), + + select_first([ + provided_strandedness, + ngsderive_strandedness.strandedness_string + ]), pos_sorted = true, } diff --git a/workflows/rnaseq/rnaseq-standard-fastq.wdl b/workflows/rnaseq/rnaseq-standard-fastq.wdl index dee188b10..2556212e7 100644 --- a/workflows/rnaseq/rnaseq-standard-fastq.wdl +++ b/workflows/rnaseq/rnaseq-standard-fastq.wdl @@ -36,6 +36,15 @@ workflow rnaseq_standard_fastq { warning: "See `data_structures/read_group.wdl` for more information and help formatting your input JSON.", } contaminant_db: "A compressed reference database corresponding to the aligner chosen with `xenocp_aligner` for the contaminant genome" + strandedness: { + description: "Strandedness protocol of the RNA-Seq experiment. If unspecified, strandedness will be inferred by `ngsderive`.", + choices: [ + "", + "Stranded-Reverse", + "Stranded-Forward", + "Unstranded", + ], + } prefix: { description: "Prefix for output files", help: "See `../../README.md` for more information on the default prefix evaluation.", @@ -49,15 +58,6 @@ workflow rnaseq_standard_fastq { "star", ], } - strandedness: { - description: "Strandedness protocol of the RNA-Seq experiment. If unspecified, strandedness will be inferred by `ngsderive`.", - choices: [ - "", - "Stranded-Reverse", - "Stranded-Forward", - "Unstranded", - ], - } enable_read_trimming: "Enable read trimming with `fastp`?" mark_duplicates: "Add SAM flag to computationally determined duplicate reads?" cleanse_xenograft: "Use XenoCP to unmap reads from contaminant genome?" @@ -73,13 +73,13 @@ workflow rnaseq_standard_fastq { Array[File] read_two_fastqs_gz Array[ReadGroup] read_groups File? contaminant_db + String? strandedness String prefix = sub( basename(read_one_fastqs_gz[0]), "(([_.][rR](?:ead)?[12])((?:[_.-][^_.-]*?)*?))?\\.(fastq|fq)(\\.gz)?$", "" # Once replacing with capturing groups is supported, replace with group 3 ) String xenocp_aligner = "star" - String strandedness = "" Boolean enable_read_trimming = false Boolean mark_duplicates = false Boolean cleanse_xenograft = false diff --git a/workflows/rnaseq/rnaseq-standard.wdl b/workflows/rnaseq/rnaseq-standard.wdl index edac26733..a1fa7d634 100755 --- a/workflows/rnaseq/rnaseq-standard.wdl +++ b/workflows/rnaseq/rnaseq-standard.wdl @@ -31,15 +31,6 @@ workflow rnaseq_standard { gtf: "Gzipped GTF feature file" star_db: "Database of reference files for the STAR aligner. Can be generated by `star-db-build.wdl`" contaminant_db: "A compressed reference database corresponding to the aligner chosen with `xenocp_aligner` for the contaminant genome" - prefix: "Prefix for output files" - xenocp_aligner: { - description: "Aligner to use to map reads to the host genome for detecting contamination", - choices: [ - "bwa aln", - "bwa mem", - "star", - ], - } strandedness: { description: "Strandedness protocol of the RNA-Seq experiment. If unspecified, strandedness will be inferred by `ngsderive`.", choices: [ @@ -49,6 +40,15 @@ workflow rnaseq_standard { "Unstranded", ], } + prefix: "Prefix for output files" + xenocp_aligner: { + description: "Aligner to use to map reads to the host genome for detecting contamination", + choices: [ + "bwa aln", + "bwa mem", + "star", + ], + } enable_read_trimming: "Enable read trimming with `fastp`?" mark_duplicates: "Add SAM flag to computationally determined duplicate reads?" cleanse_xenograft: "Use XenoCP to unmap reads from contaminant genome?" @@ -62,9 +62,9 @@ workflow rnaseq_standard { File gtf File star_db File? contaminant_db + String? strandedness String prefix = basename(bam, ".bam") String xenocp_aligner = "star" - String strandedness = "" Boolean enable_read_trimming = false Boolean mark_duplicates = false Boolean cleanse_xenograft = false @@ -147,7 +147,6 @@ task parse_input { strand: { description: "Provided strandedness protocol of the RNA-Seq experiment", choices: [ - "", "Stranded-Reverse", "Stranded-Forward", "Unstranded", @@ -158,7 +157,7 @@ task parse_input { } input { - String strand + String? strand Boolean cleanse_xenograft Boolean contaminant_db } From 5a2f04cf8a3429d7416f29ebcd6a9c86922e14c2 Mon Sep 17 00:00:00 2001 From: Ari Frantz Date: Thu, 19 Feb 2026 14:34:53 -0500 Subject: [PATCH 2/2] use optional string instead of empty string --- tools/samtools.wdl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/samtools.wdl b/tools/samtools.wdl index 21a8cfd46..f6650ed5b 100755 --- a/tools/samtools.wdl +++ b/tools/samtools.wdl @@ -550,7 +550,7 @@ task merge { Array[File] bams String prefix File? new_header - String region = "" + String? region Boolean attach_rg = true Boolean name_sorted = false Boolean combine_rg = true @@ -585,7 +585,7 @@ task merge { --threads "$n_cores" \ ~{"-h \"" + new_header + "\""} \ ~{if name_sorted then "-n" else ""} \ - ~{if (region != "") then "-R \"" + region + "\"" else ""} \ + ~{"-R \"" + region + "\""} \ ~{if attach_rg then "-r" else ""} \ ~{if combine_rg then "-c" else ""} \ ~{if combine_pg then "-p" else ""} \