From 621b6a3d092e00a11086444083c95544ad8781b8 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Fri, 10 Jun 2022 11:27:51 +0200 Subject: [PATCH] Add comments about MALT id replacement and refactor for simplicity --- subworkflows/local/profiling.nf | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/subworkflows/local/profiling.nf b/subworkflows/local/profiling.nf index 9bae127..7d35837 100644 --- a/subworkflows/local/profiling.nf +++ b/subworkflows/local/profiling.nf @@ -66,13 +66,20 @@ workflow PROFILING { .filter { it[0]['instrument_platform'] == 'ILLUMINA' } .map { meta, reads, db_meta, db -> - def sam_format = params.malt_save_reads ? ' --alignments ./ -za false' : "" - def temp_meta = [ id: meta['db_name'] ] + def new_meta = meta.clone() def new_db_meta = db_meta.clone() + + // Add the saving of alignments in SAM format to params + def sam_format = params.malt_save_reads ? ' --alignments ./ -za false' : "" new_db_meta['db_params'] = db_meta['db_params'] + sam_format - def new_meta = temp_meta + new_db_meta - new_meta['id'] = new_meta['db_name'] - [ new_meta, reads, db ] + + // As MALT has huge databases, we don't run on a per-sample basis but multiple + // samples at once. This replaces the ID of the particular process with the + // db_name instead to prevent `null` in job name, and in publishDir) + def updated_meta = new_meta + new_db_meta + updated_meta['id'] = updated_meta['db_name'] + + [ updated_meta, reads, db ] } .groupTuple(by: [0,2]) .multiMap {