diff --git a/conf/modules.config b/conf/modules.config index 216eba35..4f7d15e4 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -33,11 +33,6 @@ process { ext.args2 = "zs" // compress .sscore with zstd by default } - withName: MATCH_COMBINE { - // don't recombine unless the file content has changed - cache = 'deep' - } - // container configuration withLabel: pgscatalog_utils { ext.conda = "$projectDir/environments/pgscatalog_utils/environment.yml" diff --git a/modules/local/match_combine.nf b/modules/local/match_combine.nf index 7acd223f..1955e129 100644 --- a/modules/local/match_combine.nf +++ b/modules/local/match_combine.nf @@ -28,9 +28,9 @@ process MATCH_COMBINE { def ambig = params.keep_ambiguous ? '--keep_ambiguous' : '' def multi = params.keep_multiallelic ? '--keep_multiallelic' : '' // output one (or more) scoring files per chromosome? - def split_output = !meta.chrom.contains("ALL") ? '--split' : '' + def split_output = meta.split ? '--split' : '' // output one (or more) scoring file per sampleset? - def combined_output = (meta.chrom.contains("ALL") || shared.name != 'NO_FILE') ? '--combined' : '' + def combined_output = (!meta.split || shared.name != 'NO_FILE') ? '--combined' : '' // filter match candidates to intersect with reference: // omit multi-allelic variants in reference because these will cause errors with relabelling!... // ... unclear whether we should remove them from target with '&& ($9 == 0') as well? diff --git a/subworkflows/local/match.nf b/subworkflows/local/match.nf index bb46c648..a125845c 100644 --- a/subworkflows/local/match.nf +++ b/subworkflows/local/match.nf @@ -42,9 +42,14 @@ workflow MATCH { } .set { ch_intersection_grouped } - // grab first() meta object for MATCH_COMBINE // only meta.chrom is checked to see if it's set to 'ALL' or not - ch_matches.meta.first() + // but using chrom values directly in meta map breaks cache because chrom order can differ across runs + ch_matches.meta.first().map { it -> + def split = it.chrom == "ALL" + return [split:split, id: it.id] + }.set { combine_meta } + + combine_meta .concat( ch_matches.matches.collect() ) .concat( scorefile ) .concat( ch_intersection_grouped.intersections.collect() )