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

modify emptydrops ambiguous mentions for cellbender remove background #423

Merged
merged 6 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add profile for gpu processes ([#419](https://github.com/nf-core/scrnaseq/pull/419/))
- Update example usage command in README with valid reference genome parameter ([#339](https://github.com/nf-core/scrnaseq/issues/339))
- Removed `--kb_filter` parameter. Kallisto filtering is triggered by default and can be turned off with `ext.args` ([#421](https://github.com/nf-core/scrnaseq/issues/421))
- Document better that `cellbender` is used for empty drops calling and not the `emptydrops` method (([#420](https://github.com/nf-core/scrnaseq/issues/420)))

## v3.0.0 - 2024-12-09

Expand Down
4 changes: 2 additions & 2 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ process {
]
}

if (!params.skip_emptydrops) {
if (!params.skip_cellbender) {
withName: 'CELLBENDER_REMOVEBACKGROUND' {
publishDir = [
path: { "${params.outdir}/${params.aligner}/${meta.id}/emptydrops_filter" },
path: { "${params.outdir}/${params.aligner}/${meta.id}/cellbender_removebackground" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
2 changes: 1 addition & 1 deletion conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ params {

// Input data
input = 'https://github.com/nf-core/test-datasets/raw/scrnaseq/samplesheet-2-0.csv'
skip_emptydrops = true // module does not work on small dataset
skip_cellbender = true // module does not work on small dataset

// Genome references
fasta = 'https://github.com/nf-core/test-datasets/raw/scrnaseq/reference/GRCm38.p6.genome.chr19.fa'
Expand Down
2 changes: 1 addition & 1 deletion conf/test_cellranger_multi.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ params {
cellranger_multi_barcodes = "${projectDir}/assets/cellranger_barcodes_samplesheet.csv"
gex_frna_probe_set = "${projectDir}/assets/frna_probeset_subset.csv"
fb_reference = "${projectDir}/assets/fb_reference.csv"
skip_emptydrops = true // not enough data in small test
skip_cellbender = true // not enough data in small test

// Genome references
fasta = 'https://ftp.ensembl.org/pub/release-110/fasta/homo_sapiens/dna/Homo_sapiens.GRCh38.dna.chromosome.14.fa.gz'
Expand Down
16 changes: 8 additions & 8 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d
- [Cellranger](#cellranger)
- [Cellranger ARC](#cellranger-arc)
- [Cellranger multi](#cellranger-multi)
- [Cellbender emptydrops filter](#cellbender-emptydrops-filter)
- [Cellbender remove background filter](#cellbender-remove-background-filter)
- [Other output data](#other-output-data)
- [MultiQC](#multiqc)

Expand Down Expand Up @@ -124,15 +124,15 @@ for the corresponding documentation.
- Overall same output structure as cellranger. In case of multiplexed samples there will be one ouput folder for
each demultiplexed sample, and one containing all (non-demultiplexed) cells.

## Cellbender emptydrops filter
## Cellbender remove background filter

The pipeline also possess a subworkflow imported from scdownstream to perform emptydrops calling and filtering using [cellbender](https://github.com/broadinstitute/CellBender). The process is simple, it takes a raw/unfiltered matrix file, and performs the emptydrops calling and filtering on it, generating another matrix file.
The pipeline also possess a subworkflow imported from scdownstream to perform filter empty drops using [cellbender](https://github.com/broadinstitute/CellBender) remove background function. The process is simple, it takes a raw/unfiltered matrix file, and performs the filltering on it, generating another matrix file.

> Users can turn it of with `--skip_emptydrops`.
> Users can turn it of with `--skip_cellbender`.

**Output directory: `results/${params.aligner}/${meta.id}/emptydrops_filter`**
**Output directory: `results/${params.aligner}/${meta.id}/cellbender_removebackground`**

- Contains the emptydrops filtered matrices results generated by the cellbender subworkflow.
- Contains the cellbender filtered matrices results generated by the remove background functionality.

## Other output data

Expand All @@ -157,13 +157,13 @@ Because the pipeline has both the data directly from the aligners, and from the
modified to understand the difference between raw/filtered from the aligners itself and filtered from the empty-drops module.
So, to try to avoid confusion by the user, we added "suffixes" to the generated converted files so that we have provenance from what input it came from.

So, the conversion modules generate data with the following syntax: **`*_{raw,filtered,emptydrops_filter}_matrix.{h5ad,rds}`**. With the following meanings:
So, the conversion modules generate data with the following syntax: **`*_{raw,filtered,cellbender_filter}_matrix.{h5ad,rds}`**. With the following meanings:

| suffix | meaning |
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------- |
| raw | Conversion of the raw/unprocessed matrix generated by the tool. It is also used for tools that generate only one matrix, such as alevin. |
| filtered | Conversion of the filtered/processed matrix generated by the tool |
| emptydrops_filter | Conversion of the matrix that was generated by the cellbender empty drops filter module |
| cellbender_filter | Conversion of the matrix that was generated by the cellbender remove background filtering module |

> Some aligners, like `alevin` do not produce both raw&filtered matrices. When aligners give only one output, they are treated with the `raw` suffix.
> Some aligners may have an option to give both raw&filtered and only one, like `kallisto`. Be aware when using the tools.
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ params {
cellrangerarc_reference = null

// Emptydrops parameters
skip_emptydrops = false
skip_cellbender = false

// CellrangerMulti parameters
cellranger_vdj_index = null
Expand Down
2 changes: 1 addition & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"type": "boolean",
"description": "Skip FastQC"
},
"skip_emptydrops": {
"skip_cellbender": {
"type": "boolean",
"description": "Skip cellbender empty drops filter subworkflow"
}
Expand Down
2 changes: 1 addition & 1 deletion tests/main_pipeline_cellrangermulti.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nextflow_pipeline {
gtf = 'https://ftp.ensembl.org/pub/release-110/gtf/homo_sapiens/Homo_sapiens.GRCh38.110.gtf.gz'
aligner = 'cellrangermulti'
protocol = 'auto'
skip_emptydrops = true
skip_cellbender = true
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params {
protocol = '10XV2'

// small dataset does not have sufficient data for emptydrops module
skip_emptydrops = true
skip_cellbender = true

validationSchemaIgnoreParams = 'genomes'
}
Expand Down
8 changes: 4 additions & 4 deletions workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,16 @@ workflow SCRNASEQ {
ch_h5ads = MTX_TO_H5AD.out.h5ad

//
// SUBWORKFLOW: Run cellbender emptydrops filter
// SUBWORKFLOW: Run cellbender remove background subworkflow
//
if ( !params.skip_emptydrops && !(params.aligner in ['cellrangerarc']) ) {
// emptydrops should only run on the raw matrices thus, filter-out the filtered result of the aligners that can produce it
if ( !params.skip_cellbender && !(params.aligner in ['cellrangerarc']) ) {
// module should only run on the raw matrices thus, filter-out the filtered result of the aligners that can produce it
H5AD_REMOVEBACKGROUND_BARCODES_CELLBENDER_ANNDATA (
ch_h5ads.filter { meta, mtx_files -> meta.input_type == 'raw' }
)
ch_h5ads = ch_h5ads.mix(
H5AD_REMOVEBACKGROUND_BARCODES_CELLBENDER_ANNDATA.out.h5ad
.map{ meta, file -> [ meta + [input_type: 'emptydrops'], file ]}
.map{ meta, file -> [ meta + [input_type: 'cellbender_filter'], file ]}
)
}

Expand Down
Loading