diff --git a/conf/modules.config b/conf/modules.config index e040b8b..c1e6d4c 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -181,7 +181,6 @@ process { } withName: MERGE_CFF { - ext.args = { "-H " } publishDir = [ enabled: false ] diff --git a/modules.json b/modules.json index 2c0b137..9228792 100644 --- a/modules.json +++ b/modules.json @@ -10,12 +10,12 @@ "git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c", "installed_by": ["modules"] }, - "cat/fastq": { + "cat/cat": { "branch": "master", - "git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c", + "git_sha": "911696ea0b62df80e900ef244d7867d177971f73", "installed_by": ["modules"] }, - "csvtk/concat": { + "cat/fastq": { "branch": "master", "git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c", "installed_by": ["modules"] diff --git a/modules/nf-core/cat/cat/main.nf b/modules/nf-core/cat/cat/main.nf new file mode 100644 index 0000000..9f06221 --- /dev/null +++ b/modules/nf-core/cat/cat/main.nf @@ -0,0 +1,62 @@ +process CAT_CAT { + tag "$meta.id" + label 'process_low' + + conda "conda-forge::pigz=2.3.4" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pigz:2.3.4' : + 'biocontainers/pigz:2.3.4' }" + + input: + tuple val(meta), path(files_in) + + output: + tuple val(meta), path("${prefix}"), emit: file_out + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + def file_list = files_in.collect { it.toString() } + + // | input | output | command1 | command2 | + // |-----------|------------|----------|----------| + // | gzipped | gzipped | cat | | + // | ungzipped | ungzipped | cat | | + // | gzipped | ungzipped | zcat | | + // | ungzipped | gzipped | cat | pigz | + + // Use input file ending as default + prefix = task.ext.prefix ?: "${meta.id}${file_list[0].substring(file_list[0].lastIndexOf('.'))}" + out_zip = prefix.endsWith('.gz') + in_zip = file_list[0].endsWith('.gz') + command1 = (in_zip && !out_zip) ? 'zcat' : 'cat' + command2 = (!in_zip && out_zip) ? "| pigz -c -p $task.cpus $args2" : '' + """ + $command1 \\ + $args \\ + ${file_list.join(' ')} \\ + $command2 \\ + > ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) + END_VERSIONS + """ + + stub: + def file_list = files_in.collect { it.toString() } + prefix = task.ext.prefix ?: "${meta.id}${file_list[0].substring(file_list[0].lastIndexOf('.'))}" + """ + touch $prefix + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/cat/cat/meta.yml b/modules/nf-core/cat/cat/meta.yml new file mode 100644 index 0000000..8acc0bf --- /dev/null +++ b/modules/nf-core/cat/cat/meta.yml @@ -0,0 +1,37 @@ +name: cat_cat +description: A module for concatenation of gzipped or uncompressed files +keywords: + - concatenate + - gzip + - cat +tools: + - cat: + description: Just concatenation + + documentation: https://man7.org/linux/man-pages/man1/cat.1.html + + licence: ["GPL-3.0-or-later"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - files_in: + type: file + description: List of compressed / uncompressed files + pattern: "*" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - file_out: + type: file + description: Concatenated file. Will be gzipped if file_out ends with ".gz" + pattern: "${file_out}" + +authors: + - "@erikrikarddaniel" + - "@FriederikeHanssen" diff --git a/modules/nf-core/csvtk/concat/main.nf b/modules/nf-core/csvtk/concat/main.nf deleted file mode 100644 index c9fb9bf..0000000 --- a/modules/nf-core/csvtk/concat/main.nf +++ /dev/null @@ -1,43 +0,0 @@ -process CSVTK_CONCAT { - tag "$meta.id" - label 'process_low' - - conda "bioconda::csvtk=0.23.0" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/csvtk:0.23.0--h9ee0642_0' : - 'quay.io/biocontainers/csvtk:0.23.0--h9ee0642_0' }" - - input: - tuple val(meta), path(csv) - val in_format - val out_format - - output: - tuple val(meta), path("${prefix}.${out_extension}"), emit: csv - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" - def delimiter = in_format == "tsv" ? "\t" : (in_format == "csv" ? "," : in_format) - def out_delimiter = out_format == "tsv" ? "\t" : (out_format == "csv" ? "," : out_format) - out_extension = out_format == "tsv" ? 'tsv' : 'csv' - """ - csvtk \\ - concat \\ - $args \\ - --num-cpus $task.cpus \\ - --delimiter "${delimiter}" \\ - --out-delimiter "${out_delimiter}" \\ - --out-file ${prefix}.${out_extension} \\ - $csv - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - csvtk: \$(echo \$( csvtk version | sed -e "s/csvtk v//g" )) - END_VERSIONS - """ -} diff --git a/modules/nf-core/csvtk/concat/meta.yml b/modules/nf-core/csvtk/concat/meta.yml deleted file mode 100644 index 2d2f856..0000000 --- a/modules/nf-core/csvtk/concat/meta.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: csvtk_concat -description: Concatenate two or more CSV (or TSV) tables into a single table -keywords: - - concatenate - - tsv - - csv -tools: - - csvtk: - description: A cross-platform, efficient, practical CSV/TSV toolkit - homepage: http://bioinf.shenwei.me/csvtk - documentation: http://bioinf.shenwei.me/csvtk - tool_dev_url: https://github.com/shenwei356/csvtk - doi: "" - licence: ["MIT"] - -input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - csv: - type: file - description: CSV/TSV formatted files - pattern: "*.{csv,tsv}" - - in_format: - type: string - description: Input format (csv, tab, or a delimiting character) - pattern: "*" - - out_format: - type: string - description: Output format (csv, tab, or a delimiting character) - pattern: "*" - -output: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - versions: - type: file - description: File containing software versions - pattern: "version.yml" - - csv: - type: file - description: Concatenated CSV/TSV file - pattern: "*.{csv,tsv}" - -authors: - - "@rpetit3" diff --git a/subworkflows/local/fusion.nf b/subworkflows/local/fusion.nf index 055b235..9991f42 100644 --- a/subworkflows/local/fusion.nf +++ b/subworkflows/local/fusion.nf @@ -4,11 +4,10 @@ include { STAR_ALIGN as STAR_FOR_STARFUSION } from '../../modules/nf-core/star/a include { STARFUSION } from '../../modules/local/starfusion/detect/main' include { FUSIONCATCHER_DETECT } from '../../modules/local/fusioncatcher/detect/main' include { ONCOKB_FUSIONANNOTATOR } from '../../modules/local/oncokb/fusionannotator/main' -include { CSVTK_CONCAT as CSV_TO_TSV } from '../../modules/nf-core/csvtk/concat/main' include { TO_CFF as ARRIBA_TO_CFF } from '../../modules/local/convert_to_cff/main' include { TO_CFF as FUSIONCATCHER_TO_CFF } from '../../modules/local/convert_to_cff/main' include { TO_CFF as STARFUSION_TO_CFF } from '../../modules/local/convert_to_cff/main' -include { CSVTK_CONCAT as MERGE_CFF } from '../../modules/nf-core/csvtk/concat/main' +include { CAT_CAT as MERGE_CFF } from '../../modules/nf-core/cat/cat/main' include { METAFUSION } from '../../modules/local/metafusion/main' include { ADD_FLAG } from '../../modules/local/add_flags/main' @@ -86,20 +85,20 @@ workflow FUSION { .map{ meta, file -> [ meta, "fusioncatcher", file ] } ) STARFUSION_TO_CFF(STARFUSION.out.abridged .map{ meta, file -> [ meta, "starfusion", file ] }) - MERGE_CFF(ARRIBA_TO_CFF.out.cff + MERGE_CFF( + ARRIBA_TO_CFF.out.cff .map{ meta, file -> [meta, file]} .mix( FUSIONCATCHER_TO_CFF.out.cff - .map{ meta, file -> [meta, file]} + .map{ meta, file -> [meta, file]} ).mix( STARFUSION_TO_CFF.out.cff - .map{ meta, file -> [meta, file]} + .map{ meta, file -> [meta, file]} ).groupTuple(by:[0]), - 'tsv', - 'tsv') + ) METAFUSION( - MERGE_CFF.out.csv, + MERGE_CFF.out.file_out, gene_bed, gene_info, fasta,