diff --git a/modules/centrifuge/main.nf b/modules/centrifuge/centrifuge/main.nf similarity index 88% rename from modules/centrifuge/main.nf rename to modules/centrifuge/centrifuge/main.nf index c9ec377b..3d23fc96 100644 --- a/modules/centrifuge/main.nf +++ b/modules/centrifuge/centrifuge/main.nf @@ -1,4 +1,4 @@ -process CENTRIFUGE { +process CENTRIFUGE_CENTRIFUGE { tag "$meta.id" label 'process_high' @@ -10,7 +10,6 @@ process CENTRIFUGE { input: tuple val(meta), path(reads) path db - val db_name val save_unaligned val save_aligned val sam_format @@ -18,7 +17,6 @@ process CENTRIFUGE { output: tuple val(meta), path('*report.txt') , emit: report tuple val(meta), path('*results.txt') , emit: results - tuple val(meta), path('*kreport.txt') , emit: kreport tuple val(meta), path('*.sam') , optional: true, emit: sam tuple val(meta), path('*.mapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_mapped tuple val(meta), path('*.unmapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_unmapped @@ -31,7 +29,6 @@ process CENTRIFUGE { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def paired = meta.single_end ? "-U ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}" - def db_name = db.toString().replace(".tar.gz","") def unaligned = '' def aligned = '' if (meta.single_end) { @@ -43,8 +40,10 @@ process CENTRIFUGE { } def sam_output = sam_format ? "--out-fmt 'sam'" : '' """ + ## we add "-no-name ._" to ensure silly Mac OSX metafiles files aren't included + db_name=`find -L ${db} -name "*.1.cf" -not -name "._*" | sed 's/.1.cf//'` centrifuge \\ - -x ${db}/${db_name} \\ + -x \$db_name \\ -p $task.cpus \\ $paired \\ --report-file ${prefix}.report.txt \\ @@ -53,7 +52,6 @@ process CENTRIFUGE { $aligned \\ $sam_output \\ $args - centrifuge-kreport -x $db_name ${prefix}.results.txt > ${prefix}.kreport.txt cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/centrifuge/meta.yml b/modules/centrifuge/centrifuge/meta.yml similarity index 82% rename from modules/centrifuge/meta.yml rename to modules/centrifuge/centrifuge/meta.yml index aabb465f..a252c00c 100644 --- a/modules/centrifuge/meta.yml +++ b/modules/centrifuge/centrifuge/meta.yml @@ -1,4 +1,4 @@ -name: centrifuge +name: centrifuge_centrifuge description: Classifies metagenomic sequence data keywords: - classify @@ -25,11 +25,7 @@ input: respectively. - db: type: directory - description: Centrifuge database in .tar.gz format - pattern: "*.tar.gz" - - db_name: - type: string - description: Centrifuge database filenames without the suffix ".cf" + description: Path to directory containing centrifuge database files - save_unaligned: type: value description: If true unmapped fastq files are saved @@ -52,12 +48,6 @@ output: description: | File containing classification results pattern: "*.{results.txt}" - - kreport: - type: file - description: | - File containing kraken-style report from centrifuge - out files. - pattern: "*.{kreport.txt}" - fastq_unmapped: type: file description: Unmapped fastq files diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index d47b95c4..64779036 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -395,9 +395,9 @@ cellranger/mkref: - modules/cellranger/gtf/** - tests/modules/cellranger/gtf/** -centrifuge: - - modules/centrifuge/** - - tests/modules/centrifuge/** +centrifuge/centrifuge: + - modules/centrifuge/centrifuge/** + - tests/modules/centrifuge/centrifuge/** checkm/lineagewf: - modules/checkm/lineagewf/** diff --git a/tests/modules/centrifuge/main.nf b/tests/modules/centrifuge/centrifuge/main.nf similarity index 66% rename from tests/modules/centrifuge/main.nf rename to tests/modules/centrifuge/centrifuge/main.nf index 37393ce5..7e44bd80 100644 --- a/tests/modules/centrifuge/main.nf +++ b/tests/modules/centrifuge/centrifuge/main.nf @@ -2,37 +2,36 @@ nextflow.enable.dsl = 2 -include { UNTAR } from '../../../modules/untar/main.nf' -include { CENTRIFUGE } from '../../../modules/centrifuge/main.nf' +include { UNTAR } from '../../../../modules/untar/main.nf' +include { CENTRIFUGE_CENTRIFUGE } from '../../../../modules/centrifuge/centrifuge/main.nf' -workflow test_centrifuge_single_end { +workflow test_centrifuge_centrifuge_single_end { input = [ [ id:'test', single_end:true ], // meta map [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] ] db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ] - db_name = "minigut_cf" save_unaligned = true save_aligned = false sam_format = false UNTAR ( db ) - CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] },db_name, save_unaligned, save_aligned, sam_format ) + CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned, sam_format ) } -workflow test_centrifuge_paired_end { +workflow test_centrifuge_centrifuge_paired_end { input = [ [ id:'test', single_end:false ], // meta map [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ] ] db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/minigut_cf.tar.gz', checkIfExists: true) ] - db_name = "minigut_cf" + //db_name = "minigut_cf" save_unaligned = true save_aligned = false sam_format = false UNTAR ( db ) - CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, db_name, save_unaligned, save_aligned, sam_format ) + CENTRIFUGE_CENTRIFUGE ( input, UNTAR.out.untar.map{ it[1] }, save_unaligned, save_aligned, sam_format ) } diff --git a/tests/modules/centrifuge/nextflow.config b/tests/modules/centrifuge/centrifuge/nextflow.config similarity index 100% rename from tests/modules/centrifuge/nextflow.config rename to tests/modules/centrifuge/centrifuge/nextflow.config diff --git a/tests/modules/centrifuge/test.yml b/tests/modules/centrifuge/centrifuge/test.yml similarity index 51% rename from tests/modules/centrifuge/test.yml rename to tests/modules/centrifuge/centrifuge/test.yml index a7b4360b..641ca7ef 100644 --- a/tests/modules/centrifuge/test.yml +++ b/tests/modules/centrifuge/centrifuge/test.yml @@ -1,20 +1,20 @@ -- name: centrifuge test_centrifuge_single_end - command: nextflow run tests/modules/centrifuge -entry test_centrifuge_single_end -c tests/config/nextflow.config +- name: centrifuge centrifuge test_centrifuge_centrifuge_single_end + command: nextflow run tests/modules/centrifuge/centrifuge -entry test_centrifuge_centrifuge_single_end -c tests/config/nextflow.config tags: - centrifuge + - centrifuge/centrifuge files: - - path: output/centrifuge/test.kreport.txt - path: output/centrifuge/test.report.txt - path: output/centrifuge/test.results.txt - path: output/centrifuge/test.unmapped.fastq.gz - path: output/centrifuge/versions.yml -- name: centrifuge test_centrifuge_paired_end - command: nextflow run tests/modules/centrifuge -entry test_centrifuge_paired_end -c tests/config/nextflow.config +- name: centrifuge centrifuge test_centrifuge_centrifuge_paired_end + command: nextflow run tests/modules/centrifuge/centrifuge -entry test_centrifuge_centrifuge_paired_end -c tests/config/nextflow.config tags: - centrifuge + - centrifuge/centrifuge files: - - path: output/centrifuge/test.kreport.txt - path: output/centrifuge/test.report.txt - path: output/centrifuge/test.results.txt - path: output/centrifuge/test.unmapped.fastq.1.gz