-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from nf-core/19-implement-scds-doublet-detection
Implement scds doublet detection
- Loading branch information
Showing
8 changed files
with
107 additions
and
4 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
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
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
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,6 @@ | ||
name: scds | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- bioconda::bioconductor-scds=1.18.0 |
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,24 @@ | ||
process SCDS { | ||
tag "$meta.id" | ||
label 'process_medium' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'oras://community.wave.seqera.io/library/bioconductor-scds:1.18.0--b0910f04d88fb193': | ||
'community.wave.seqera.io/library/bioconductor-scds:1.18.0--aaf652129cf65197' }" | ||
|
||
input: | ||
tuple val(meta), path(rds) | ||
|
||
output: | ||
tuple val(meta), path("*.rds"), emit: rds | ||
tuple val(meta), path("*.csv"), emit: predictions | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
prefix = task.ext.prefix ?: "${meta.id}" | ||
template 'scds.R' | ||
} |
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,51 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
library(scds) | ||
library(SingleCellExperiment) | ||
|
||
sce <- readRDS("${rds}") | ||
|
||
## Annotate doublet using binary classification based doublet scoring: | ||
sce <- bcds(sce, retRes = TRUE, estNdbl=TRUE) | ||
|
||
## Annotate doublet using co-expression based doublet scoring: | ||
try({ | ||
sce <- cxds(sce, retRes = TRUE, estNdbl=TRUE) | ||
}) | ||
|
||
### If cxds worked, run hybrid, otherwise use bcds annotations | ||
if ("cxds_score" %in% colnames(colData(sce))) { | ||
## Combine both annotations into a hybrid annotation | ||
sce <- cxds_bcds_hybrid(sce, estNdbl=TRUE) | ||
|
||
predictions <- colData(sce)[, 'hybrid_call', drop=FALSE] | ||
} else { | ||
predictions <- colData(sce)[, 'bcds_call', drop=FALSE] | ||
} | ||
|
||
saveRDS(sce, "${prefix}.rds") | ||
|
||
colnames(predictions) <- "${prefix}" | ||
write.csv(predictions, "${prefix}.csv") | ||
|
||
################################################ | ||
################################################ | ||
## VERSIONS FILE ## | ||
################################################ | ||
################################################ | ||
|
||
r.version <- strsplit(version[['version.string']], ' ')[[1]][3] | ||
scds.version <- as.character(packageVersion('scds')) | ||
|
||
writeLines( | ||
c( | ||
'"${task.process}":', | ||
paste(' R:', r.version), | ||
paste(' scds:', scds.version) | ||
), | ||
'versions.yml') | ||
|
||
################################################ | ||
################################################ | ||
################################################ | ||
################################################ |
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
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