From 21ecd68bfe415ee78173813667f1bb0d465f7f4b Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jan 2022 08:43:02 +0100 Subject: [PATCH 1/3] fix: remove left-over unnecessary code --- modules/deeparg/predict/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/deeparg/predict/main.nf b/modules/deeparg/predict/main.nf index 1af0fd40..9408fa3d 100644 --- a/modules/deeparg/predict/main.nf +++ b/modules/deeparg/predict/main.nf @@ -11,7 +11,7 @@ process DEEPARG_PREDICT { input: tuple val(meta), path(fasta), val(model) - tuple path(db) + path(db) output: tuple val(meta), path("*.align.daa") , emit: daa From 42564565b934eeb2449e35ec97ed13ff2a67f1de Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Fri, 29 Apr 2022 10:26:17 +0200 Subject: [PATCH 2/3] Update diamond/blastx diamond/blastp to support all possible output formats --- modules/diamond/blastp/main.nf | 17 ++++++++++++++--- modules/diamond/blastp/meta.yml | 9 +++++++++ modules/diamond/blastx/main.nf | 17 ++++++++++++++--- modules/diamond/blastx/meta.yml | 9 +++++++++ tests/modules/diamond/blastp/main.nf | 13 ++++++++++++- tests/modules/diamond/blastp/test.yml | 21 ++++++++++++++++++--- tests/modules/diamond/blastx/main.nf | 13 ++++++++++++- tests/modules/diamond/blastx/test.yml | 24 ++++++++++++++++++++---- 8 files changed, 108 insertions(+), 15 deletions(-) diff --git a/modules/diamond/blastp/main.nf b/modules/diamond/blastp/main.nf index 955952dc..d7c53d6f 100644 --- a/modules/diamond/blastp/main.nf +++ b/modules/diamond/blastp/main.nf @@ -11,10 +11,11 @@ process DIAMOND_BLASTP { input: tuple val(meta), path(fasta) - path db + path db + val outext output: - tuple val(meta), path('*.txt'), emit: txt + tuple val(meta), path('*.{blast,xml,txt,daa,sam,tsv,paf}'), emit: output path "versions.yml" , emit: versions when: @@ -23,6 +24,15 @@ process DIAMOND_BLASTP { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + switch ( outext ) { + case "blast": outfmt = 0; break + case "xml": outfmt = 5; break + case "txt": outfmt = 6; break + case "daa": outfmt = 100; break + case "sam": outfmt = 101; break + case "tsv": outfmt = 102; break + case "paf": outfmt = 103; break + } """ DB=`find -L ./ -name "*.dmnd" | sed 's/.dmnd//'` @@ -31,8 +41,9 @@ process DIAMOND_BLASTP { --threads $task.cpus \\ --db \$DB \\ --query $fasta \\ + --outfmt ${outfmt} \\ $args \\ - --out ${prefix}.txt + --out ${prefix}.${outext} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/diamond/blastp/meta.yml b/modules/diamond/blastp/meta.yml index 8ac1d371..1aa36c23 100644 --- a/modules/diamond/blastp/meta.yml +++ b/modules/diamond/blastp/meta.yml @@ -28,6 +28,14 @@ input: type: directory description: Directory containing the protein blast database pattern: "*" + - outext: + type: string + description: | + Specify the type of output file to be generated. `blast` corresponds to + BLAST pairwise format. `xml` corresponds to BLAST xml format. + `txt` corresponds to to BLAST tabular format. `tsv` corresponds to + taxonomic classification format. + pattern: "blast|xml|txt|daa|sam|tsv|paf" output: - txt: @@ -41,3 +49,4 @@ output: authors: - "@spficklin" + - "@jfy133" diff --git a/modules/diamond/blastx/main.nf b/modules/diamond/blastx/main.nf index 3700bd36..6703c1e4 100644 --- a/modules/diamond/blastx/main.nf +++ b/modules/diamond/blastx/main.nf @@ -11,10 +11,11 @@ process DIAMOND_BLASTX { input: tuple val(meta), path(fasta) - path db + path db + val outext output: - tuple val(meta), path('*.txt'), emit: txt + tuple val(meta), path('*.{blast,xml,txt,daa,sam,tsv,paf}'), emit: output path "versions.yml" , emit: versions when: @@ -23,6 +24,15 @@ process DIAMOND_BLASTX { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + switch ( outext ) { + case "blast": outfmt = 0; break + case "xml": outfmt = 5; break + case "txt": outfmt = 6; break + case "daa": outfmt = 100; break + case "sam": outfmt = 101; break + case "tsv": outfmt = 102; break + case "paf": outfmt = 103; break + } """ DB=`find -L ./ -name "*.dmnd" | sed 's/.dmnd//'` @@ -31,8 +41,9 @@ process DIAMOND_BLASTX { --threads $task.cpus \\ --db \$DB \\ --query $fasta \\ + --outfmt ${outfmt} \\ $args \\ - --out ${prefix}.txt + --out ${prefix}.${outext} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/diamond/blastx/meta.yml b/modules/diamond/blastx/meta.yml index 7eb3d7b4..5ee2d55e 100644 --- a/modules/diamond/blastx/meta.yml +++ b/modules/diamond/blastx/meta.yml @@ -28,6 +28,14 @@ input: type: directory description: Directory containing the nucelotide blast database pattern: "*" + - outext: + type: string + description: | + Specify the type of output file to be generated. `blast` corresponds to + BLAST pairwise format. `xml` corresponds to BLAST xml format. + `txt` corresponds to to BLAST tabular format. `tsv` corresponds to + taxonomic classification format. + pattern: "blast|xml|txt|daa|sam|tsv|paf" output: - txt: @@ -41,3 +49,4 @@ output: authors: - "@spficklin" + - "@jfy133" diff --git a/tests/modules/diamond/blastp/main.nf b/tests/modules/diamond/blastp/main.nf index 87d05bf9..5c1459d8 100644 --- a/tests/modules/diamond/blastp/main.nf +++ b/tests/modules/diamond/blastp/main.nf @@ -9,7 +9,18 @@ workflow test_diamond_blastp { db = [ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] fasta = [ file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true) ] + outext = 'txt' DIAMOND_MAKEDB ( db ) - DIAMOND_BLASTP ( [ [id:'test'], fasta ], DIAMOND_MAKEDB.out.db ) + DIAMOND_BLASTP ( [ [id:'test'], fasta ], DIAMOND_MAKEDB.out.db, outext ) +} + +workflow test_diamond_blastp_daa { + + db = [ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + fasta = [ file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true) ] + outext = 'daa' + + DIAMOND_MAKEDB ( db ) + DIAMOND_BLASTP ( [ [id:'test'], fasta ], DIAMOND_MAKEDB.out.db, outext ) } diff --git a/tests/modules/diamond/blastp/test.yml b/tests/modules/diamond/blastp/test.yml index 32dfacaa..5e31df1f 100644 --- a/tests/modules/diamond/blastp/test.yml +++ b/tests/modules/diamond/blastp/test.yml @@ -1,8 +1,23 @@ -- name: diamond blastp - command: nextflow run ./tests/modules/diamond/blastp -entry test_diamond_blastp -c ./tests/config/nextflow.config -c ./tests/modules/diamond/blastp/nextflow.config +- name: diamond blastp test_diamond_blastp + command: nextflow run tests/modules/diamond/blastp -entry test_diamond_blastp -c tests/config/nextflow.config tags: - diamond - diamond/blastp files: - - path: ./output/diamond/test.diamond_blastp.txt + - path: output/diamond/genome.fasta.dmnd + md5sum: 2447fb376394c20d43ea3aad2aa5d15d + - path: output/diamond/test.diamond_blastp.txt md5sum: 3ca7f6290c1d8741c573370e6f8b4db0 + - path: output/diamond/versions.yml + +- name: diamond blastp test_diamond_blastp_daa + command: nextflow run tests/modules/diamond/blastp -entry test_diamond_blastp_daa -c tests/config/nextflow.config + tags: + - diamond + - diamond/blastp + files: + - path: output/diamond/genome.fasta.dmnd + md5sum: 2447fb376394c20d43ea3aad2aa5d15d + - path: output/diamond/test.diamond_blastp.daa + md5sum: d4a79ad1fcb2ec69460e5a09a9468db7 + - path: output/diamond/versions.yml diff --git a/tests/modules/diamond/blastx/main.nf b/tests/modules/diamond/blastx/main.nf index 77eb08ea..d6d5a77a 100644 --- a/tests/modules/diamond/blastx/main.nf +++ b/tests/modules/diamond/blastx/main.nf @@ -9,7 +9,18 @@ workflow test_diamond_blastx { db = [ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] fasta = [ file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true) ] + outext = 'txt' DIAMOND_MAKEDB ( db ) - DIAMOND_BLASTX ( [ [id:'test'], fasta ], DIAMOND_MAKEDB.out.db ) + DIAMOND_BLASTX ( [ [id:'test'], fasta ], DIAMOND_MAKEDB.out.db, outext ) +} + +workflow test_diamond_blastx_daa { + + db = [ file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + fasta = [ file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true) ] + outext = 'daa' + + DIAMOND_MAKEDB ( db ) + DIAMOND_BLASTX ( [ [id:'test'], fasta ], DIAMOND_MAKEDB.out.db, outext ) } diff --git a/tests/modules/diamond/blastx/test.yml b/tests/modules/diamond/blastx/test.yml index fe7c6938..6a792f30 100644 --- a/tests/modules/diamond/blastx/test.yml +++ b/tests/modules/diamond/blastx/test.yml @@ -1,8 +1,24 @@ -- name: diamond blastx - command: nextflow run ./tests/modules/diamond/blastx -entry test_diamond_blastx -c ./tests/config/nextflow.config -c ./tests/modules/diamond/blastx/nextflow.config +- name: diamond blastx test_diamond_blastx + command: nextflow run tests/modules/diamond/blastx -entry test_diamond_blastx -c tests/config/nextflow.config tags: - diamond - diamond/blastx files: - - path: ./output/diamond/test.diamond_blastx.txt - md5sum: d41d8cd98f00b204e9800998ecf8427e + - path: output/diamond/genome.fasta.dmnd + md5sum: 2447fb376394c20d43ea3aad2aa5d15d + - path: output/diamond/test.diamond_blastx.txt + - path: output/diamond/versions.yml + md5sum: 747934f57b7c0f8901570500f206eac6 + +- name: diamond blastx test_diamond_blastx_daa + command: nextflow run tests/modules/diamond/blastx -entry test_diamond_blastx_daa -c tests/config/nextflow.config + tags: + - diamond + - diamond/blastx + files: + - path: output/diamond/genome.fasta.dmnd + md5sum: 2447fb376394c20d43ea3aad2aa5d15d + - path: output/diamond/test.diamond_blastx.daa + md5sum: 2a0ce0f7e01dcead828b87d5cbaccf7a + - path: output/diamond/versions.yml + md5sum: 05cbabfd500fc17e26b3d8061c5a78c3 From 7df2fae7469095b2f211f4e183cd5f7de77a2b98 Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Fri, 29 Apr 2022 10:26:38 +0200 Subject: [PATCH 3/3] Clean up test data --- tests/modules/diamond/blastp/test.yml | 4 ---- tests/modules/diamond/blastx/test.yml | 6 ------ 2 files changed, 10 deletions(-) diff --git a/tests/modules/diamond/blastp/test.yml b/tests/modules/diamond/blastp/test.yml index 5e31df1f..cb297743 100644 --- a/tests/modules/diamond/blastp/test.yml +++ b/tests/modules/diamond/blastp/test.yml @@ -4,8 +4,6 @@ - diamond - diamond/blastp files: - - path: output/diamond/genome.fasta.dmnd - md5sum: 2447fb376394c20d43ea3aad2aa5d15d - path: output/diamond/test.diamond_blastp.txt md5sum: 3ca7f6290c1d8741c573370e6f8b4db0 - path: output/diamond/versions.yml @@ -16,8 +14,6 @@ - diamond - diamond/blastp files: - - path: output/diamond/genome.fasta.dmnd - md5sum: 2447fb376394c20d43ea3aad2aa5d15d - path: output/diamond/test.diamond_blastp.daa md5sum: d4a79ad1fcb2ec69460e5a09a9468db7 - path: output/diamond/versions.yml diff --git a/tests/modules/diamond/blastx/test.yml b/tests/modules/diamond/blastx/test.yml index 6a792f30..a2d35c80 100644 --- a/tests/modules/diamond/blastx/test.yml +++ b/tests/modules/diamond/blastx/test.yml @@ -4,11 +4,8 @@ - diamond - diamond/blastx files: - - path: output/diamond/genome.fasta.dmnd - md5sum: 2447fb376394c20d43ea3aad2aa5d15d - path: output/diamond/test.diamond_blastx.txt - path: output/diamond/versions.yml - md5sum: 747934f57b7c0f8901570500f206eac6 - name: diamond blastx test_diamond_blastx_daa command: nextflow run tests/modules/diamond/blastx -entry test_diamond_blastx_daa -c tests/config/nextflow.config @@ -16,9 +13,6 @@ - diamond - diamond/blastx files: - - path: output/diamond/genome.fasta.dmnd - md5sum: 2447fb376394c20d43ea3aad2aa5d15d - path: output/diamond/test.diamond_blastx.daa md5sum: 2a0ce0f7e01dcead828b87d5cbaccf7a - path: output/diamond/versions.yml - md5sum: 05cbabfd500fc17e26b3d8061c5a78c3