From 3c87d90aac30e9420806de37ec8752892d9b7b61 Mon Sep 17 00:00:00 2001 From: slsevilla Date: Sun, 31 Mar 2024 21:06:59 +0000 Subject: [PATCH] refactor: ica handling, filtering #147 #149 --- modules/local/get_trimd_stats.nf | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/local/get_trimd_stats.nf b/modules/local/get_trimd_stats.nf index a14d4653..6ea2a575 100644 --- a/modules/local/get_trimd_stats.nf +++ b/modules/local/get_trimd_stats.nf @@ -13,41 +13,39 @@ process GET_TRIMD_STATS { output: tuple val(meta), path('*_trimmed_read_counts.txt'), emit: fastp_total_qc - tuple val(meta), path('*_summary.txt'), emit: outcome - path('*_summaryline.tsv'), optional:true, emit: summary_line - tuple val(meta), path('*_summary_old_3.txt'), emit: outcome_to_edit - tuple val(meta), path('*.synopsis'), optional:true, emit: synopsis + path('*_summaryline.tsv'), optional:true, emit: summary_line + tuple val(meta), path('*_summary_fastp.txt'), emit: outcome + tuple val(meta), path('*.synopsis'), optional:true, emit: synopsis path("versions.yml"), emit: versions script: // This script is bundled with the pipeline, in cdcgov/phoenix/bin/ - // Adding if/else for if running on ICA it is a requirement to state where the script is, however, this causes CLI users to not run the pipeline from any directory. - if (params.ica==false) { ica = "" } - else if (params.ica==true) { ica = "python ${workflow.launchDir}/bin/" } - else { error "Please set params.ica to either \"true\" if running on ICA or \"false\" for all other methods." } // define variables def prefix = task.ext.prefix ?: "${meta.id}" def busco_parameter = busco_val ? "--busco" : "" def container_version = "base_v2.1.0" def container = task.container.toString() - "quay.io/jvhagey/phoenix@" + def script_fastp = params.ica ? "python ${params.ica_path}/FastP_QC.py" : "FastP_QC.py" + def script_fairy = params.ica ? "python ${params.ica_path}/fairy.py" : "fairy.py" """ - ${ica}FastP_QC.py \\ + ${script_fastp} \\ --trimmed_json ${fastp_trimd_json} \\ --single_json ${fastp_singles_json} \\ --name ${prefix} - # Check that there are still reads in R1 and R2 before fastqc. If there aren't reads then fastqc dies. + # making a copy of the summary file - this avoids writing to the previous file + cp ${fairy_outcome} ${prefix}_input.txt # Output check for messages indicating there are no trimmed reads after filtering. - ${ica}fairy.py -r ${raw_qc} -f ${fairy_outcome} -t ${prefix}_trimmed_read_counts.txt ${busco_parameter} + ${script_fairy} -r ${raw_qc} -f ${prefix}_input.txt -t ${prefix}_trimmed_read_counts.txt ${busco_parameter} #making a copy of the summary file to pass to BBMAP_REFORMAT to handle file names being the same - cp ${prefix}_summary.txt ${prefix}_summary_old_3.txt + mv ${prefix}_summary.txt ${prefix}_summary_fastp.txt cat <<-END_VERSIONS > versions.yml "${task.process}": python: \$(python --version | sed 's/Python //g') - fairy.py: \$( ${ica}fairy.py --version ) - FastP_QC.py: \$(${ica}FastP_QC.py --version ) + fairy.py: \$( ${script_fairy} --version ) + FastP_QC.py: \$(${script_fastp} --version ) phoenix_base_container_tag: ${container_version} phoenix_base_container: ${container} END_VERSIONS