Skip to content

Commit

Permalink
Bugfix in test
Browse files Browse the repository at this point in the history
  • Loading branch information
jovoni committed Jun 6, 2024
1 parent 2d9e179 commit 9e5eb05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/test.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test_de <- function(devil.fit, contrast, pval_adjust_method = "BH", max_lfc = 10

# Extract necessary information
ngenes <- nrow(devil.fit$input_matrix)
nsamples <- nrow(devil.fit$design_matrix)
contrast <- as.array(contrast)

# Calculate log fold changes
Expand All @@ -46,7 +47,7 @@ test_de <- function(devil.fit, contrast, pval_adjust_method = "BH", max_lfc = 10

total_variance <- t(contrast) %*% H %*% contrast
#1 - stats::pchisq(mu_test^2 / total_variance, df = 1)
2 * stats::pt(abs(mu_test) / sqrt(total_variance), df = ncol(Y) - 2, lower.tail = F)
2 * stats::pt(abs(mu_test) / sqrt(total_variance), df = nsamples - 2, lower.tail = F)
}, mc.cores = n.cores) %>% unlist()

} else {
Expand Down

0 comments on commit 9e5eb05

Please sign in to comment.