From 51e9fa8d84162883adcb36d7293db3210642a3c0 Mon Sep 17 00:00:00 2001 From: Hyun-Hwan Jeong Date: Wed, 14 May 2025 15:53:51 -0500 Subject: [PATCH] nf-test migration for universc --- modules/nf-core/universc/main.nf | 1 + modules/nf-core/universc/meta.yml | 7 ++ modules/nf-core/universc/tests/main.nf.test | 88 +++++++++++++++ .../nf-core/universc/tests/main.nf.test.snap | 104 ++++++++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/universc/main.nf | 33 ------ .../modules/nf-core/universc/nextflow.config | 17 --- tests/modules/nf-core/universc/test.yml | 68 ------------ 8 files changed, 200 insertions(+), 121 deletions(-) create mode 100644 modules/nf-core/universc/tests/main.nf.test create mode 100644 modules/nf-core/universc/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/universc/main.nf delete mode 100644 tests/modules/nf-core/universc/nextflow.config delete mode 100644 tests/modules/nf-core/universc/test.yml diff --git a/modules/nf-core/universc/main.nf b/modules/nf-core/universc/main.nf index de8394a03d1..4eb0054249d 100644 --- a/modules/nf-core/universc/main.nf +++ b/modules/nf-core/universc/main.nf @@ -49,6 +49,7 @@ process UNIVERSC { --per-cell-data \\ $args 1> _log 2> _err + mkdir sample-${meta.id}/outs/ # save log files echo !! > sample-${meta.id}/outs/_invocation cp _log sample-${meta.id}/outs/_log diff --git a/modules/nf-core/universc/meta.yml b/modules/nf-core/universc/meta.yml index af350b380ed..8cbdedc95a4 100644 --- a/modules/nf-core/universc/meta.yml +++ b/modules/nf-core/universc/meta.yml @@ -28,24 +28,31 @@ input: type: file description: FASTQ or FASTQ.GZ file, list of 2 files for paired-end data pattern: "*.{fastq,fq,fastq.gz,fq.gz}" + ontologies: + - edam: http://edamontology.org/format_1930 # FASTQ - - reference: type: file description: Reference genome file + ontologies: [] output: - outs: - meta: type: file description: Files containing the outputs of Cell Ranger pattern: "sample-${meta.id}/outs/*" + ontologies: [] - sample-${meta.id}/outs/*: type: file description: Files containing the outputs of Cell Ranger pattern: "sample-${meta.id}/outs/*" + ontologies: [] - versions: - versions.yml: type: file description: File containing software version pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@kbattenb" - "@tomkellygenetics" diff --git a/modules/nf-core/universc/tests/main.nf.test b/modules/nf-core/universc/tests/main.nf.test new file mode 100644 index 00000000000..b3b1b700275 --- /dev/null +++ b/modules/nf-core/universc/tests/main.nf.test @@ -0,0 +1,88 @@ +nextflow_process { + + name "Test Process UNIVERSC" + script "../main.nf" + process "UNIVERSC" + + tag "modules" + tag "modules_nfcore" + tag "cellranger" + tag "cellranger/mkgtf" + tag "cellranger/mkref" + tag "universc" + + setup { + run("CELLRANGER_MKGTF") { + script "../../cellranger/mkgtf/main.nf" + + process { + """ + input[0] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf',checkIfExists:true) + """ + } + } + + run("CELLRANGER_MKREF") { + script "../../cellranger/mkref/main.nf" + + process { + """ + input[0] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta',checkIfExists:true) + input[1] = CELLRANGER_MKGTF.out.gtf + input[2] = "homo_sapiens_chr22_reference" + """ + } + } + } + + test("test_universc_10x") { + + when { + params { + module_args = '' + } + process { + """ + input[0] = [[id:'123',technology:'10x',chemistry:'SC3Pv3',single_end:false,strandedness:'forward',samples:["test_10x"]],// meta map + [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R1_001.fastq.gz',checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R2_001.fastq.gz',checkIfExists:true) + ] + ] + input[1] = CELLRANGER_MKREF.out.reference + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + + test("test_universc_10x -- stub") { + options '-stub' + when { + params { + module_args = '' + } + process { + """ + input[0] = [[id:'123',technology:'10x',chemistry:'SC3Pv3',single_end:false,strandedness:'forward',samples:["test_10x"]],// meta map + [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R1_001.fastq.gz',checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R2_001.fastq.gz',checkIfExists:true) + ] + ] + input[1] = CELLRANGER_MKREF.out.reference + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/universc/tests/main.nf.test.snap b/modules/nf-core/universc/tests/main.nf.test.snap new file mode 100644 index 00000000000..27a288a9dbf --- /dev/null +++ b/modules/nf-core/universc/tests/main.nf.test.snap @@ -0,0 +1,104 @@ +{ + "test_universc_10x": { + "content": [ + { + "0": [ + [ + { + "id": "123", + "technology": "10x", + "chemistry": "SC3Pv3", + "single_end": false, + "strandedness": "forward", + "samples": [ + "test_10x" + ] + }, + [ + "_err:md5,92544b75bfe4ad17becb3fa17b83dac9", + "_invocation:md5,adbbbc1027756be9fdeebabf979863e5", + "_log:md5,f4ab003ca08293ce9a80a2b2a3b25749" + ] + ] + ], + "1": [ + "versions.yml:md5,70bfcfea05b26a198a980e8b0eabb348" + ], + "outs": [ + [ + { + "id": "123", + "technology": "10x", + "chemistry": "SC3Pv3", + "single_end": false, + "strandedness": "forward", + "samples": [ + "test_10x" + ] + }, + [ + "_err:md5,92544b75bfe4ad17becb3fa17b83dac9", + "_invocation:md5,adbbbc1027756be9fdeebabf979863e5", + "_log:md5,f4ab003ca08293ce9a80a2b2a3b25749" + ] + ] + ], + "versions": [ + "versions.yml:md5,70bfcfea05b26a198a980e8b0eabb348" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.2" + }, + "timestamp": "2025-05-14T15:52:03.725881758" + }, + "test_universc_10x -- stub": { + "content": [ + { + "0": [ + [ + { + "id": "123", + "technology": "10x", + "chemistry": "SC3Pv3", + "single_end": false, + "strandedness": "forward", + "samples": [ + "test_10x" + ] + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,70bfcfea05b26a198a980e8b0eabb348" + ], + "outs": [ + [ + { + "id": "123", + "technology": "10x", + "chemistry": "SC3Pv3", + "single_end": false, + "strandedness": "forward", + "samples": [ + "test_10x" + ] + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,70bfcfea05b26a198a980e8b0eabb348" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.2" + }, + "timestamp": "2025-05-14T15:52:10.667692329" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 7aaf25616a7..5fe3cc070ac 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -146,9 +146,6 @@ ultra/align: ultra/index: - modules/nf-core/ultra/index/** - tests/modules/nf-core/ultra/index/** -universc: - - modules/nf-core/universc/** - - tests/modules/nf-core/universc/** varlociraptor/callvariants: - modules/nf-core/varlociraptor/callvariants/** - tests/modules/nf-core/varlociraptor/callvariants/** diff --git a/tests/modules/nf-core/universc/main.nf b/tests/modules/nf-core/universc/main.nf deleted file mode 100644 index 6d57a6b7f24..00000000000 --- a/tests/modules/nf-core/universc/main.nf +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { CELLRANGER_MKGTF } from '../../../../modules/nf-core/cellranger/mkgtf/main.nf' -include { CELLRANGER_MKREF } from '../../../../modules/nf-core/cellranger/mkref/main.nf' -include { UNIVERSC } from '../../../../modules/nf-core/universc//main.nf' - -workflow test_universc_10x { - - input = [ [ id:'123', technology:'10x', chemistry:'SC3Pv3', single_end:false, strandedness:'forward', samples: ["test_10x"] ], // meta map - [ file(params.test_data['homo_sapiens']['10xgenomics']['cellranger']['test_10x_10k_pbmc_cmo_gex1_fastq_1_gz'], checkIfExists: true), - file(params.test_data['homo_sapiens']['10xgenomics']['cellranger']['test_10x_10k_pbmc_cmo_gex1_fastq_2_gz'], checkIfExists: true) - ] - ] - - fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) - gtf = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true) - reference_name = "homo_sapiens_chr22_reference" - - CELLRANGER_MKGTF ( gtf ) - - CELLRANGER_MKREF ( - fasta, - CELLRANGER_MKGTF.out.gtf, - reference_name - ) - - UNIVERSC ( - input, - CELLRANGER_MKREF.out.reference - ) -} diff --git a/tests/modules/nf-core/universc/nextflow.config b/tests/modules/nf-core/universc/nextflow.config deleted file mode 100644 index ed1409c9459..00000000000 --- a/tests/modules/nf-core/universc/nextflow.config +++ /dev/null @@ -1,17 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: UNIVERSC { - ext.args = '' - container = "nf-core/universc:1.2.5.1" - } - - withName: CELLRANGER_MKGTF { - container = "nf-core/universc:1.2.5.1" - } - withName: CELLRANGER_MKREF{ - container = "nf-core/universc:1.2.5.1" - } - -} diff --git a/tests/modules/nf-core/universc/test.yml b/tests/modules/nf-core/universc/test.yml deleted file mode 100644 index 9d4bf28909c..00000000000 --- a/tests/modules/nf-core/universc/test.yml +++ /dev/null @@ -1,68 +0,0 @@ -- name: universc test_universc_10x - command: nextflow run ./tests/modules/nf-core/universc -entry test_universc_10x -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/universc/nextflow.config - tags: - - universc - files: - - path: output/cellranger/genome.filtered.gtf - md5sum: 9dc1a510bbe4438cfc2a74423bf2b2bd - - path: output/cellranger/homo_sapiens_chr22_reference/fasta/genome.fa - md5sum: f315020d899597c1b57e5fe9f60f4c3e - - path: output/cellranger/homo_sapiens_chr22_reference/fasta/genome.fa.fai - md5sum: 3520cd30e1b100e55f578db9c855f685 - - path: output/cellranger/homo_sapiens_chr22_reference/genes/genes.gtf - md5sum: c37539d5bdae419bae799165d3f80c53 - - path: output/cellranger/homo_sapiens_chr22_reference/reference.json - md5sum: 1f7bf05454cc908bf70cd232ae70b02d - - path: output/cellranger/homo_sapiens_chr22_reference/star/Genome - md5sum: 22102926fadf5890e905ca71b2da3f35 - - path: output/cellranger/homo_sapiens_chr22_reference/star/SA - md5sum: bcf3e1a855783105150b46c905465333 - - path: output/cellranger/homo_sapiens_chr22_reference/star/SAindex - md5sum: b93fb07d342e6c32a00ebc4311c0ad38 - - path: output/cellranger/homo_sapiens_chr22_reference/star/chrLength.txt - md5sum: c81f40f27e72606d7d07097c1d56a5b5 - - path: output/cellranger/homo_sapiens_chr22_reference/star/chrName.txt - md5sum: 5ae68a67b70976ee95342a7451cb5af1 - - path: output/cellranger/homo_sapiens_chr22_reference/star/chrNameLength.txt - md5sum: b190587cae0531f3cf25552d8aa674db - - path: output/cellranger/homo_sapiens_chr22_reference/star/chrStart.txt - md5sum: bc73df776dd3d5bb9cfcbcba60880519 - - path: output/cellranger/homo_sapiens_chr22_reference/star/exonGeTrInfo.tab - md5sum: d04497f69d6ef889efd4d34fe63edcc4 - - path: output/cellranger/homo_sapiens_chr22_reference/star/exonInfo.tab - md5sum: 0d560290fab688b7268d88d5494bf9fe - - path: output/cellranger/homo_sapiens_chr22_reference/star/geneInfo.tab - md5sum: a20c70b081f5d83649c48ebbd951cb77 - - path: output/cellranger/homo_sapiens_chr22_reference/star/genomeParameters.txt - contains: ["genomeGenerate"] - - path: output/cellranger/homo_sapiens_chr22_reference/star/sjdbInfo.txt - md5sum: 5690ea9d9f09f7ff85b7fd47bd234903 - - path: output/cellranger/homo_sapiens_chr22_reference/star/sjdbList.fromGTF.out.tab - md5sum: 9e4f991abbbfeb3935a2bb21b9e258f1 - - path: output/cellranger/homo_sapiens_chr22_reference/star/sjdbList.out.tab - md5sum: 9e4f991abbbfeb3935a2bb21b9e258f1 - - path: output/cellranger/homo_sapiens_chr22_reference/star/transcriptInfo.tab - md5sum: 6fa11b4d34f4680a1c23dbcea2e050d5 - - path: output/cellranger/versions.yml - - path: output/universc/sample-123/outs/_err - - path: output/universc/sample-123/outs/_invocation - md5sum: adbbbc1027756be9fdeebabf979863e5 - - path: output/universc/sample-123/outs/_log - - path: output/universc/sample-123/outs/basic_stats.txt - md5sum: 90004df04ec7b65a0dd8d26a08e55fd2 - - path: output/universc/sample-123/outs/filtered_feature_bc_matrix.h5 - - path: output/universc/sample-123/outs/filtered_feature_bc_matrix/barcodes.tsv.gz - - path: output/universc/sample-123/outs/filtered_feature_bc_matrix/features.tsv.gz - - path: output/universc/sample-123/outs/filtered_feature_bc_matrix/matrix.mtx.gz - - path: output/universc/sample-123/outs/metrics_summary.csv - md5sum: bba1b122b15698d97a034af61e3fcd59 - - path: output/universc/sample-123/outs/molecule_info.h5 - - path: output/universc/sample-123/outs/possorted_genome_bam.bam - - path: output/universc/sample-123/outs/possorted_genome_bam.bam.bai - - path: output/universc/sample-123/outs/raw_feature_bc_matrix.h5 - - path: output/universc/sample-123/outs/raw_feature_bc_matrix/barcodes.tsv.gz - - path: output/universc/sample-123/outs/raw_feature_bc_matrix/features.tsv.gz - - path: output/universc/sample-123/outs/raw_feature_bc_matrix/matrix.mtx.gz - - path: output/universc/sample-123/outs/web_summary.html - contains: ["sample-123"] - - path: output/universc/versions.yml