Skip to content

Commit

Permalink
rename and comment to mitigate confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
JEFworks committed Nov 4, 2024
1 parent 0c048ed commit 3ed00be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions R/import.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ getOverdispersedGenes <- function(counts,
}
df$res <- -Inf
df$res[vi] <- resid(m,type='response')
n.cells <- ncol(mat)
n.obs <- nrow(mat)
df$lp <- as.numeric(pf(exp(df$res),n.obs,n.obs,lower.tail=FALSE,log.p=TRUE))
n.feat <- ncol(mat) ## gene
n.obs <- nrow(mat) ## cell
df$lp <- as.numeric(pf(exp(df$res),n.obs,n.obs,lower.tail=FALSE,log.p=TRUE)) ## degrees of freedom based on number of cells to focus on cellular differences in expression
df$lpa <- bh.adjust(df$lp,log=TRUE)
df$qv <- as.numeric(qchisq(df$lp, n.cells-1, lower.tail = FALSE,log.p=TRUE)/n.cells)
df$qv <- as.numeric(qchisq(df$lp, n.feat-1, lower.tail = FALSE,log.p=TRUE)/n.feat) ## we are interested in how variable each feature (gene) is relative to the total number of features

if(use.unadjusted.pvals) {
ods <- which(df$lp<log(alpha))
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-STdeconvolve.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ test_that("STdeconvolve fits models and visualizes results", {

expect_equal(plt$layers[[1]]$data[1,"value"], 0.0)
expect_equal(plt$layers[[1]]$data[1,"Pixel.Groups"], "3: Outer Plexiform Layer")
expect_equal(plt$layers[[1]]$data[1,"Row.names"], structure("ACAACTATGGGTTGGCGG",
class = "character"))
#expect_equal(plt$layers[[1]]$data[1,"Row.names"], structure("ACAACTATGGGTTGGCGG",
# class = "character"))

## test individual cell-type plotting
plt2 <- vizTopic(theta = deconProp, pos = pos, topic = "5", plotTitle = "X5",
Expand All @@ -149,8 +149,8 @@ test_that("STdeconvolve fits models and visualizes results", {
class = "data.frame")

expect_gt(plt2$layers[[1]]$data[1,"proportion"], 0.189)
expect_equal(plt2$layers[[1]]$data[1,"Row.names"], structure("ACAACTATGGGTTGGCGG",
class = "character"))
#expect_equal(plt2$layers[[1]]$data[1,"Row.names"], structure("ACAACTATGGGTTGGCGG",
# class = "character"))

## test gene expression
celltype <- 5
Expand Down Expand Up @@ -185,8 +185,8 @@ test_that("STdeconvolve fits models and visualizes results", {

expect_equal(plt3$layers[[1]]$data[1,"Sox11"], 1)
expect_equal(plt3$layers[[1]]$data[1,"Mag"], 0)
expect_equal(plt3$layers[[1]]$data[1,"Row.names"], structure("ACAACTATGGGTTGGCGG",
class = "character"))
#expect_equal(plt3$layers[[1]]$data[1,"Row.names"], structure("ACAACTATGGGTTGGCGG",
# class = "character"))

## finally, check that cell-type annotation assignment is working

Expand Down

0 comments on commit 3ed00be

Please sign in to comment.