diff --git a/modules/nf-core/metaphlan/metaphlan/main.nf b/modules/nf-core/metaphlan/metaphlan/main.nf index 15bd428581a..477f1f28ddd 100644 --- a/modules/nf-core/metaphlan/metaphlan/main.nf +++ b/modules/nf-core/metaphlan/metaphlan/main.nf @@ -23,12 +23,13 @@ process METAPHLAN_METAPHLAN { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def input_type = ("$input".endsWith(".fastq.gz") || "$input".endsWith(".fq.gz")) ? "--input_type fastq" : ("$input".contains(".fasta")) ? "--input_type fasta" : ("$input".endsWith(".bowtie2out.txt")) ? "--input_type bowtie2out" : "--input_type sam" + def input_type = "$input" =~ /.*\.(fastq|fq)/ ? "--input_type fastq" : "$input" =~ /.*\.(fasta|fna|fa)/ ? "--input_type fasta" : "$input".endsWith(".bowtie2out.txt") ? "--input_type bowtie2out" : "--input_type sam" def input_data = ("$input_type".contains("fastq")) && !meta.single_end ? "${input[0]},${input[1]}" : "$input" def bowtie2_out = "$input_type" == "--input_type bowtie2out" || "$input_type" == "--input_type sam" ? '' : "--bowtie2out ${prefix}.bowtie2out.txt" """ BT2_DB=`find -L "${metaphlan_db_latest}" -name "*rev.1.bt2l" -exec dirname {} \\;` + BT2_DB_INDEX=`find -L ${metaphlan_db_latest} -name "*.rev.1.bt2l" | sed 's/\\.rev.1.bt2l\$//' | sed 's/.*\\///'` metaphlan \\ --nproc $task.cpus \\ @@ -37,6 +38,7 @@ process METAPHLAN_METAPHLAN { $args \\ $bowtie2_out \\ --bowtie2db \$BT2_DB \\ + --index \$BT2_DB_INDEX \\ --biom ${prefix}.biom \\ --output_file ${prefix}_profile.txt diff --git a/tests/modules/nf-core/metaphlan/metaphlan/main.nf b/tests/modules/nf-core/metaphlan/metaphlan/main.nf index 6e48a94a065..3000feb9062 100644 --- a/tests/modules/nf-core/metaphlan/metaphlan/main.nf +++ b/tests/modules/nf-core/metaphlan/metaphlan/main.nf @@ -53,7 +53,7 @@ workflow test_metaphlan_sam { db = [ [], file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/metaphlan4_database.tar.gz', checkIfExists: true) ] UNTAR ( db ) - SAMTOOLS_VIEW ( input, [] ,[]) + SAMTOOLS_VIEW ( input, [[],[]], []) METAPHLAN_METAPHLAN ( SAMTOOLS_VIEW.out.sam, UNTAR.out.untar.map{ it[1] } ) }