forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/wxicu/modules
- Loading branch information
Showing
6 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
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(bai), path(region_vcf), path(barcode), path(sample_list) | ||
|
||
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: | ||
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" : '' | ||
|
||
""" | ||
cellsnp-lite -s $bam \\ | ||
$barcode_file \\ | ||
$region_file \\ | ||
$sample \\ | ||
-O $prefix \\ | ||
--nproc $task.cpus \\ | ||
--gzip \\ | ||
$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 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 | ||
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}') | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
# 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: | ||
- genotyping | ||
- single cell | ||
- 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: "10.1093/bioinformatics/btab358" | ||
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}" | ||
- bai: | ||
type: file | ||
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. | ||
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" | ||
|
||
- 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" | ||
maintainers: | ||
- "@wxicu" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// nf-core modules test cellsnp | ||
nextflow_process { | ||
|
||
name "Test Process CELLSNP" | ||
script "../main.nf" | ||
process "CELLSNP" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "cellsnp" | ||
tag "samtools/index" | ||
|
||
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] = 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), | ||
[] | ||
]} | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
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() } | ||
) | ||
} | ||
|
||
} | ||
|
||
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.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() } | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cellsnp: | ||
- "modules/nf-core/cellsnp/**" |