From 1d73b33d2e4885be77cce31fdd9405de135d7e0f Mon Sep 17 00:00:00 2001 From: Nur M Shahir Date: Tue, 10 Sep 2024 10:40:43 -0400 Subject: [PATCH 1/2] Nextclade vers bump (#6356) * Update environment.yml * Update main.nf Updated containers to 3.8.2 * Update meta.yml * Update main.nf * Create nf-test.config * Create main.nf.test nf-test module * Create main.nf.test.snap * Create nextflow.config * Update main.nf fixing biocontainer issue * Update meta.yml * nextclade version bump from 2.12 to 3.8.2 * Update meta.yml * Update test.yml regenerated test.yml * Update modules/nf-core/nextclade/datasetget/main.nf Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> * Update modules/nf-core/nextclade/run/main.nf Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> * Delete tests/modules/nf-core/nextclade/run/test.yml deleted * Delete modules/nf-core/nextclade/run/tests/nextflow.config Deleting * Delete modules/nf-core/nextclade/run/nf-test.config * Delete modules/nf-core/nextclade/datasetget/tests/nextflow.config * Delete modules/nf-core/nextclade/datasetget/nf-test.config * Update main.nf.test * Update main.nf.test making tag adhere to guidelines * Update main.nf.test add params block [this mainly because I couldn't run the test locally without it) * Update main.nf.test.snap * Update main.nf.test * Update main.nf.test add stub * Update main.nf.test * Update tests/config/pytest_modules.yml Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> * Update pytest_modules.yml * Delete tests/modules/nf-core/nextclade/datasetget/main.nf * Delete tests/modules/nf-core/nextclade/datasetget/test.yml * Delete tests/modules/nf-core/nextclade/run/main.nf * Update main.nf.test add stub to nextclade/datasetget test * Delete tests/modules/nf-core/nextclade/datasetget/nextflow.config * Update snapshot * Update meta.yml * Update main.nf.test updated main.nf.test * Update main.nf.test.snap * Add stubs and swap to only snapshoting part of the json * Update modules/nf-core/nextclade/datasetget/main.nf --------- Co-authored-by: shahirnm Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --- .../nextclade/datasetget/environment.yml | 2 +- modules/nf-core/nextclade/datasetget/main.nf | 26 +- modules/nf-core/nextclade/datasetget/meta.yml | 6 +- .../nextclade/datasetget/tests/main.nf.test | 31 ++- .../datasetget/tests/main.nf.test.snap | 36 ++- modules/nf-core/nextclade/run/environment.yml | 2 +- modules/nf-core/nextclade/run/main.nf | 24 +- modules/nf-core/nextclade/run/meta.yml | 32 ++- .../nf-core/nextclade/run/tests/main.nf.test | 82 ++++++ .../nextclade/run/tests/main.nf.test.snap | 245 ++++++++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/nextclade/run/main.nf | 23 -- tests/modules/nf-core/nextclade/run/test.yml | 62 ----- 13 files changed, 445 insertions(+), 129 deletions(-) create mode 100644 modules/nf-core/nextclade/run/tests/main.nf.test create mode 100644 modules/nf-core/nextclade/run/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/nextclade/run/main.nf delete mode 100644 tests/modules/nf-core/nextclade/run/test.yml diff --git a/modules/nf-core/nextclade/datasetget/environment.yml b/modules/nf-core/nextclade/datasetget/environment.yml index 58a06b619f0..09c0ba1a846 100644 --- a/modules/nf-core/nextclade/datasetget/environment.yml +++ b/modules/nf-core/nextclade/datasetget/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::nextclade=2.12.0 + - bioconda::nextclade=3.8.2 diff --git a/modules/nf-core/nextclade/datasetget/main.nf b/modules/nf-core/nextclade/datasetget/main.nf index 70c900a5f70..4f878381231 100644 --- a/modules/nf-core/nextclade/datasetget/main.nf +++ b/modules/nf-core/nextclade/datasetget/main.nf @@ -4,12 +4,11 @@ process NEXTCLADE_DATASETGET { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/nextclade:2.12.0--h9ee0642_0' : - 'biocontainers/nextclade:2.12.0--h9ee0642_0' }" + 'https://depot.galaxyproject.org/singularity/nextclade:3.8.2--h9ee0642_0' : + 'biocontainers/nextclade:3.8.2--h9ee0642_0' }" input: val dataset - val reference val tag output: @@ -22,7 +21,6 @@ process NEXTCLADE_DATASETGET { script: def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${dataset}" - def fasta = reference ? "--reference ${reference}" : '' def version = tag ? "--tag ${tag}" : '' """ nextclade \\ @@ -30,7 +28,6 @@ process NEXTCLADE_DATASETGET { get \\ $args \\ --name $dataset \\ - $fasta \\ $version \\ --output-dir $prefix @@ -39,4 +36,23 @@ process NEXTCLADE_DATASETGET { nextclade: \$(echo \$(nextclade --version 2>&1) | sed 's/^.*nextclade //; s/ .*\$//') END_VERSIONS """ + + stub: + prefix = task.ext.prefix ?: "${dataset}" + """ + mkdir -p ${prefix} + touch ${prefix}/CHANGELOG.md + touch ${prefix}/README.md + touch ${prefix}/genome_annotation.gff3 + touch ${prefix}/pathogen.json + touch ${prefix}/reference.fasta + touch ${prefix}/sequences.fasta + touch ${prefix}/tree.json + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nextclade: \$(echo \$(nextclade --version 2>&1) | sed 's/^.*nextclade //; s/ .*\$//') + END_VERSIONS + """ + } diff --git a/modules/nf-core/nextclade/datasetget/meta.yml b/modules/nf-core/nextclade/datasetget/meta.yml index 7494b0ed773..290ed0cd926 100644 --- a/modules/nf-core/nextclade/datasetget/meta.yml +++ b/modules/nf-core/nextclade/datasetget/meta.yml @@ -16,10 +16,6 @@ input: type: string description: Name of dataset to retrieve. A list of available datasets can be obtained using the nextclade dataset list command. pattern: ".+" - - reference: - type: string - description: Accession id to download dataset based on a particular reference sequence. A list of available datasets can be obtained using the nextclade dataset list command. - pattern: ".+" - tag: type: string description: Version tag of the dataset to download. A list of available datasets can be obtained using the nextclade dataset list command. @@ -39,3 +35,5 @@ authors: maintainers: - "@antunderwood" - "@drpatelh" +updated on 2024.08.27: + - "@nmshahir" diff --git a/modules/nf-core/nextclade/datasetget/tests/main.nf.test b/modules/nf-core/nextclade/datasetget/tests/main.nf.test index b0d80135999..d7eb12b7dba 100644 --- a/modules/nf-core/nextclade/datasetget/tests/main.nf.test +++ b/modules/nf-core/nextclade/datasetget/tests/main.nf.test @@ -10,21 +10,40 @@ nextflow_process { tag "nextclade" tag "nextclade/datasetget" - test("species-id-time") { - + test("species-tag") { + + when { + process { + """ + input[0] = 'nextstrain/sars-cov-2/wuhan-hu-1/orfs' + input[1] = '2024-01-16--20-31-02Z' + + """ + } + } + + then { + assert process.success + assert snapshot(process.out).match() + } + + } + + test("species-tag-stub") { + options '-stub' + when { process { """ - input[0] = 'sars-cov-2' - input[1] = 'MN908947' - input[2] = '2022-01-18T12:00:00Z' + input[0] = 'nextstrain/sars-cov-2/wuhan-hu-1/orfs' + input[1] = '2024-01-16--20-31-02Z' """ } } then { - assertAll( + assertAll ( { assert process.success }, { assert snapshot(process.out).match() } ) diff --git a/modules/nf-core/nextclade/datasetget/tests/main.nf.test.snap b/modules/nf-core/nextclade/datasetget/tests/main.nf.test.snap index 02ab3e9ece2..8de6fd56891 100644 --- a/modules/nf-core/nextclade/datasetget/tests/main.nf.test.snap +++ b/modules/nf-core/nextclade/datasetget/tests/main.nf.test.snap @@ -1,43 +1,41 @@ { - "test-nextclade-datasetget": { + "species-tag": { "content": [ { "0": [ [ - "genemap.gff:md5,21ebebfd0f416eeb959e55ebffd808e8", - "primers.csv:md5,5990c3483bf66ce607aeb90a44e7ef2e", - "qc.json:md5,c512f51fda0212b21ffff05779180963", + "CHANGELOG.md:md5,ebbe8be5a3c378ed903c1afb4d8c441d", + "README.md:md5,c69387d632361334f0d7c9b66065f947", + "genome_annotation.gff3:md5,4dff84d2d6ada820e0e3a8bc6798d402", + "pathogen.json:md5,db5bbec52359c1e168ffc5e6dc0ea32a", "reference.fasta:md5,c7ce05f28e4ec0322c96f24e064ef55c", - "sequences.fasta:md5,41129d255b99e0e92bdf20e866b99a1b", - "tag.json:md5,402ac2b87e2a6a64a3fbf5ad16497af3", - "tree.json:md5,b8f32f547ff9e2131d6fc66b68fc54b1", - "virus_properties.json:md5,5f2de3949e07cb633f3d9e4a7654dc81" + "sequences.fasta:md5,c2a4d6cbb837dce22d81f9c36dd0629e", + "tree.json:md5,e180607cd34a6cb6bab101d295f6cedf" ] ], "1": [ - "versions.yml:md5,12e8751f1d841b9aee87d31206c102a7" + "versions.yml:md5,8c64a653330d1c5cb58ee1b8363b22d3" ], "dataset": [ [ - "genemap.gff:md5,21ebebfd0f416eeb959e55ebffd808e8", - "primers.csv:md5,5990c3483bf66ce607aeb90a44e7ef2e", - "qc.json:md5,c512f51fda0212b21ffff05779180963", + "CHANGELOG.md:md5,ebbe8be5a3c378ed903c1afb4d8c441d", + "README.md:md5,c69387d632361334f0d7c9b66065f947", + "genome_annotation.gff3:md5,4dff84d2d6ada820e0e3a8bc6798d402", + "pathogen.json:md5,db5bbec52359c1e168ffc5e6dc0ea32a", "reference.fasta:md5,c7ce05f28e4ec0322c96f24e064ef55c", - "sequences.fasta:md5,41129d255b99e0e92bdf20e866b99a1b", - "tag.json:md5,402ac2b87e2a6a64a3fbf5ad16497af3", - "tree.json:md5,b8f32f547ff9e2131d6fc66b68fc54b1", - "virus_properties.json:md5,5f2de3949e07cb633f3d9e4a7654dc81" + "sequences.fasta:md5,c2a4d6cbb837dce22d81f9c36dd0629e", + "tree.json:md5,e180607cd34a6cb6bab101d295f6cedf" ] ], "versions": [ - "versions.yml:md5,12e8751f1d841b9aee87d31206c102a7" + "versions.yml:md5,8c64a653330d1c5cb58ee1b8363b22d3" ] } ], "meta": { - "nf-test": "0.8.4", + "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-08-23T11:33:31.41372" + "timestamp": "2024-08-27T19:55:42.211731791" } } \ No newline at end of file diff --git a/modules/nf-core/nextclade/run/environment.yml b/modules/nf-core/nextclade/run/environment.yml index 58a06b619f0..09c0ba1a846 100644 --- a/modules/nf-core/nextclade/run/environment.yml +++ b/modules/nf-core/nextclade/run/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::nextclade=2.12.0 + - bioconda::nextclade=3.8.2 diff --git a/modules/nf-core/nextclade/run/main.nf b/modules/nf-core/nextclade/run/main.nf index 33fb34c6b31..cdb44437ab4 100644 --- a/modules/nf-core/nextclade/run/main.nf +++ b/modules/nf-core/nextclade/run/main.nf @@ -4,8 +4,8 @@ process NEXTCLADE_RUN { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/nextclade:2.12.0--h9ee0642_0' : - 'biocontainers/nextclade:2.12.0--h9ee0642_0' }" + 'https://depot.galaxyproject.org/singularity/nextclade:3.8.2--h9ee0642_0' : + 'biocontainers/nextclade:3.8.2--h9ee0642_0' }" input: tuple val(meta), path(fasta) @@ -20,7 +20,8 @@ process NEXTCLADE_RUN { tuple val(meta), path("${prefix}.auspice.json") , optional:true, emit: json_auspice tuple val(meta), path("${prefix}.ndjson") , optional:true, emit: ndjson tuple val(meta), path("${prefix}.aligned.fasta") , optional:true, emit: fasta_aligned - tuple val(meta), path("*.translation.fasta") , optional:true, emit: fasta_translation + tuple val(meta), path("*_translation.*.fasta") , optional:true, emit: fasta_translation + tuple val(meta), path("${prefix}.nwk") , optional:true, emit: nwk path "versions.yml" , emit: versions when: @@ -44,4 +45,21 @@ process NEXTCLADE_RUN { nextclade: \$(echo \$(nextclade --version 2>&1) | sed 's/^.*nextclade //; s/ .*\$//') END_VERSIONS """ + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.csv + touch ${prefix}.tsv + touch ${prefix}.json + touch ${prefix}.auspice.json + touch ${prefix}.aligned.fasta + touch ${prefix}.cds_translation.test.fasta + touch ${prefix}.nwk + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nextclade: \$(echo \$(nextclade --version 2>&1) | sed 's/^.*nextclade //; s/ .*\$//') + END_VERSIONS + """ } diff --git a/modules/nf-core/nextclade/run/meta.yml b/modules/nf-core/nextclade/run/meta.yml index 22fb2450f28..bb7bf6c2d0e 100644 --- a/modules/nf-core/nextclade/run/meta.yml +++ b/modules/nf-core/nextclade/run/meta.yml @@ -18,13 +18,14 @@ input: Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - dataset: - type: file + type: directory description: Path containing the dataset files obtained by running nextclade dataset get pattern: "*" - fasta: type: file description: FASTA file containing one or more consensus sequences pattern: "*.{fasta,fa}" + output: - meta: type: map @@ -39,11 +40,31 @@ output: type: file description: CSV file containing nextclade results pattern: "*.{csv}" + - csv_errors: + type: file + description: CSV file containing errors from nextclade results + pattern: "*.{errors.csv}" + - csv_insertions: + type: file + description: CSV file containing insertions from nextclade results + pattern: "*.{insertions.csv}" + - fasta_aligned: + type: file + description: FASTA file containing aligned sequences from nextclade results + pattern: "*.{aligned.fasta}" + - fasta_translation: + type: file + description: FASTA file containing aligned peptides from nextclade results + pattern: "*.{_translation.}*.{fasta}" + - ndjson: + type: file + description: newline-delimited JSON file containing nextclade results + pattern: "*.{ndjson}" - json: type: file description: JSON file containing nextclade results pattern: "*.{json}" - - json_tree: + - json_auspice: type: file description: Auspice JSON V2 containing nextclade results pattern: "*.{tree.json}" @@ -51,9 +72,16 @@ output: type: file description: TSV file containing nextclade results pattern: "*.{tsv}" + - nwk: + type: file + description: NWK file containing nextclade results + pattern: "*.{nwk}" authors: - "@antunderwood" - "@drpatelh" maintainers: - "@antunderwood" - "@drpatelh" + - "@drpatelh" +updated on 2024.08.23: + - "@nmshahir" diff --git a/modules/nf-core/nextclade/run/tests/main.nf.test b/modules/nf-core/nextclade/run/tests/main.nf.test new file mode 100644 index 00000000000..b486a3fe6b8 --- /dev/null +++ b/modules/nf-core/nextclade/run/tests/main.nf.test @@ -0,0 +1,82 @@ + +nextflow_process { + + name "Test Process NEXTCLADE_RUN" + script "../main.nf" + process "NEXTCLADE_RUN" + + tag "modules" + tag "modules_nfcore" + tag "nextclade" + tag "nextclade/datasetget" + tag "nextclade/run" + + setup { + run("NEXTCLADE_DATASETGET") { + script "../../datasetget/main.nf" + process { + """ + input[0] = 'nextstrain/sars-cov-2/wuhan-hu-1/orfs' + input[1] = '2024-01-16--20-31-02Z' + + """ + } + } + } + + test("sarscov2 default") { + + when { + process { + """ + input[0] = [[id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = NEXTCLADE_DATASETGET.out.dataset + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot( + process.out.csv, + process.out.csv_errors, + process.out.csv_insertions, + process.out.fasta_aligned, + process.out.fasta_translation, + file(process.out.json[0][1]).readLines()[4..10], + process.out.json_auspice, + process.out.ndjson, + process.out.nwk, + process.out.tsv, + process.out.versions + ).match() } + ) + } + } + + test("sarscov2 default-stub") { + options '-stub' + + when { + process { + """ + input[0] = [[id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = NEXTCLADE_DATASETGET.out.dataset + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/nextclade/run/tests/main.nf.test.snap b/modules/nf-core/nextclade/run/tests/main.nf.test.snap new file mode 100644 index 00000000000..9294ed3a203 --- /dev/null +++ b/modules/nf-core/nextclade/run/tests/main.nf.test.snap @@ -0,0 +1,245 @@ +{ + "sarscov2 default-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "10": [ + "versions.yml:md5,f279e9049492abc589365716afc17d78" + ], + "2": [ + + ], + "3": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test" + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "test" + }, + "test.auspice.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + + ], + "7": [ + [ + { + "id": "test" + }, + "test.aligned.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + [ + { + "id": "test" + }, + "test.cds_translation.test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "9": [ + [ + { + "id": "test" + }, + "test.nwk:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "csv": [ + [ + { + "id": "test" + }, + "test.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "csv_errors": [ + + ], + "csv_insertions": [ + + ], + "fasta_aligned": [ + [ + { + "id": "test" + }, + "test.aligned.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fasta_translation": [ + [ + { + "id": "test" + }, + "test.cds_translation.test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test" + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json_auspice": [ + [ + { + "id": "test" + }, + "test.auspice.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "ndjson": [ + + ], + "nwk": [ + [ + { + "id": "test" + }, + "test.nwk:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tsv": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,f279e9049492abc589365716afc17d78" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-07T07:21:00.853787859" + }, + "sarscov2 default": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.csv:md5,59667a74af31daf6151b809cb4645942" + ] + ], + [ + + ], + [ + + ], + [ + [ + { + "id": "test" + }, + "test.aligned.fasta:md5,1bf54662837b0df37f1857c7fa631225" + ] + ], + [ + [ + { + "id": "test" + }, + [ + "test.cds_translation.E.fasta:md5,1a6d93bd7abfeb193476a86950f07202", + "test.cds_translation.M.fasta:md5,6f79ab0742c078fcd9d2a474518c7022", + "test.cds_translation.N.fasta:md5,bef9912f101777bfff36225d7e5c3c1f", + "test.cds_translation.ORF1a.fasta:md5,4dc0e2eb1f2a61939ba49500ee3fa41a", + "test.cds_translation.ORF1b.fasta:md5,9c2e83d26161b5c887ff51cd64bd15bb", + "test.cds_translation.ORF3a.fasta:md5,adcbede4ebc2cac7af755a9d29d28ea3", + "test.cds_translation.ORF6.fasta:md5,3785b34cce978c95256f83db6ee82af0", + "test.cds_translation.ORF7a.fasta:md5,6ede1acb9e75afc84aa30bbc40551d37", + "test.cds_translation.ORF7b.fasta:md5,460e4cbc5f8c632c2bc9a8aedad5cf43", + "test.cds_translation.ORF8.fasta:md5,c733c88e61b29542664368fbf6dd4c76", + "test.cds_translation.ORF9b.fasta:md5,0aa13afc6cbf445fc92caa2e6c0a7548", + "test.cds_translation.S.fasta:md5,77740927a3f00b7e5bfac392fa6d264c" + ] + ] + ], + [ + " \"cladeNodeAttrKeys\": [", + " {", + " \"name\": \"Nextclade_pango\",", + " \"displayName\": \"Pango lineage (Nextclade)\",", + " \"description\": \"Pango lineage as inferred by Nextclade from the nearest neighbour in the reference tree. 98% accurate for recent sequences, for higher accuracy use dedicated pangolin software in UShER or pangoLEARN mode. Recombinants may get (wrongly) assigned to a designated recombinant lineage if they have similar breakpoints.\",", + " \"hideInWeb\": false,", + " \"skipAsReference\": false" + ], + [ + [ + { + "id": "test" + }, + "test.auspice.json:md5,84f57eb4611ffdf73eefb855819acb1d" + ] + ], + [ + [ + { + "id": "test" + }, + "test.ndjson:md5,946c0a0038ae937dab725d08a67c3c64" + ] + ], + [ + [ + { + "id": "test" + }, + "test.nwk:md5,70e9847b5fd44172e21323fe95ea57f8" + ] + ], + [ + [ + { + "id": "test" + }, + "test.tsv:md5,165384807e9a323da6bd15fc7f92420d" + ] + ], + [ + "versions.yml:md5,f279e9049492abc589365716afc17d78" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-07T07:20:48.066964467" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 87dbeaad348..f10ddc6b929 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -470,9 +470,6 @@ nanomonsv/parse: ncbitools/vecscreen: - modules/nf-core/ncbitools/vecscreen/** - tests/modules/nf-core/ncbitools/vecscreen/** -nextclade/run: - - modules/nf-core/nextclade/run/** - - tests/modules/nf-core/nextclade/run/** nucmer: - modules/nf-core/nucmer/** - tests/modules/nf-core/nucmer/** diff --git a/tests/modules/nf-core/nextclade/run/main.nf b/tests/modules/nf-core/nextclade/run/main.nf deleted file mode 100644 index 5c44ea4e7f3..00000000000 --- a/tests/modules/nf-core/nextclade/run/main.nf +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { NEXTCLADE_DATASETGET } from '../../../../../modules/nf-core/nextclade/datasetget/main.nf' -include { NEXTCLADE_RUN } from '../../../../../modules/nf-core/nextclade/run/main.nf' - -workflow test_nextclade_run { - - dataset = 'sars-cov-2' - reference = 'MN908947' - tag = '2022-01-18T12:00:00Z' - - NEXTCLADE_DATASETGET ( dataset, reference, tag ) - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - - NEXTCLADE_RUN ( input, NEXTCLADE_DATASETGET.out.dataset ) -} - diff --git a/tests/modules/nf-core/nextclade/run/test.yml b/tests/modules/nf-core/nextclade/run/test.yml deleted file mode 100644 index ea6b9cf57f9..00000000000 --- a/tests/modules/nf-core/nextclade/run/test.yml +++ /dev/null @@ -1,62 +0,0 @@ -- name: nextclade run test_nextclade_run - command: nextflow run ./tests/modules/nf-core/nextclade/run -entry test_nextclade_run -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/nextclade/run/nextflow.config - tags: - - nextclade/run - - nextclade - files: - - path: output/nextclade/sars-cov-2/genemap.gff - md5sum: 21ebebfd0f416eeb959e55ebffd808e8 - - path: output/nextclade/sars-cov-2/primers.csv - md5sum: 5990c3483bf66ce607aeb90a44e7ef2e - - path: output/nextclade/sars-cov-2/qc.json - md5sum: c512f51fda0212b21ffff05779180963 - - path: output/nextclade/sars-cov-2/reference.fasta - md5sum: c7ce05f28e4ec0322c96f24e064ef55c - - path: output/nextclade/sars-cov-2/sequences.fasta - md5sum: 41129d255b99e0e92bdf20e866b99a1b - - path: output/nextclade/sars-cov-2/tag.json - md5sum: 402ac2b87e2a6a64a3fbf5ad16497af3 - - path: output/nextclade/sars-cov-2/tree.json - md5sum: b8f32f547ff9e2131d6fc66b68fc54b1 - - path: output/nextclade/sars-cov-2/virus_properties.json - md5sum: 5f2de3949e07cb633f3d9e4a7654dc81 - - path: output/nextclade/test.aligned.fasta - md5sum: 1bf54662837b0df37f1857c7fa631225 - - path: output/nextclade/test.auspice.json - md5sum: 04d8c32f141435ca45bf430dcb59bcba - - path: output/nextclade/test.csv - md5sum: 7ff4df651dd4199ec9e6b02134271fb5 - - path: output/nextclade/test.errors.csv - md5sum: 810d1c72e1ed010a9a017afba7ce8063 - - path: output/nextclade/test.insertions.csv - md5sum: c3aa7071d06122ec07ba7c7c4ba6e84a - - path: output/nextclade/test.json - contains: ["nextcladeAlgoVersion"] - - path: output/nextclade/test.ndjson - md5sum: 0aa70ebfa0c9cc262de4cfc6544cd20f - - path: output/nextclade/test.tsv - md5sum: cae39bb97064867ddf748c2f75ca0ae9 - - path: output/nextclade/test_gene_E.translation.fasta - md5sum: 1a6d93bd7abfeb193476a86950f07202 - - path: output/nextclade/test_gene_M.translation.fasta - md5sum: 6f79ab0742c078fcd9d2a474518c7022 - - path: output/nextclade/test_gene_N.translation.fasta - md5sum: bef9912f101777bfff36225d7e5c3c1f - - path: output/nextclade/test_gene_ORF1a.translation.fasta - md5sum: 4dc0e2eb1f2a61939ba49500ee3fa41a - - path: output/nextclade/test_gene_ORF1b.translation.fasta - md5sum: 9c2e83d26161b5c887ff51cd64bd15bb - - path: output/nextclade/test_gene_ORF3a.translation.fasta - md5sum: adcbede4ebc2cac7af755a9d29d28ea3 - - path: output/nextclade/test_gene_ORF6.translation.fasta - md5sum: 3785b34cce978c95256f83db6ee82af0 - - path: output/nextclade/test_gene_ORF7a.translation.fasta - md5sum: 6ede1acb9e75afc84aa30bbc40551d37 - - path: output/nextclade/test_gene_ORF7b.translation.fasta - md5sum: 460e4cbc5f8c632c2bc9a8aedad5cf43 - - path: output/nextclade/test_gene_ORF8.translation.fasta - md5sum: c733c88e61b29542664368fbf6dd4c76 - - path: output/nextclade/test_gene_ORF9b.translation.fasta - md5sum: 0aa13afc6cbf445fc92caa2e6c0a7548 - - path: output/nextclade/test_gene_S.translation.fasta - md5sum: 77740927a3f00b7e5bfac392fa6d264c From 6dd363c9b9b7cf30c4418597d20b6861848f0475 Mon Sep 17 00:00:00 2001 From: Anabella Trigila <18577080+atrigila@users.noreply.github.com> Date: Wed, 11 Sep 2024 02:52:53 -0300 Subject: [PATCH 2/2] Add optional config mode in `mirtrace/qc` (#6623) * add optional config file * update mirtrace/qc --- modules/nf-core/mirtrace/qc/main.nf | 5 +- modules/nf-core/mirtrace/qc/meta.yml | 3 + .../nf-core/mirtrace/qc/tests/main.nf.test | 53 ++++++++++++++- .../mirtrace/qc/tests/main.nf.test.snap | 65 ++++++++++++++++++- 4 files changed, 119 insertions(+), 7 deletions(-) diff --git a/modules/nf-core/mirtrace/qc/main.nf b/modules/nf-core/mirtrace/qc/main.nf index 9d047a7a1e3..5893c0d72e6 100644 --- a/modules/nf-core/mirtrace/qc/main.nf +++ b/modules/nf-core/mirtrace/qc/main.nf @@ -8,7 +8,7 @@ process MIRTRACE_QC { 'biocontainers/mirtrace:1.0.1--0' }" input: - tuple val(meta), path(reads) + tuple val(meta), path(reads), path(mirtrace_config) val(mirtrace_species) output: @@ -25,6 +25,7 @@ process MIRTRACE_QC { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def mirtrace_mode = mirtrace_config ? "--config ${mirtrace_config}": "${reads}" """ mirtrace qc \\ @@ -32,7 +33,7 @@ process MIRTRACE_QC { --write-fasta \\ --output-dir . \\ --force \\ - ${reads} + ${mirtrace_mode} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/mirtrace/qc/meta.yml b/modules/nf-core/mirtrace/qc/meta.yml index 7f58ae2bd02..9870437d98d 100644 --- a/modules/nf-core/mirtrace/qc/meta.yml +++ b/modules/nf-core/mirtrace/qc/meta.yml @@ -25,6 +25,9 @@ input: type: file description: microRNA sequencing data pattern: "*.{fastq,fastq.gz}" + - mirtrace_config: + type: file + description: (Optional) CSV with list of FASTQ files to process with one entry per row. No headers. Each row consists of the following columns "FASTQ file path, id, adapter, PHRED-ASCII-offset". - mirtrace_species: type: string description: Target species in microRNA sequencing data (miRbase encoding, e.g. “hsa” for Homo sapiens) diff --git a/modules/nf-core/mirtrace/qc/tests/main.nf.test b/modules/nf-core/mirtrace/qc/tests/main.nf.test index 9ce14fd468c..d0ef1c7b3bd 100644 --- a/modules/nf-core/mirtrace/qc/tests/main.nf.test +++ b/modules/nf-core/mirtrace/qc/tests/main.nf.test @@ -18,7 +18,8 @@ nextflow_process { [ id:'test', single_end:false ], // meta map [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true) - ] + ], + [] ] input[1] = "hsa" """ @@ -61,7 +62,8 @@ nextflow_process { [ id:'test', single_end:false ], // meta map [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true), - ] + ], + [] ] input[1] = "hsa" """ @@ -77,4 +79,51 @@ nextflow_process { } + test("human - fastq - optional config") { + + when { + process { + """ + ch_reads = Channel.of([ + [ id:'test' ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true) + ] + ]) + + ch_mirtrace_config = Channel.of( + "./test_rnaseq_1.fastq.gz,test_rnaseq_1,TGGAATTCTCGGGTGCCAAGG,33") + .collectFile(name: "mirtrace_config.txt", newLine: true) + + input[0] = ch_reads + .combine(ch_mirtrace_config) + + input[1] = "hsa" + + """ + } + } + + then { + assertAll( + { assert process.success }, + + // Check HTML + { assert path(process.out.html.get(0).get(1)).text.contains("This file is part of miRTrace.")} , + + // Check JSON + { assert path(process.out.json.get(0).get(1)).json.results[0].stats.uniqueQCPassedSeqsCount == 912 }, + + // Check TSV + { assert snapshot(process.out.tsv).match("tsv_config") }, + + // Check FASTA files + { assert snapshot(process.out.rnatype_unknown_fa).match("rnatype_unknown_fa_config") }, + { assert snapshot(process.out.all_fa).match("all_fa_config") }, + + ) + } + + } + } diff --git a/modules/nf-core/mirtrace/qc/tests/main.nf.test.snap b/modules/nf-core/mirtrace/qc/tests/main.nf.test.snap index 22efdd9e9b9..3f5593b73a1 100644 --- a/modules/nf-core/mirtrace/qc/tests/main.nf.test.snap +++ b/modules/nf-core/mirtrace/qc/tests/main.nf.test.snap @@ -1,4 +1,21 @@ { + "all_fa_config": { + "content": [ + [ + [ + { + "id": "test" + }, + "test_rnaseq_1.fasta:md5,125963c9ee39a49b3a680903e28e7c9d" + ] + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-10T18:35:10.022991825" + }, "all_fa": { "content": [ [ @@ -15,7 +32,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-05T18:05:42.043272808" + "timestamp": "2024-09-10T18:33:02.971744888" }, "versions": { "content": [ @@ -29,6 +46,31 @@ }, "timestamp": "2024-09-02T14:00:50.712738593" }, + "tsv_config": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "mirtrace-stats-contamination_basic.tsv:md5,ac69ca6d2a709854f1048b635d06e927", + "mirtrace-stats-contamination_detailed.tsv:md5,ef80997ac12662c64cbcf5fe9851e786", + "mirtrace-stats-length.tsv:md5,630b3a845953321ae4cf2fc4a4943ab5", + "mirtrace-stats-mirna-complexity.tsv:md5,ab2a7600a2daa5c1797eea13d0abc2f0", + "mirtrace-stats-phred.tsv:md5,44eaeae26ec629e71fb31e56bfb5a548", + "mirtrace-stats-qcstatus.tsv:md5,623cf3a0c5e363488966844feb0dd978", + "mirtrace-stats-rnatype.tsv:md5,ed8d3a76247a1432a365def87c3f4c67" + ] + ] + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-10T18:35:09.99291948" + }, "tsv": { "content": [ [ @@ -53,7 +95,24 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-05T18:05:41.888457948" + "timestamp": "2024-09-10T18:33:02.856967195" + }, + "rnatype_unknown_fa_config": { + "content": [ + [ + [ + { + "id": "test" + }, + "test_rnaseq_1.fasta:md5,125963c9ee39a49b3a680903e28e7c9d" + ] + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-10T18:35:10.010723637" }, "human - fastq - stub": { "content": [ @@ -178,6 +237,6 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-05T18:05:41.978281344" + "timestamp": "2024-09-10T18:33:02.917439516" } } \ No newline at end of file