From 8cef72617d43cb3c668d06a775f1d6c832530a3f Mon Sep 17 00:00:00 2001 From: Jim Downie Date: Fri, 6 Dec 2024 11:40:49 +0000 Subject: [PATCH] Fix contig2bin processing --- conf/modules.config | 6 +++--- modules/local/contig2bin2fasta/main.nf | 2 +- modules/local/magscot/magscot/main.nf | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index ad382a3..9188bdb 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -212,10 +212,10 @@ process { } withName: 'RENAME_DASTOOL_BINS' { + ext.prefix = { "${meta.id}_${meta.assembler}_dastool_contig2bin" } ext.args = { "" } - ext.args2 = { "'{if(\$2 != prev) { count++ }; print \$1,"${prefix}_"count; prev = \$2}'" } - ext.prefix = { "${meta.id}_${meta.assembler}_${meta.binner}_contig2bin" } - tag = { "${meta.id}_${meta.assembler}_${meta.binner}" } + ext.args2 = { "'{if(\$2 != prev) { count++ }; print \$1,\"${meta.id}_${meta.assembler}_dastool_\"count; prev = \$2}'" } + tag = { "${meta.id}_${meta.assembler}_dastool" } } withName: 'SEQKIT_STATS' { diff --git a/modules/local/contig2bin2fasta/main.nf b/modules/local/contig2bin2fasta/main.nf index c6fba1b..21c6730 100644 --- a/modules/local/contig2bin2fasta/main.nf +++ b/modules/local/contig2bin2fasta/main.nf @@ -17,7 +17,7 @@ process CONTIG2BIN2FASTA { script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "" + def prefix = task.ext.prefix ?: "${meta.id}" def extension = input_is_prodigal_aa ? "faa" : "fa" def input_aa = input_is_prodigal_aa ? "_.*" : "" """ diff --git a/modules/local/magscot/magscot/main.nf b/modules/local/magscot/magscot/main.nf index 65ac04f..1865b03 100644 --- a/modules/local/magscot/magscot/main.nf +++ b/modules/local/magscot/magscot/main.nf @@ -28,7 +28,7 @@ process MAGSCOT_MAGSCOT { mv MAGScoT.refined.out ${prefix}.MAGScoT.refined.out ## magscot puts out contig2bin file in wrong format - awk 'NR > 1 {print \$2 \$1}' MAGScoT.refined.contig_to_bin.out > ${prefix}.MAGScoT.refined.contig_to_bin.out + awk 'BEGIN{OFS="\t"} NR > 1 {print \$2,\$1}' MAGScoT.refined.contig_to_bin.out > ${prefix}.MAGScoT.refined.contig_to_bin.out rm MAGScoT.refined.contig_to_bin.out cat <<-END_VERSIONS > versions.yml