Skip to content

Commit

Permalink
Added error check if isotypes are not specified. Added NEWS
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPM committed Aug 5, 2021
1 parent 572853e commit 4e15fed
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# dsb 0.2.0

• Enhancements
quantile clipping: rarely, a small minority of cells can have outlier values for a single protein, for example expression at level -25 after normalization. These values can now be clipped to be the lowest / highest quantile by default c(0.001, 0.9995). To use this feature set `quantile.clipping = TRUE` and quantile.clip to be a vector of lowest and highest quantile values to use; by default c(0.001, 0.9995).

• return dsb internal stats
Some advanced users may desire to look into the latent noise variables estimated by dsb. Setting `return.stats = TRUE` now returns a list, the first element is the dsb normalized ADT values, the second element is a dataframe of noise variables for each cell, including the derived "dsb technical component" along with its constituent variables, the background mean and the isotype control protein values for each cell.

• Documentation
Documentation has been overhauled, the main vignette now includes simpler estimation of cells vs empty drops by using the EmptyDrops method that is now implemented by Cell Ranger by default. A workflow for multimodal (CITE-seq) single cell analysis using the dsb method for normalization is provided including loading raw data, quality control, clustering and multiple versions of the Seurat Weighted Nearest Neighbors joint mRNA and protein clustering method.

An additional vignette is provided with step by step intuition for underlying code / modeling for the dsb method.


# dsb 0.1.0

• dsb is now hosted on CRAN: [go to dsb on CRAN](https://cran.r-project.org/web/packages/dsb/index.html)
Expand Down
6 changes: 5 additions & 1 deletion R/dsb.r
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ DSBNormalizeProtein = function(cell_protein_matrix, empty_drop_matrix, denoise.c
use.isotype.control = TRUE, isotype.control.name.vec = NULL,
define.pseudocount = FALSE, pseudocount.use,quantile.clipping = FALSE,
quantile.clip = c(0.001, 0.9995), return.stats = FALSE){
# check names of supplied isotype controls for denoising are in the matrix
# error handling
if(!is.null(isotype.control.name.vec)) {
if(!all(isotype.control.name.vec %in% rownames(cell_protein_matrix))) {
stop("the following isotype control cannot be found in the rownames of `cell_protein_matrix`: ",
Expand All @@ -74,9 +74,13 @@ DSBNormalizeProtein = function(cell_protein_matrix, empty_drop_matrix, denoise.c
if (isTRUE(return.stats) & isFALSE(denoise.counts)) {
stop("set return.stats = FALSE to run dsb if denoise.counts = FALSE")
}
if (isTRUE(use.isotype.control) & is.null(isotype.control.name.vec)) {
stop('must specify a vector of isotype control names if use.isotype.control is set to TRUE (recommended)')
}
# convert input data to matrix (e.g. for sparse matrix conversion) and log transform
adt = cell_protein_matrix %>% as.matrix()
adtu = empty_drop_matrix %>% as.matrix()
# log transform
if(isTRUE(define.pseudocount)) {
adtu_log = log(adtu + pseudocount.use)
adt_log = log(adt + pseudocount.use)
Expand Down
6 changes: 3 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Submission Aug 1 2021

Submission for version 0.2.0
Update submission for version 0.2.0

## Test environments
* Winbuilder
Expand All @@ -17,8 +17,8 @@ Bioconductor does not yet build and check packages for R version 4.2 see https:/
devtools::check(args = c('--as-cran'))
0 errors ✓ | 0 warnings ✓ | 0 notes ✓

**Re. custom license**
Please refer to Cran team comments from 2021/01/24
**Re. custom license used in this package**
Please refer to Cran team comments from 2021/01/24

"Please only ship the CRAN template for the BSD_3_clause license."
Following instructions sent via email 9 Jan, 2021, the CRAN template for BSD-3 (https://cran.r-project.org/web/licenses/BSD_3_clause) is listed "in addition to the alternate BSD text". License documents are referenced in the description as instructed (see email below).
Expand Down

0 comments on commit 4e15fed

Please sign in to comment.