Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Freemuxlet to modules #5520

Merged
merged 10 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/nf-core/popscle/freemuxlet/environment.yml
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: "popscle_freemuxlet"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::popscle=0.1"
57 changes: 57 additions & 0 deletions modules/nf-core/popscle/freemuxlet/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
process POPSCLE_FREEMUXLET {
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/popscle:0.1beta--h2c78cec_0' :
'biocontainers/popscle:0.1beta--h2c78cec_0' }"

input:
tuple val(meta), path(plp), val(n_sample)

output:
tuple val(meta), path('*.clust1.samples.gz') , emit: result
tuple val(meta), path('*.clust1.vcf.gz') , emit: vcf
tuple val(meta), path('*.lmix') , emit: lmix
tuple val(meta), path('*.clust0.samples.gz') , emit: singlet_result , optional: true
tuple val(meta), path('*.clust0.vcf.gz') , emit: singlet_vcf , optional: true
tuple val(meta), path('*.ldist.gz') , emit: ldist , optional: true
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 VERSION = '0.1' // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions.
"""
popscle freemuxlet \\
--plp ${plp}/$prefix \\
--out $prefix \\
--nsample $n_sample \\
$args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
popscle freemuxlet: $VERSION
wxicu marked this conversation as resolved.
Show resolved Hide resolved
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '0.1' // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions.

"""
touch ${prefix}.clust1.samples.gz
touch ${prefix}.clust1.vcf.gz
touch ${prefix}.lmix
wxicu marked this conversation as resolved.
Show resolved Hide resolved

cat <<-END_VERSIONS > versions.yml
"${task.process}":
popscle freemuxlet: $VERSION
wxicu marked this conversation as resolved.
Show resolved Hide resolved
END_VERSIONS
"""
}
78 changes: 78 additions & 0 deletions modules/nf-core/popscle/freemuxlet/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "popscle_freemuxlet"
description: Software to deconvolute sample identity and identify multiplets when multiple samples are pooled by barcoded single cell sequencing and external genotyping data for each sample is not available.
keywords:
- popscle
- demultiplexing
- genotype-based deconvoltion
- single cell
tools:
- "popscle":
description: "A suite of population scale analysis tools for single-cell genomics data including implementation of Demuxlet / Freemuxlet methods and auxilary tools"
homepage: "https://github.com/statgen/popscle"
documentation: "https://github.com/statgen/popscle"
tool_dev_url: "https://github.com/statgen/popscle"
doi: "10.1038/nbt.4042"
licence: ["Apache-2.0"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1']`

- plp:
type: directory
description: Directory contains pileup files (CEL,VAR and PLP) produced by popscle/dsc_pileup.
- n_sample:
type: integer
description: Number of samples multiplexed together.

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

- result:
type: file
description: Output file contains the best guess of the sample identity, with detailed statistics to reach to the best guess.
pattern: "*.clust1.samples.gz"

- vcf:
type: file
description: Output vcf file for each sample inferred and clustered from freemuxlet.
pattern: "*.clust1.vcf.gz"

- lmix:
type: file
description: Output file contains basic statistics for each barcode.
pattern: "*.lmix"

- singlet_result:
type: file
description: Output file contains the best sample identity assuming all droplets are singlets.
pattern: "*.clust0.samples.gz"

- singlet_vcf:
type: file
description: Output vcf file for each sample inferred and clustered from freemuxlet assuming all droplets are singlets.
pattern: "*.clust0.vcf.gz"

- ldist:
type: file
description: Output ontains the pairwise Bayes factor for each possible pair of droplets.
pattern: "*.ldist.gz"
wxicu marked this conversation as resolved.
Show resolved Hide resolved

authors:
- "@wxicu"
maintainers:
- "@wxicu"
95 changes: 95 additions & 0 deletions modules/nf-core/popscle/freemuxlet/tests/main.nf.test
wxicu marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
nextflow_process {

name "Test Process POPSCLE_FREEMUXLET"
script "../main.nf"
process "POPSCLE_FREEMUXLET"

tag "modules"
tag "modules_nfcore"
tag "popscle"
tag "popscle/dscpileup"
tag "popscle/freemuxlet"

test("demultiplexing") {
setup {
run("POPSCLE_DSCPILEUP") {
script "../../dscpileup/main.nf"
process {
"""
input[0] = [
[ 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),
]
"""
}
}
}

when {
process {
"""
input[0] = POPSCLE_DSCPILEUP.out.plp.collect{ meta, plp -> plp }.map{
plp -> [[ id: 'sample1'],
plp[0].getParent(),
2 ]}
"""
}
}


then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match("versions") },
{ assert path(process.out.result.get(0).get(1)).exists() },
{ assert path(process.out.vcf.get(0).get(1)).exists() },
{ assert path(process.out.lmix.get(0).get(1)).exists() }
)
}

}

test("demultiplexing - stub") {

options "-stub"

setup {
run("POPSCLE_DSCPILEUP") {
script "../../dscpileup/main.nf"
process {
"""
input[0] = [
[ 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),
]
"""
}
}
}

when {
process {
"""
input[0] = POPSCLE_DSCPILEUP.out.plp.collect{ meta, plp -> plp }.map{
plp -> [[ id: 'sample1'],
plp[0].toString() - '.plp.gz',
2 ]}
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match("versions-stub") },
{ assert path(process.out.result.get(0).get(1)).exists() },
{ assert path(process.out.vcf.get(0).get(1)).exists() },
{ assert path(process.out.lmix.get(0).get(1)).exists() }
)
}

}

}
26 changes: 26 additions & 0 deletions modules/nf-core/popscle/freemuxlet/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"versions": {
"content": [
[
"versions.yml:md5,cd783dfa34b208fe9aeab8623fa4ca4e"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-24T22:00:38.402346645"
},
"versions-stub": {
"content": [
[
"versions.yml:md5,cd783dfa34b208fe9aeab8623fa4ca4e"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-24T22:00:48.216325466"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/popscle/freemuxlet/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
popscle/freemuxlet:
- "modules/nf-core/popscle/freemuxlet/**"
Loading