From 0f2180be1a97b2717cec059ce2c28ae9f0489d01 Mon Sep 17 00:00:00 2001 From: wxicu Date: Tue, 23 Apr 2024 13:25:54 +0200 Subject: [PATCH 01/19] no message --- modules/nf-core/cellsnp/environment.yml | 9 +++ modules/nf-core/cellsnp/main.nf | 59 +++++++++++++++++++ modules/nf-core/cellsnp/meta.yml | 62 ++++++++++++++++++++ modules/nf-core/cellsnp/tests/main.nf.test | 66 ++++++++++++++++++++++ modules/nf-core/cellsnp/tests/tags.yml | 2 + 5 files changed, 198 insertions(+) create mode 100644 modules/nf-core/cellsnp/environment.yml create mode 100644 modules/nf-core/cellsnp/main.nf create mode 100644 modules/nf-core/cellsnp/meta.yml create mode 100644 modules/nf-core/cellsnp/tests/main.nf.test create mode 100644 modules/nf-core/cellsnp/tests/tags.yml diff --git a/modules/nf-core/cellsnp/environment.yml b/modules/nf-core/cellsnp/environment.yml new file mode 100644 index 00000000000..19befca4100 --- /dev/null +++ b/modules/nf-core/cellsnp/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "cellsnp" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::cellsnp-lite=1.2.3" diff --git a/modules/nf-core/cellsnp/main.nf b/modules/nf-core/cellsnp/main.nf new file mode 100644 index 00000000000..271f43ff9cc --- /dev/null +++ b/modules/nf-core/cellsnp/main.nf @@ -0,0 +1,59 @@ +process CELLSNP { + tag "$meta.id" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/cellsnp-lite:1.2.3--h6141fd1_2' : + 'biocontainers/cellsnp-lite:1.2.3--h6141fd1_2' }" + + input: + tuple val(meta), path(bam), path(bam_list), path(region_vcf), path(barcode), path(sample_list) + + output: + tuple val(meta), path("$prefix") , emit: cellsnp_output + path 'versions.yml' , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def input_bam = bam_list ? "-S $bam_list" : "-s $bam" + def barcode_file = barcode ? "-b $barcode" : '' + def region_file = region_vcf ? "-R $region_vcf" : '' + def sample = sample_list ? "-I $sample_list" : '' + + """ + cellsnp-lite $input_bam \\ + $barcode_file \\ + $region file \\ + $sample \\ + -O $prefix \\ + --nproc $task.cpus \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cellsnp: \$(cellsnp-lite --v |& awk '{print \$2}') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def input_bam = bam_list ? "-S $bam_list" : "-s $bam" + def barcode_file = barcode ? "-b $barcode" : '' + def region_file = region_vcf ? "-R $region_vcf" : '' + def sample = sample_list ? "-I $sample_list" : '' + + """ + mkdir $prefix + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cellsnp: \$(cellsnp-lite --v |& awk '{print \$2}') + END_VERSIONS + """ +} diff --git a/modules/nf-core/cellsnp/meta.yml b/modules/nf-core/cellsnp/meta.yml new file mode 100644 index 00000000000..c6cb31d356e --- /dev/null +++ b/modules/nf-core/cellsnp/meta.yml @@ -0,0 +1,62 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "cellsnp" +description: Cellsnp-lite is a C/C++ tool for efficient genotyping bi-allelic SNPs on single cells. You can use cellsnp-lite after read alignment to obtain the snp x cell pileup UMI or read count matrices for each alleles of given or detected SNPs. +keywords: + - genotype + - SNP +tools: + - "cellsnp": + description: "Efficient genotyping bi-allelic SNPs on single cells" + homepage: "https://github.com/single-cell-genetics/cellsnp-lite" + documentation: "https://cellsnp-lite.readthedocs.io" + tool_dev_url: "https://github.com/single-cell-genetics/cellsnp-lite" + doi: "" + licence: ["Apache-2.0"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - bam: + type: file + description: Indexed BAM/CRAM file(s), comma separated multiple samples. + pattern: "*.{bam,cram,sam}" + - bam_list: + type: file + description: A file listing BAM/CRAM files, each per line. + - region_vcf: + type: file + description: A vcf file listing all candidate SNPs, for fetch each variants. + pattern: "*.{vcf, vcf.gz}" + - barcode: + type: file + description: A plain file listing all effective cell barcodes. + pattern: "*.tsv" + - sample_list: + type: file + description: A list file containing sample IDs, each per line. + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1']` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + + - cellsnp_output: + type: folder + description: A folder with the output of cellsnp. + +authors: + - "@wxicu" +maintainers: + - "@wxicu" diff --git a/modules/nf-core/cellsnp/tests/main.nf.test b/modules/nf-core/cellsnp/tests/main.nf.test new file mode 100644 index 00000000000..b4545343af4 --- /dev/null +++ b/modules/nf-core/cellsnp/tests/main.nf.test @@ -0,0 +1,66 @@ +// nf-core modules test cellsnp +nextflow_process { + + name "Test Process CELLSNP" + script "../main.nf" + process "CELLSNP" + + tag "modules" + tag "modules_nfcore" + tag "cellsnp" + + test("genotyping") { + when { + process { + """ + input[0] = [ + [ id:'sample1'], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), + [], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("genotyping - stub") { + + options "-stub" + + when { + process { + """ + + input[0] = [ + [ id:'sample1'], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), + [], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/cellsnp/tests/tags.yml b/modules/nf-core/cellsnp/tests/tags.yml new file mode 100644 index 00000000000..8e1a046b2ca --- /dev/null +++ b/modules/nf-core/cellsnp/tests/tags.yml @@ -0,0 +1,2 @@ +cellsnp: + - "modules/nf-core/cellsnp/**" From ddca5b03f16b39fde920cfe3640b8607791b8477 Mon Sep 17 00:00:00 2001 From: wxicu Date: Tue, 23 Apr 2024 21:24:53 +0200 Subject: [PATCH 02/19] add bam index --- modules/nf-core/cellsnp/main.nf | 8 ++---- modules/nf-core/cellsnp/meta.yml | 5 ++-- modules/nf-core/cellsnp/tests/main.nf.test | 33 ++++++++++++++++------ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/modules/nf-core/cellsnp/main.nf b/modules/nf-core/cellsnp/main.nf index 271f43ff9cc..82643693e1f 100644 --- a/modules/nf-core/cellsnp/main.nf +++ b/modules/nf-core/cellsnp/main.nf @@ -8,7 +8,7 @@ process CELLSNP { 'biocontainers/cellsnp-lite:1.2.3--h6141fd1_2' }" input: - tuple val(meta), path(bam), path(bam_list), path(region_vcf), path(barcode), path(sample_list) + tuple val(meta), path(bam), path(bai), path(region_vcf), path(barcode), path(sample_list) output: tuple val(meta), path("$prefix") , emit: cellsnp_output @@ -20,15 +20,14 @@ process CELLSNP { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def input_bam = bam_list ? "-S $bam_list" : "-s $bam" def barcode_file = barcode ? "-b $barcode" : '' def region_file = region_vcf ? "-R $region_vcf" : '' def sample = sample_list ? "-I $sample_list" : '' """ - cellsnp-lite $input_bam \\ + cellsnp-lite -s $bam \\ $barcode_file \\ - $region file \\ + $region_file \\ $sample \\ -O $prefix \\ --nproc $task.cpus \\ @@ -43,7 +42,6 @@ process CELLSNP { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def input_bam = bam_list ? "-S $bam_list" : "-s $bam" def barcode_file = barcode ? "-b $barcode" : '' def region_file = region_vcf ? "-R $region_vcf" : '' def sample = sample_list ? "-I $sample_list" : '' diff --git a/modules/nf-core/cellsnp/meta.yml b/modules/nf-core/cellsnp/meta.yml index c6cb31d356e..95af09d7d6c 100644 --- a/modules/nf-core/cellsnp/meta.yml +++ b/modules/nf-core/cellsnp/meta.yml @@ -25,9 +25,10 @@ input: type: file description: Indexed BAM/CRAM file(s), comma separated multiple samples. pattern: "*.{bam,cram,sam}" - - bam_list: + - bai: type: file - description: A file listing BAM/CRAM files, each per line. + description: Index of the BAM/CRAM file. + pattern: "*.{bai,crai}" - region_vcf: type: file description: A vcf file listing all candidate SNPs, for fetch each variants. diff --git a/modules/nf-core/cellsnp/tests/main.nf.test b/modules/nf-core/cellsnp/tests/main.nf.test index b4545343af4..e2a33d15f34 100644 --- a/modules/nf-core/cellsnp/tests/main.nf.test +++ b/modules/nf-core/cellsnp/tests/main.nf.test @@ -10,17 +10,31 @@ nextflow_process { tag "cellsnp" test("genotyping") { + setup { + run("SAMTOOLS_INDEX") { + script "../../../samtools/index/main.nf" + process { + """ + input[0] = [ + [ id:'sample1' ], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true) ] + """ + } + } + } + when { process { - """ - input[0] = [ - [ id:'sample1'], // meta map - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), - [], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), - [] - ] + """ + input[0] = SAMTOOLS_INDEX.out.bai.collect{ meta, bai -> bai }.map{ + bai -> [[ id: 'sample1'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), + bai, + [], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), + [] + ]} """ } } @@ -46,6 +60,7 @@ nextflow_process { [ id:'sample1'], // meta map file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), [], + [], file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), [] From 485bbe5b3f76f171d9fae5dbf7107337de3a1da4 Mon Sep 17 00:00:00 2001 From: Xichen Wu Date: Tue, 23 Apr 2024 23:33:29 +0200 Subject: [PATCH 03/19] add test --- modules/nf-core/cellsnp/main.nf | 17 ++++++++-- modules/nf-core/cellsnp/meta.yml | 32 ++++++++++++++++--- modules/nf-core/cellsnp/tests/main.nf.test | 21 ++++++++---- .../nf-core/cellsnp/tests/main.nf.test.snap | 26 +++++++++++++++ 4 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 modules/nf-core/cellsnp/tests/main.nf.test.snap diff --git a/modules/nf-core/cellsnp/main.nf b/modules/nf-core/cellsnp/main.nf index 82643693e1f..35378e2891c 100644 --- a/modules/nf-core/cellsnp/main.nf +++ b/modules/nf-core/cellsnp/main.nf @@ -11,7 +11,12 @@ process CELLSNP { tuple val(meta), path(bam), path(bai), path(region_vcf), path(barcode), path(sample_list) output: - tuple val(meta), path("$prefix") , emit: cellsnp_output + tuple val(meta), path('*/cellSNP.base.vcf.gz') , emit: base + tuple val(meta), path('*/cellSNP.cells.vcf.gz') , emit: cell, optional: true + tuple val(meta), path('*/cellSNP.samples.tsv') , emit: sample + tuple val(meta), path('*/cellSNP.tag.AD.mtx') , emit: allele_depth + tuple val(meta), path('*/cellSNP.tag.DP.mtx') , emit: depth_coverage + tuple val(meta), path('*/cellSNP.tag.OTH.mtx') , emit: depth_other path 'versions.yml' , emit: versions when: @@ -31,11 +36,12 @@ process CELLSNP { $sample \\ -O $prefix \\ --nproc $task.cpus \\ + --gzip \\ $args cat <<-END_VERSIONS > versions.yml "${task.process}": - cellsnp: \$(cellsnp-lite --v |& awk '{print \$2}') + cellsnp: \$(cellsnp-lite --v | awk '{print \$2}') END_VERSIONS """ @@ -48,10 +54,15 @@ process CELLSNP { """ mkdir $prefix + touch $prefix/cellSNP.base.vcf.gz + touch $prefix/cellSNP.samples.tsv + touch $prefix/cellSNP.tag.AD.mtx + touch $prefix/cellSNP.tag.DP.mtx + touch $prefix/cellSNP.tag.OTH.mtx cat <<-END_VERSIONS > versions.yml "${task.process}": - cellsnp: \$(cellsnp-lite --v |& awk '{print \$2}') + cellsnp: \$(cellsnp-lite --v | awk '{print \$2}') END_VERSIONS """ } diff --git a/modules/nf-core/cellsnp/meta.yml b/modules/nf-core/cellsnp/meta.yml index 95af09d7d6c..5ef75514f29 100644 --- a/modules/nf-core/cellsnp/meta.yml +++ b/modules/nf-core/cellsnp/meta.yml @@ -3,7 +3,8 @@ name: "cellsnp" description: Cellsnp-lite is a C/C++ tool for efficient genotyping bi-allelic SNPs on single cells. You can use cellsnp-lite after read alignment to obtain the snp x cell pileup UMI or read count matrices for each alleles of given or detected SNPs. keywords: - - genotype + - genotyping + - single cell - SNP tools: - "cellsnp": @@ -11,7 +12,7 @@ tools: homepage: "https://github.com/single-cell-genetics/cellsnp-lite" documentation: "https://cellsnp-lite.readthedocs.io" tool_dev_url: "https://github.com/single-cell-genetics/cellsnp-lite" - doi: "" + doi: "10.1093/bioinformatics/btab358" licence: ["Apache-2.0"] input: @@ -53,9 +54,30 @@ output: description: File containing software versions pattern: "versions.yml" - - cellsnp_output: - type: folder - description: A folder with the output of cellsnp. + - base: + type: file + description: A VCF file listing genotyped SNPs and aggregated AD & DP infomation (without GT). + pattern: "*.base.vcf.gz" + - cell: + type: file + description: A VCF file listing genotyped SNPs and aggregated AD & DP infomation & genotype (GT) information for each cell or sample. + pattern: "*.cells.vcf.gz" + - sample: + type: file + description: A TSV file listing cell barcodes or sample IDs. + pattern: "*.tsv" + - allele_depth: + type: file + description: A file in “Matrix Market exchange formats”, containing the allele depths of the alternative (ALT) alleles. + pattern: "*.tag.AD.mtx" + - depth_coverage: + type: file + description: A file in “Matrix Market exchange formats”, containing the sum of allele depths of the reference and alternative alleles (REF + ALT). + pattern: "*.tag.DP.mtx" + - depth_other: + type: file + description: A file in “Matrix Market exchange formats”, containing the sum of allele depths of all the alleles other than REF and ALT. + pattern: "*.tag.OTH.mtx" authors: - "@wxicu" diff --git a/modules/nf-core/cellsnp/tests/main.nf.test b/modules/nf-core/cellsnp/tests/main.nf.test index e2a33d15f34..a8756e91367 100644 --- a/modules/nf-core/cellsnp/tests/main.nf.test +++ b/modules/nf-core/cellsnp/tests/main.nf.test @@ -8,11 +8,12 @@ nextflow_process { tag "modules" tag "modules_nfcore" tag "cellsnp" + tag "samtools/index" test("genotyping") { setup { run("SAMTOOLS_INDEX") { - script "../../../samtools/index/main.nf" + script "../../samtools/index/main.nf" process { """ input[0] = [ @@ -30,7 +31,6 @@ nextflow_process { bai -> [[ id: 'sample1'], file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), bai, - [], file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), [] @@ -42,8 +42,13 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } - ) + { assert snapshot(process.out.versions).match("versions") }, + { assert path(process.out.base.get(0).get(1)).exists() }, + { assert path(process.out.sample.get(0).get(1)).exists() }, + { assert path(process.out.allele_depth.get(0).get(1)).exists() }, + { assert path(process.out.depth_coverage.get(0).get(1)).exists() }, + { assert path(process.out.depth_other.get(0).get(1)).exists() } + ) } } @@ -60,7 +65,6 @@ nextflow_process { [ id:'sample1'], // meta map file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), [], - [], file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), [] @@ -72,7 +76,12 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot(process.out.versions).match("versions-stub") }, + { assert path(process.out.base.get(0).get(1)).exists() }, + { assert path(process.out.sample.get(0).get(1)).exists() }, + { assert path(process.out.allele_depth.get(0).get(1)).exists() }, + { assert path(process.out.depth_coverage.get(0).get(1)).exists() }, + { assert path(process.out.depth_other.get(0).get(1)).exists() } ) } diff --git a/modules/nf-core/cellsnp/tests/main.nf.test.snap b/modules/nf-core/cellsnp/tests/main.nf.test.snap new file mode 100644 index 00000000000..d558ef230c6 --- /dev/null +++ b/modules/nf-core/cellsnp/tests/main.nf.test.snap @@ -0,0 +1,26 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,a3ab8415b7aefee22a605a513142bf4c" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-23T23:23:16.524228628" + }, + "versions-stub": { + "content": [ + [ + "versions.yml:md5,89366928a2dbfad795438e38c7ef8695" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-23T23:24:00.650915067" + } +} \ No newline at end of file From 75867de6a295fe6f71741dea58e5d3fd48e7133d Mon Sep 17 00:00:00 2001 From: wxicu Date: Tue, 23 Apr 2024 23:37:54 +0200 Subject: [PATCH 04/19] align --- modules/nf-core/cellsnp/main.nf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/cellsnp/main.nf b/modules/nf-core/cellsnp/main.nf index 35378e2891c..7b087084369 100644 --- a/modules/nf-core/cellsnp/main.nf +++ b/modules/nf-core/cellsnp/main.nf @@ -12,12 +12,12 @@ process CELLSNP { output: tuple val(meta), path('*/cellSNP.base.vcf.gz') , emit: base - tuple val(meta), path('*/cellSNP.cells.vcf.gz') , emit: cell, optional: true - tuple val(meta), path('*/cellSNP.samples.tsv') , emit: sample + tuple val(meta), path('*/cellSNP.cells.vcf.gz') , emit: cell, optional: true + tuple val(meta), path('*/cellSNP.samples.tsv') , emit: sample tuple val(meta), path('*/cellSNP.tag.AD.mtx') , emit: allele_depth tuple val(meta), path('*/cellSNP.tag.DP.mtx') , emit: depth_coverage tuple val(meta), path('*/cellSNP.tag.OTH.mtx') , emit: depth_other - path 'versions.yml' , emit: versions + path 'versions.yml' , emit: versions when: task.ext.when == null || task.ext.when @@ -36,7 +36,7 @@ process CELLSNP { $sample \\ -O $prefix \\ --nproc $task.cpus \\ - --gzip \\ + --gzip \\ $args cat <<-END_VERSIONS > versions.yml From 6e396f231851da2698b0ba103af2bc05439de4bb Mon Sep 17 00:00:00 2001 From: Xichen Wu Date: Wed, 24 Apr 2024 10:12:18 +0200 Subject: [PATCH 05/19] add new snapshot --- modules/nf-core/cellsnp/tests/main.nf.test.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nf-core/cellsnp/tests/main.nf.test.snap b/modules/nf-core/cellsnp/tests/main.nf.test.snap index d558ef230c6..1e54cb3576e 100644 --- a/modules/nf-core/cellsnp/tests/main.nf.test.snap +++ b/modules/nf-core/cellsnp/tests/main.nf.test.snap @@ -2,14 +2,14 @@ "versions": { "content": [ [ - "versions.yml:md5,a3ab8415b7aefee22a605a513142bf4c" + "versions.yml:md5,89366928a2dbfad795438e38c7ef8695" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-04-23T23:23:16.524228628" + "timestamp": "2024-04-24T10:01:10.254512578" }, "versions-stub": { "content": [ @@ -21,6 +21,6 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-04-23T23:24:00.650915067" + "timestamp": "2024-04-24T10:01:50.522835434" } } \ No newline at end of file From 8cdf8b6f16f258797ab98638ca7848bfcf514881 Mon Sep 17 00:00:00 2001 From: wxicu Date: Wed, 24 Apr 2024 10:29:09 +0200 Subject: [PATCH 06/19] remove padding --- modules/nf-core/cellsnp/main.nf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/nf-core/cellsnp/main.nf b/modules/nf-core/cellsnp/main.nf index 7b087084369..e57647f178e 100644 --- a/modules/nf-core/cellsnp/main.nf +++ b/modules/nf-core/cellsnp/main.nf @@ -34,9 +34,8 @@ process CELLSNP { $barcode_file \\ $region_file \\ $sample \\ - -O $prefix \\ + -O $prefix --gzip \\ --nproc $task.cpus \\ - --gzip \\ $args cat <<-END_VERSIONS > versions.yml From 775f98c61fbc34d20d69dae7fc20ebbb9418d211 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 16:16:07 +0200 Subject: [PATCH 07/19] down to mode a of cellsnp --- .../cellsnp/{ => modea}/environment.yml | 2 +- modules/nf-core/cellsnp/{ => modea}/main.nf | 38 ++++++++----------- modules/nf-core/cellsnp/{ => modea}/meta.yml | 19 ++++------ .../cellsnp/{ => modea}/tests/main.nf.test | 20 ++++------ modules/nf-core/cellsnp/modea/tests/tags.yml | 2 + .../nf-core/cellsnp/tests/main.nf.test.snap | 26 ------------- modules/nf-core/cellsnp/tests/tags.yml | 2 - 7 files changed, 33 insertions(+), 76 deletions(-) rename modules/nf-core/cellsnp/{ => modea}/environment.yml (91%) rename modules/nf-core/cellsnp/{ => modea}/main.nf (51%) rename modules/nf-core/cellsnp/{ => modea}/meta.yml (81%) rename modules/nf-core/cellsnp/{ => modea}/tests/main.nf.test (78%) create mode 100644 modules/nf-core/cellsnp/modea/tests/tags.yml delete mode 100644 modules/nf-core/cellsnp/tests/main.nf.test.snap delete mode 100644 modules/nf-core/cellsnp/tests/tags.yml diff --git a/modules/nf-core/cellsnp/environment.yml b/modules/nf-core/cellsnp/modea/environment.yml similarity index 91% rename from modules/nf-core/cellsnp/environment.yml rename to modules/nf-core/cellsnp/modea/environment.yml index 19befca4100..2a6f6cab965 100644 --- a/modules/nf-core/cellsnp/environment.yml +++ b/modules/nf-core/cellsnp/modea/environment.yml @@ -1,6 +1,6 @@ --- # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json -name: "cellsnp" +name: "cellsnp_modea" channels: - conda-forge - bioconda diff --git a/modules/nf-core/cellsnp/main.nf b/modules/nf-core/cellsnp/modea/main.nf similarity index 51% rename from modules/nf-core/cellsnp/main.nf rename to modules/nf-core/cellsnp/modea/main.nf index e57647f178e..8cf685b524a 100644 --- a/modules/nf-core/cellsnp/main.nf +++ b/modules/nf-core/cellsnp/modea/main.nf @@ -1,4 +1,4 @@ -process CELLSNP { +process CELLSNP_MODEA { tag "$meta.id" label 'process_high' @@ -8,33 +8,30 @@ process CELLSNP { 'biocontainers/cellsnp-lite:1.2.3--h6141fd1_2' }" input: - tuple val(meta), path(bam), path(bai), path(region_vcf), path(barcode), path(sample_list) + tuple val(meta), path(bam), path(bai), path(region_vcf), path(barcode) output: - tuple val(meta), path('*/cellSNP.base.vcf.gz') , emit: base - tuple val(meta), path('*/cellSNP.cells.vcf.gz') , emit: cell, optional: true - tuple val(meta), path('*/cellSNP.samples.tsv') , emit: sample - tuple val(meta), path('*/cellSNP.tag.AD.mtx') , emit: allele_depth - tuple val(meta), path('*/cellSNP.tag.DP.mtx') , emit: depth_coverage - tuple val(meta), path('*/cellSNP.tag.OTH.mtx') , emit: depth_other - path 'versions.yml' , emit: versions + tuple val(meta), path('*/cellSNP.base.vcf.gz') , emit: base + tuple val(meta), path('*/cellSNP.cells.vcf.gz'), emit: cell , optional: true + tuple val(meta), path('*/cellSNP.samples.tsv') , emit: sample + tuple val(meta), path('*/cellSNP.tag.AD.mtx') , emit: allele_depth + tuple val(meta), path('*/cellSNP.tag.DP.mtx') , emit: depth_coverage + tuple val(meta), path('*/cellSNP.tag.OTH.mtx') , emit: depth_other + path 'versions.yml' , emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def barcode_file = barcode ? "-b $barcode" : '' - def region_file = region_vcf ? "-R $region_vcf" : '' - def sample = sample_list ? "-I $sample_list" : '' - + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def region_file = region_vcf ? "-R $region_vcf" : '' """ cellsnp-lite -s $bam \\ - $barcode_file \\ + -b $barcode \\ $region_file \\ - $sample \\ - -O $prefix --gzip \\ + -O . \\ + --gzip \\ --nproc $task.cpus \\ $args @@ -45,12 +42,7 @@ process CELLSNP { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def barcode_file = barcode ? "-b $barcode" : '' - def region_file = region_vcf ? "-R $region_vcf" : '' - def sample = sample_list ? "-I $sample_list" : '' - """ mkdir $prefix touch $prefix/cellSNP.base.vcf.gz diff --git a/modules/nf-core/cellsnp/meta.yml b/modules/nf-core/cellsnp/modea/meta.yml similarity index 81% rename from modules/nf-core/cellsnp/meta.yml rename to modules/nf-core/cellsnp/modea/meta.yml index 5ef75514f29..3ef28cf510a 100644 --- a/modules/nf-core/cellsnp/meta.yml +++ b/modules/nf-core/cellsnp/modea/meta.yml @@ -1,11 +1,12 @@ --- # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json -name: "cellsnp" -description: Cellsnp-lite is a C/C++ tool for efficient genotyping bi-allelic SNPs on single cells. You can use cellsnp-lite after read alignment to obtain the snp x cell pileup UMI or read count matrices for each alleles of given or detected SNPs. +name: "cellsnp_modea" +description: Cellsnp-lite is a C/C++ tool for efficient genotyping bi-allelic SNPs on single cells. You can use the mode A of cellsnp-lite after read alignment to obtain the snp x cell pileup UMI or read count matrices for each alleles of given or detected SNPs for droplet based single cell data. keywords: - genotyping - single cell - SNP + - droplet based single cells tools: - "cellsnp": description: "Efficient genotyping bi-allelic SNPs on single cells" @@ -21,39 +22,33 @@ input: description: | Groovy Map containing sample information e.g. `[ id:'sample1', single_end:false ]` - - bam: type: file - description: Indexed BAM/CRAM file(s), comma separated multiple samples. + description: A single BAM/SAM/CRAM file, e.g., from CellRanger. pattern: "*.{bam,cram,sam}" - bai: type: file - description: Index of the BAM/CRAM file. + description: The index of the BAM/CRAM file. pattern: "*.{bai,crai}" - region_vcf: type: file - description: A vcf file listing all candidate SNPs, for fetch each variants. + description: A optional vcf file listing all candidate SNPs, for fetch each variants. pattern: "*.{vcf, vcf.gz}" - barcode: type: file description: A plain file listing all effective cell barcodes. pattern: "*.tsv" - - sample_list: - type: file - description: A list file containing sample IDs, each per line. output: - meta: type: map description: | Groovy Map containing sample information - e.g. `[ id:'sample1']` - + e.g. `[ id:'sample1', single_end:false ]` - versions: type: file description: File containing software versions pattern: "versions.yml" - - base: type: file description: A VCF file listing genotyped SNPs and aggregated AD & DP infomation (without GT). diff --git a/modules/nf-core/cellsnp/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test similarity index 78% rename from modules/nf-core/cellsnp/tests/main.nf.test rename to modules/nf-core/cellsnp/modea/tests/main.nf.test index a8756e91367..1d97eadeafb 100644 --- a/modules/nf-core/cellsnp/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -1,19 +1,20 @@ -// nf-core modules test cellsnp +// nf-core modules test cellsnp/modea nextflow_process { - name "Test Process CELLSNP" + name "Test Process CELLSNP_MODEA" script "../main.nf" - process "CELLSNP" + process "CELLSNP_MODEA" tag "modules" tag "modules_nfcore" tag "cellsnp" + tag "cellsnp/modea" tag "samtools/index" test("genotyping") { setup { run("SAMTOOLS_INDEX") { - script "../../samtools/index/main.nf" + script "../../../samtools/index/main.nf" process { """ input[0] = [ @@ -43,7 +44,7 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out.versions).match("versions") }, - { assert path(process.out.base.get(0).get(1)).exists() }, + { assert path(process.out.base.get(0).get(1)).exists() }, { assert path(process.out.sample.get(0).get(1)).exists() }, { assert path(process.out.allele_depth.get(0).get(1)).exists() }, { assert path(process.out.depth_coverage.get(0).get(1)).exists() }, @@ -75,13 +76,8 @@ nextflow_process { then { assertAll( - { assert process.success }, - { assert snapshot(process.out.versions).match("versions-stub") }, - { assert path(process.out.base.get(0).get(1)).exists() }, - { assert path(process.out.sample.get(0).get(1)).exists() }, - { assert path(process.out.allele_depth.get(0).get(1)).exists() }, - { assert path(process.out.depth_coverage.get(0).get(1)).exists() }, - { assert path(process.out.depth_other.get(0).get(1)).exists() } + { assert process.success }, + { assert snapshot(process.out).match("stub") } ) } diff --git a/modules/nf-core/cellsnp/modea/tests/tags.yml b/modules/nf-core/cellsnp/modea/tests/tags.yml new file mode 100644 index 00000000000..7dd3b88a3af --- /dev/null +++ b/modules/nf-core/cellsnp/modea/tests/tags.yml @@ -0,0 +1,2 @@ +cellsnp/modea: + - "modules/nf-core/cellsnp/modea/**" diff --git a/modules/nf-core/cellsnp/tests/main.nf.test.snap b/modules/nf-core/cellsnp/tests/main.nf.test.snap deleted file mode 100644 index 1e54cb3576e..00000000000 --- a/modules/nf-core/cellsnp/tests/main.nf.test.snap +++ /dev/null @@ -1,26 +0,0 @@ -{ - "versions": { - "content": [ - [ - "versions.yml:md5,89366928a2dbfad795438e38c7ef8695" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-04-24T10:01:10.254512578" - }, - "versions-stub": { - "content": [ - [ - "versions.yml:md5,89366928a2dbfad795438e38c7ef8695" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-04-24T10:01:50.522835434" - } -} \ No newline at end of file diff --git a/modules/nf-core/cellsnp/tests/tags.yml b/modules/nf-core/cellsnp/tests/tags.yml deleted file mode 100644 index 8e1a046b2ca..00000000000 --- a/modules/nf-core/cellsnp/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -cellsnp: - - "modules/nf-core/cellsnp/**" From 75d947731f0a064523a8761002959257dbde0f78 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 16:59:57 +0200 Subject: [PATCH 08/19] remove notused params --- modules/nf-core/cellsnp/modea/tests/main.nf.test | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index 1d97eadeafb..51496aefda8 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -33,9 +33,7 @@ nextflow_process { file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), bai, file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), - [] - ]} + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true) ]} """ } } @@ -67,8 +65,7 @@ nextflow_process { file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), [], file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true), - [] + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true) ] """ } From cc2e6d6e9fbe7ecb26057c75a41675b0ec74f8cf Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 17:02:06 +0200 Subject: [PATCH 09/19] fix output path --- modules/nf-core/cellsnp/modea/main.nf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/main.nf b/modules/nf-core/cellsnp/modea/main.nf index 8cf685b524a..9f3f83a8962 100644 --- a/modules/nf-core/cellsnp/modea/main.nf +++ b/modules/nf-core/cellsnp/modea/main.nf @@ -11,12 +11,12 @@ process CELLSNP_MODEA { tuple val(meta), path(bam), path(bai), path(region_vcf), path(barcode) output: - tuple val(meta), path('*/cellSNP.base.vcf.gz') , emit: base - tuple val(meta), path('*/cellSNP.cells.vcf.gz'), emit: cell , optional: true - tuple val(meta), path('*/cellSNP.samples.tsv') , emit: sample - tuple val(meta), path('*/cellSNP.tag.AD.mtx') , emit: allele_depth - tuple val(meta), path('*/cellSNP.tag.DP.mtx') , emit: depth_coverage - tuple val(meta), path('*/cellSNP.tag.OTH.mtx') , emit: depth_other + tuple val(meta), path('cellSNP.base.vcf.gz') , emit: base + tuple val(meta), path('cellSNP.cells.vcf.gz'), emit: cell , optional: true + tuple val(meta), path('cellSNP.samples.tsv') , emit: sample + tuple val(meta), path('cellSNP.tag.AD.mtx') , emit: allele_depth + tuple val(meta), path('cellSNP.tag.DP.mtx') , emit: depth_coverage + tuple val(meta), path('cellSNP.tag.OTH.mtx') , emit: depth_other path 'versions.yml' , emit: versions when: From 1e0c26dcd83e17d1ef54fff823808085e3eea9a6 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 17:12:37 +0200 Subject: [PATCH 10/19] set prefix of outout --- modules/nf-core/cellsnp/modea/main.nf | 29 +++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/main.nf b/modules/nf-core/cellsnp/modea/main.nf index 9f3f83a8962..825233b71e2 100644 --- a/modules/nf-core/cellsnp/modea/main.nf +++ b/modules/nf-core/cellsnp/modea/main.nf @@ -11,12 +11,12 @@ process CELLSNP_MODEA { tuple val(meta), path(bam), path(bai), path(region_vcf), path(barcode) output: - tuple val(meta), path('cellSNP.base.vcf.gz') , emit: base - tuple val(meta), path('cellSNP.cells.vcf.gz'), emit: cell , optional: true - tuple val(meta), path('cellSNP.samples.tsv') , emit: sample - tuple val(meta), path('cellSNP.tag.AD.mtx') , emit: allele_depth - tuple val(meta), path('cellSNP.tag.DP.mtx') , emit: depth_coverage - tuple val(meta), path('cellSNP.tag.OTH.mtx') , emit: depth_other + tuple val(meta), path('*.base.vcf.gz') , emit: base + tuple val(meta), path('*.cells.vcf.gz'), emit: cell , optional: true + tuple val(meta), path('*.samples.tsv') , emit: sample + tuple val(meta), path('*.tag.AD.mtx') , emit: allele_depth + tuple val(meta), path('*.tag.DP.mtx') , emit: depth_coverage + tuple val(meta), path('*.tag.OTH.mtx') , emit: depth_other path 'versions.yml' , emit: versions when: @@ -35,6 +35,13 @@ process CELLSNP_MODEA { --nproc $task.cpus \\ $args + mv cellSNP.base.vcf.gz $prefix.base.vcf.gz + mv cellSNP.cells.vcf.gz $prefix.cells.vcf.gz + mv cellSNP.tag.AD.mtx $prefix.tag.AD.mtx + mv cellSNP.tag.DP.mtx $prefix.tag.DP.mtx + mv cellSNP.tag.OTH.mtx $prefix.tag.OTH.mtx + mv cellSNP.samples.tsv $prefix.samples.tsv + cat <<-END_VERSIONS > versions.yml "${task.process}": cellsnp: \$(cellsnp-lite --v | awk '{print \$2}') @@ -45,11 +52,11 @@ process CELLSNP_MODEA { def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir $prefix - touch $prefix/cellSNP.base.vcf.gz - touch $prefix/cellSNP.samples.tsv - touch $prefix/cellSNP.tag.AD.mtx - touch $prefix/cellSNP.tag.DP.mtx - touch $prefix/cellSNP.tag.OTH.mtx + touch $prefix.base.vcf.gz + touch $prefix.samples.tsv + touch $prefix.tag.AD.mtx + touch $prefix.tag.DP.mtx + touch $prefix.tag.OTH.mtx cat <<-END_VERSIONS > versions.yml "${task.process}": From cc95a361e4465264385e09b2c1a3e5ee08d1224b Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 17:28:23 +0200 Subject: [PATCH 11/19] fix error --- modules/nf-core/cellsnp/modea/main.nf | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/main.nf b/modules/nf-core/cellsnp/modea/main.nf index 825233b71e2..ba5c17ce476 100644 --- a/modules/nf-core/cellsnp/modea/main.nf +++ b/modules/nf-core/cellsnp/modea/main.nf @@ -35,12 +35,14 @@ process CELLSNP_MODEA { --nproc $task.cpus \\ $args - mv cellSNP.base.vcf.gz $prefix.base.vcf.gz - mv cellSNP.cells.vcf.gz $prefix.cells.vcf.gz - mv cellSNP.tag.AD.mtx $prefix.tag.AD.mtx - mv cellSNP.tag.DP.mtx $prefix.tag.DP.mtx - mv cellSNP.tag.OTH.mtx $prefix.tag.OTH.mtx - mv cellSNP.samples.tsv $prefix.samples.tsv + mv cellSNP.base.vcf.gz ${prefix}.base.vcf.gz + if [[ "$args" == *"--genotype"* ]]; then + mv cellSNP.cells.vcf.gz ${prefix}.cells.vcf.gz + fi + mv cellSNP.tag.AD.mtx ${prefix}.tag.AD.mtx + mv cellSNP.tag.DP.mtx ${prefix}.tag.DP.mtx + mv cellSNP.tag.OTH.mtx ${prefix}.tag.OTH.mtx + mv cellSNP.samples.tsv ${prefix}.samples.tsv cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -52,11 +54,11 @@ process CELLSNP_MODEA { def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir $prefix - touch $prefix.base.vcf.gz - touch $prefix.samples.tsv - touch $prefix.tag.AD.mtx - touch $prefix.tag.DP.mtx - touch $prefix.tag.OTH.mtx + touch ${prefix}.base.vcf.gz + touch ${prefix}.samples.tsv + touch ${prefix}.tag.AD.mtx + touch ${prefix}.tag.DP.mtx + touch ${prefix}.tag.OTH.mtx cat <<-END_VERSIONS > versions.yml "${task.process}": From a7db8916740b100f6055f51837aff67e17eac587 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 18:11:24 +0200 Subject: [PATCH 12/19] fix test --- modules/nf-core/cellsnp/modea/tests/main.nf.test | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index 51496aefda8..6cd4784a786 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -74,8 +74,13 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match("stub") } - ) + { assert snapshot( + process.out.base, + process.out.sample, + process.out.allele_depth, + process.out.depth_coverage, + process.out.depth_other).match("stub") + }) } } From e4864732250b71bd91b89f0ae732e8596dbacb49 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 18:31:30 +0200 Subject: [PATCH 13/19] fix test --- .../nf-core/cellsnp/modea/tests/main.nf.test | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index 6cd4784a786..340893e6e2a 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -42,11 +42,17 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out.versions).match("versions") }, - { assert path(process.out.base.get(0).get(1)).exists() }, - { assert path(process.out.sample.get(0).get(1)).exists() }, - { assert path(process.out.allele_depth.get(0).get(1)).exists() }, - { assert path(process.out.depth_coverage.get(0).get(1)).exists() }, - { assert path(process.out.depth_other.get(0).get(1)).exists() } + { assert path(process.out.base.get(0).get(1)).exists() }, + { assert snapshot( + process.out.sample, + process.out.allele_depth, + process.out.depth_coverage, + process.out.depth_other).match() + } + //{ assert path(process.out.sample.get(0).get(1)).exists() }, + //{ assert path(process.out.allele_depth.get(0).get(1)).exists() }, + //{ assert path(process.out.depth_coverage.get(0).get(1)).exists() }, + //{ assert path(process.out.depth_other.get(0).get(1)).exists() } ) } @@ -75,13 +81,13 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - process.out.base, process.out.sample, process.out.allele_depth, process.out.depth_coverage, process.out.depth_other).match("stub") - }) - } + }, + { assert path(process.out.base.get(0).get(1)).exists() } + } From 7e2753c4c11d3608ed6a66b604fbdecb2d0c9185 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 18:33:04 +0200 Subject: [PATCH 14/19] fix test --- modules/nf-core/cellsnp/modea/tests/main.nf.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index 340893e6e2a..cfe25aa8bf9 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -86,9 +86,10 @@ nextflow_process { process.out.depth_coverage, process.out.depth_other).match("stub") }, - { assert path(process.out.base.get(0).get(1)).exists() } + { assert path(process.out.base.get(0).get(1)).exists() } ) + } } } From e013de2f312777118d26118fa5dbe9e790884ad1 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 18:42:28 +0200 Subject: [PATCH 15/19] add snapshot --- .../cellsnp/modea/tests/main.nf.test.snap | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 modules/nf-core/cellsnp/modea/tests/main.nf.test.snap diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test.snap b/modules/nf-core/cellsnp/modea/tests/main.nf.test.snap new file mode 100644 index 00000000000..36e9fab84cc --- /dev/null +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test.snap @@ -0,0 +1,96 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,965121af3dc48657c2128c404589fa6b" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-05T18:34:17.845506428" + }, + "genotyping": { + "content": [ + [ + [ + { + "id": "sample1" + }, + "sample1.samples.tsv:md5,9e488782c1bcd63c37ee3d1c4c0a9217" + ] + ], + [ + [ + { + "id": "sample1" + }, + "sample1.tag.AD.mtx:md5,dbe2d13dca2717749554d1f2a8b85650" + ] + ], + [ + [ + { + "id": "sample1" + }, + "sample1.tag.DP.mtx:md5,29fbb6241c6c7b0a0fa31021e622c415" + ] + ], + [ + [ + { + "id": "sample1" + }, + "sample1.tag.OTH.mtx:md5,1e3429950c59edec58a80a9b4ecda552" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-05T18:34:17.88339067" + }, + "stub": { + "content": [ + [ + [ + { + "id": "sample1" + }, + "sample1.samples.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "sample1" + }, + "sample1.tag.AD.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "sample1" + }, + "sample1.tag.DP.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "sample1" + }, + "sample1.tag.OTH.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-05T18:34:29.159643061" + } +} \ No newline at end of file From c664474a8694f74fe189b3dbd8f5a73f94a228e8 Mon Sep 17 00:00:00 2001 From: wxicu Date: Sun, 5 May 2024 18:43:41 +0200 Subject: [PATCH 16/19] format code --- .../nf-core/cellsnp/modea/tests/main.nf.test | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index cfe25aa8bf9..bc10154fecd 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -42,18 +42,14 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out.versions).match("versions") }, - { assert path(process.out.base.get(0).get(1)).exists() }, - { assert snapshot( - process.out.sample, - process.out.allele_depth, - process.out.depth_coverage, - process.out.depth_other).match() - } - //{ assert path(process.out.sample.get(0).get(1)).exists() }, - //{ assert path(process.out.allele_depth.get(0).get(1)).exists() }, - //{ assert path(process.out.depth_coverage.get(0).get(1)).exists() }, - //{ assert path(process.out.depth_other.get(0).get(1)).exists() } - ) + { assert path(process.out.base.get(0).get(1)).exists() }, + { assert snapshot( + process.out.sample, + process.out.allele_depth, + process.out.depth_coverage, + process.out.depth_other).match() + } + ) } } From 81bd48da7a41016fa6a1b0ef10a45c98912cfa24 Mon Sep 17 00:00:00 2001 From: wxicu Date: Wed, 8 May 2024 21:01:08 +0200 Subject: [PATCH 17/19] minor changes --- modules/nf-core/cellsnp/modea/main.nf | 4 ++-- modules/nf-core/cellsnp/modea/meta.yml | 2 +- modules/nf-core/cellsnp/modea/tests/main.nf.test | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/main.nf b/modules/nf-core/cellsnp/modea/main.nf index ba5c17ce476..4130233f12c 100644 --- a/modules/nf-core/cellsnp/modea/main.nf +++ b/modules/nf-core/cellsnp/modea/main.nf @@ -1,6 +1,6 @@ process CELLSNP_MODEA { tag "$meta.id" - label 'process_high' + label 'process_medium' conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? @@ -17,7 +17,7 @@ process CELLSNP_MODEA { tuple val(meta), path('*.tag.AD.mtx') , emit: allele_depth tuple val(meta), path('*.tag.DP.mtx') , emit: depth_coverage tuple val(meta), path('*.tag.OTH.mtx') , emit: depth_other - path 'versions.yml' , emit: versions + path 'versions.yml' , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/cellsnp/modea/meta.yml b/modules/nf-core/cellsnp/modea/meta.yml index 3ef28cf510a..bed1bc482bd 100644 --- a/modules/nf-core/cellsnp/modea/meta.yml +++ b/modules/nf-core/cellsnp/modea/meta.yml @@ -32,7 +32,7 @@ input: pattern: "*.{bai,crai}" - region_vcf: type: file - description: A optional vcf file listing all candidate SNPs, for fetch each variants. + description: A optional vcf file listing all candidate SNPs for genotyping. pattern: "*.{vcf, vcf.gz}" - barcode: type: file diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index bc10154fecd..4677312da75 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -28,12 +28,12 @@ nextflow_process { when { process { """ - input[0] = SAMTOOLS_INDEX.out.bai.collect{ meta, bai -> bai }.map{ - bai -> [[ id: 'sample1'], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), - bai, - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true) ]} + + input[0] = [[ id: 'sample1'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), + SAMTOOLS_INDEX.out.bai.map{it[1]}, + file(params.modules_testdata_base_path + /genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true)] """ } } @@ -63,7 +63,7 @@ nextflow_process { """ input[0] = [ - [ id:'sample1'], // meta map + [ id:'sample1'], file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), [], file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), From 3be145a53c85da58082294cafcb672ed86fa5e3c Mon Sep 17 00:00:00 2001 From: wxicu Date: Wed, 8 May 2024 22:03:55 +0200 Subject: [PATCH 18/19] fix test --- modules/nf-core/cellsnp/modea/main.nf | 2 +- .../nf-core/cellsnp/modea/tests/main.nf.test | 24 ++-- .../cellsnp/modea/tests/main.nf.test.snap | 130 +++++++++++++----- 3 files changed, 106 insertions(+), 50 deletions(-) diff --git a/modules/nf-core/cellsnp/modea/main.nf b/modules/nf-core/cellsnp/modea/main.nf index 4130233f12c..048a2449225 100644 --- a/modules/nf-core/cellsnp/modea/main.nf +++ b/modules/nf-core/cellsnp/modea/main.nf @@ -54,7 +54,7 @@ process CELLSNP_MODEA { def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir $prefix - touch ${prefix}.base.vcf.gz + echo "" | gzip > ${prefix}.base.vcf.gz touch ${prefix}.samples.tsv touch ${prefix}.tag.AD.mtx touch ${prefix}.tag.DP.mtx diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index 4677312da75..06851e62992 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -29,12 +29,13 @@ nextflow_process { process { """ - input[0] = [[ id: 'sample1'], - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), - SAMTOOLS_INDEX.out.bai.map{it[1]}, - file(params.modules_testdata_base_path + /genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), - file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true)] - """ + input[0] = SAMTOOLS_INDEX.out.bai.collect{ meta, bai -> bai }.map{ + bai -> [[ id: 'sample1'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/chr21.bam', checkIfExists: true), + bai, + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/donor_genotype_chr21.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/demultiplexing/barcodes.tsv', checkIfExists: true) ]} + """ } } @@ -42,7 +43,7 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out.versions).match("versions") }, - { assert path(process.out.base.get(0).get(1)).exists() }, + { assert path(process.out.base.get(0).get(1)).exists() }, { assert snapshot( process.out.sample, process.out.allele_depth, @@ -76,14 +77,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - process.out.sample, - process.out.allele_depth, - process.out.depth_coverage, - process.out.depth_other).match("stub") - }, - { assert path(process.out.base.get(0).get(1)).exists() } ) - + { assert snapshot(process.out).match("stub")}) } } diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test.snap b/modules/nf-core/cellsnp/modea/tests/main.nf.test.snap index 36e9fab84cc..07997e3f8d9 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test.snap +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test.snap @@ -9,7 +9,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-05-05T18:34:17.845506428" + "timestamp": "2024-05-08T22:02:32.670061197" }, "genotyping": { "content": [ @@ -50,47 +50,109 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-05-05T18:34:17.88339067" + "timestamp": "2024-05-08T22:02:32.689525045" }, "stub": { "content": [ - [ - [ - { - "id": "sample1" - }, - "sample1.samples.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - [ - [ - { - "id": "sample1" - }, - "sample1.tag.AD.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + { + "0": [ + [ + { + "id": "sample1" + }, + "sample1.base.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + + ], + "2": [ + [ + { + "id": "sample1" + }, + "sample1.samples.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "sample1" + }, + "sample1.tag.AD.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "sample1" + }, + "sample1.tag.DP.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "sample1" + }, + "sample1.tag.OTH.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + "versions.yml:md5,965121af3dc48657c2128c404589fa6b" + ], + "allele_depth": [ + [ + { + "id": "sample1" + }, + "sample1.tag.AD.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "base": [ + [ + { + "id": "sample1" + }, + "sample1.base.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "cell": [ + + ], + "depth_coverage": [ + [ + { + "id": "sample1" + }, + "sample1.tag.DP.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "depth_other": [ + [ + { + "id": "sample1" + }, + "sample1.tag.OTH.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "sample": [ + [ + { + "id": "sample1" + }, + "sample1.samples.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,965121af3dc48657c2128c404589fa6b" ] - ], - [ - [ - { - "id": "sample1" - }, - "sample1.tag.DP.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - [ - [ - { - "id": "sample1" - }, - "sample1.tag.OTH.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ] + } ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-05-05T18:34:29.159643061" + "timestamp": "2024-05-08T22:02:39.591564384" } } \ No newline at end of file From 6757117d80218e5dbecf1b391dec636cc9f98d60 Mon Sep 17 00:00:00 2001 From: wxicu Date: Wed, 8 May 2024 22:05:47 +0200 Subject: [PATCH 19/19] align --- modules/nf-core/cellsnp/modea/tests/main.nf.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/cellsnp/modea/tests/main.nf.test b/modules/nf-core/cellsnp/modea/tests/main.nf.test index 06851e62992..8f67d265153 100644 --- a/modules/nf-core/cellsnp/modea/tests/main.nf.test +++ b/modules/nf-core/cellsnp/modea/tests/main.nf.test @@ -43,7 +43,7 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out.versions).match("versions") }, - { assert path(process.out.base.get(0).get(1)).exists() }, + { assert path(process.out.base.get(0).get(1)).exists() }, { assert snapshot( process.out.sample, process.out.allele_depth,