Skip to content

Commit

Permalink
1.1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
GEHoffman committed Feb 28, 2024
1 parent 836366e commit 9ae4f27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: dreamlet
Type: Package
Title: Scalable differential expression analysis of single cell transcriptomics datasets with complex study designs
Version: 1.1.18
Date: 2024-02-14
Version: 1.1.19
Date: 2024-02-28
Authors@R: person("Gabriel", "Hoffman", role=c("aut", "cre"), email="gabriel.hoffman@mssm.edu", comment=c(ORCID="0000-0002-0957-0224"))
Description: Recent advances in single cell/nucleus transcriptomic technology has enabled collection of cohort-scale datasets to study cell type specific gene expression differences associated disease state, stimulus, and genetic regulation. The scale of these data, complex study designs, and low read count per cell mean that characterizing cell type specific molecular mechanisms requires a user-frieldly, purpose-build analytical framework. We have developed the dreamlet package that applies a pseudobulk approach and fits a regression model for each gene and cell cluster to test differential expression across individuals associated with a trait of interest. Use of precision-weighted linear mixed models enables accounting for repeated measures study designs, high dimensional batch effects, and varying sequencing depth or observed cells per biosample.
VignetteBuilder: knitr
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# dreamlet 1.1.19
- bug fix in `compositePosteriorTest()`

# dreamlet 1.1.18
- bug fix

Expand Down
16 changes: 10 additions & 6 deletions R/compositePosteriorTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,20 @@
compositePosteriorTest <- function(x, include, exclude = NULL, test = c("at least 1", "all")) {
test <- match.arg(test)

stopifnot(is(x, "dreamlet_mash_result"))

# get probability from lFSR
prob <- 1 - get_lfsr(x$model)
if( is(x, "dreamlet_mash_result") ){
# get probability from lFSR
prob <- 1 - get_lfsr(x$model)
}else if(is(x, "data.frame") | is(x, "matrix")){
prob = x
}else{
stop("data type of x not recognized")
}

.compositePosteriorTest(prob, include, exclude, test)
}

# Given matrix of posterior probabilities with genes on rows and columns as conditions, compute composite probability from include vs exclude set.
.compositePosteriorTest <- function(prob, include, exclude, test = c("at least 1", "all")) {
.compositePosteriorTest <- function(prob, include, exclude=NULL, test = c("at least 1", "all")) {
test <- match.arg(test)

# if probability is NA, set it to zero
Expand All @@ -89,7 +93,7 @@ compositePosteriorTest <- function(x, include, exclude = NULL, test = c("at leas
} else if (test == "all") {
# for each gene
# probability that *ALL* cell types have a non-zero effect
prob_incl <- apply(prob[, include], 1, prod, na.rm = TRUE)
prob_incl <- apply(prob[, include, drop = FALSE], 1, prod, na.rm = TRUE)
}

prob_incl * prob_excl
Expand Down

0 comments on commit 9ae4f27

Please sign in to comment.