From f0876a8857efee7c05eecefad91cc3ea43ef6bf2 Mon Sep 17 00:00:00 2001 From: slsevilla Date: Thu, 28 Mar 2024 21:05:15 +0000 Subject: [PATCH] refactor: change filtering for failed samples #147 --- conf/modules.config | 2 +- modules/local/fairy_corruption_check.nf | 5 ++--- workflows/phoenix.nf | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 1e91a084..42764e8d 100755 --- a/conf/modules.config +++ b/conf/modules.config @@ -43,7 +43,7 @@ process { [ path: { "${params.outdir}/${meta.id}/file_integrity" }, mode: 'copy', - pattern: "*{_summary.txt}" + pattern: "*{_summary_fairy.txt}" ] ] } diff --git a/modules/local/fairy_corruption_check.nf b/modules/local/fairy_corruption_check.nf index b09c675b..8e0ebb6b 100644 --- a/modules/local/fairy_corruption_check.nf +++ b/modules/local/fairy_corruption_check.nf @@ -9,8 +9,7 @@ process CORRUPTION_CHECK { val(busco_val) output: - tuple val(meta), path('*_summary.txt'), emit: outcome - tuple val(meta), path('*_summary_old.txt'), emit: outcome_to_edit + tuple val(meta), path('*_summary_fairy.txt'), emit: outcome path('*_summaryline.tsv'), optional:true, emit: summary_line tuple val(meta), path('*.synopsis'), optional:true, emit: synopsis path("versions.yml"), emit: versions @@ -37,7 +36,7 @@ process CORRUPTION_CHECK { script_version=\$(${ica}fairy_proc.sh -V) #making a copy of the summary file to pass to READ_COUNT_CHECKS to handle file names being the same - cp ${prefix}_summary.txt ${prefix}_summary_old.txt + mv ${prefix}_summary.txt ${prefix}_summary_fairy.txt cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/workflows/phoenix.nf b/workflows/phoenix.nf index 0815080d..3bfbefff 100644 --- a/workflows/phoenix.nf +++ b/workflows/phoenix.nf @@ -127,8 +127,9 @@ workflow PHOENIX_EXTERNAL { //Combining reads with output of corruption check. By=2 is for getting R1 and R2 results //The mapping here is just to get things in the right bracket so we can call var[0] - read_stats_ch = INPUT_CHECK.out.reads.join(CORRUPTION_CHECK.out.outcome_to_edit, by: [0,0]) - .join(CORRUPTION_CHECK.out.outcome.splitCsv(strip:true, by:2).map{meta, fairy_outcome -> [meta, [fairy_outcome[0][0], fairy_outcome[1][0]]]}, by: [0,0]) + read_stats_ch = INPUT_CHECK.out.reads.join(CORRUPTION_CHECK.out.outcome, by: [0,0]) + .join(CORRUPTION_CHECK.out.outcome.splitCsv(strip:true, by:2).map{meta, fairy_outcome -> [meta, [fairy_outcome[0][0], fairy_outcome[1][0]]]}, by: [0,0]) + .filter { it[3].findAll {!it.contains('FAILED')}} //Get stats on raw reads if the reads aren't corrupted GET_RAW_STATS (