From 3444e67914e760e6cf60c88568e4c39c20a18ea3 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Thu, 14 Aug 2025 16:47:50 +0200 Subject: [PATCH] fix issue when sex field in samplesheet is empty --- CHANGELOG.md | 1 + workflows/structural.nf | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34faf3bc..33b1ca98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 1. Fail the pipeline when the sex determination failed. This will now prompt the user to add the sex to the samplesheet so the pipeline doesn't do any wrong assumptions 2. Fixed the Jasmine module output VCFs being empty when no variants have been merged. This file now contains the header of one of the input VCFs 3. AnnotSV VCF files are now sorted before trying to combine it with the VEP output. +4. Fixed a map issue when the sex field is empty in the samplesheet ## v0.2.0 - [19 July 2024] - Mighty Manneken Pis diff --git a/workflows/structural.nf b/workflows/structural.nf index c899bd54..46e8e6b6 100644 --- a/workflows/structural.nf +++ b/workflows/structural.nf @@ -300,8 +300,14 @@ workflow STRUCTURAL { no_sex: !meta.sex } + def ch_samplegender_multi = ch_samplegender_input.no_sex + .multiMap { meta, cram, crai, small_variants -> + cram: [ meta, cram, crai ] + other: [ meta, small_variants ] + } + NGSBITS_SAMPLEGENDER( - ch_samplegender_input.no_sex, + ch_samplegender_multi.cram, ch_fasta, ch_fai, "xy" @@ -309,10 +315,11 @@ workflow STRUCTURAL { ch_versions = ch_versions.mix(NGSBITS_SAMPLEGENDER.out.versions.first()) ch_input_sex = NGSBITS_SAMPLEGENDER.out.tsv - .join(ch_samplegender_input.no_sex, failOnDuplicate:true, failOnMismatch:true) - .map { meta, tsv, cram, crai -> + .join(ch_samplegender_multi.cram, failOnDuplicate:true, failOnMismatch:true) + .join(ch_samplegender_multi.other, failOnDuplicate:true, failOnMismatch:true) + .map { meta, tsv, cram, crai, small_variants -> def new_meta = meta + [sex:get_sex(tsv, meta.sample)] - return [ new_meta, cram, crai ] + return [ new_meta, cram, crai, small_variants ] } .mix(ch_samplegender_input.sex) } else {