Skip to content

Commit

Permalink
Tests after bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
smped committed Jul 22, 2024
1 parent f601063 commit 36cd0b0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: extraChIPs
Version: 1.8.2
Version: 1.8.3
Title: Additional functions for working with ChIP-Seq data
Authors@R: person("Stevie", "Pederson",
email = "[email protected]",
Expand Down Expand Up @@ -59,9 +59,9 @@ Imports:
vctrs,
VennDiagram
Suggests:
apeglm,
BiocStyle,
covr,
cqn,
DESeq2,
EnrichedHeatmap,
Gviz,
Expand All @@ -79,5 +79,5 @@ biocViews: ChIPSeq, HiC, Sequencing, Coverage
BiocType: Software
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Config/testthat/edition: 3
32 changes: 17 additions & 15 deletions R/fitAssayDiff.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
#' No normalisation is applied when using the limma-trend model, as this allows
#' for previous normalisation strategies to be performed on the data.
#'
#' When applying the \link[DESeq2]{nbinomWaldTest}, without groups and using
#' colSums for library sizes (instead of total alignments), the standard
#' normalisation factors from \link[DESeq2]{estimateSizeFactorsForMatrix} will
#' be used. In all other scenarios, normalisation factors as returned by
#' When applying the \link[DESeq2]{nbinomWaldTest}, applying RLE normalisation
#' without groups, and using colSums for library sizes (instead of total
#' alignments), the standard normalisation factors from
#' \link[DESeq2]{estimateSizeFactors} will be used.
#' In all other scenarios, normalisation factors as returned by
#' \link[edgeR]{normLibSizes} will be used.
#' The fitType is set to 'local' when estimating dispersions, and this can be
#' easily modified by passing fitType via the dot arguments.
#' Results are additionally returned after applying \link[DESeq2]{lfcShrink}.
#'
#' Normalising to ChIP Input samples is not yet implemented.
#' Similarly, the use of offsets when applying the Wald test is not yet
Expand Down Expand Up @@ -125,7 +127,8 @@ setMethod(
norm = c("none", "TMM", "RLE", "TMMwsp", "upperquartile"),
groups = NULL, fc = 1, lfc = log2(fc), asRanges = FALSE,
offset = NULL, weighted = FALSE, ...,
null = c("interval", "worst.case"), robust = FALSE, type = "apeglm"
null = c("interval", "worst.case"), robust = FALSE,
type = c("apeglm", "ashr", "normal")
) {
method <- match.arg(method)
norm <- match.arg(norm)
Expand Down Expand Up @@ -186,20 +189,19 @@ setMethod(
if (method == "wald") {
if (!requireNamespace('DESeq2', quietly = TRUE))
stop("Please install 'DESeq2' to use this function.")
type <- match.arg(type)
dds <- .se2Wald(
x, assay, design, lib.size, norm, groups, offset, weighted, ...
)
res <- DESeq2::results(dds)
p_mu0 <- res$pvalue
pval <- p_mu0
## Apply lfcShrink as default
if (lfc != 0) {
res <- DESeq2::lfcShrink(
dds, coef = colnames(design)[ncol(design)], res = res,
type = type, lfcThreshold = abs(lfc), svalue = TRUE
)
pval <- res$svalue
}
## Apply lfcShrink as the default
res <- DESeq2::lfcShrink(
dds, coef = coef, res = res, type = type,
lfcThreshold = abs(lfc), svalue = TRUE
)
if (abs(lfc) > 0) pval <- res$svalue
## Reformat for standard edgeR column layout
res <- data.frame(
logFC = res$log2FoldChange, logCPM = log2(res$baseMean),
Expand Down Expand Up @@ -327,7 +329,7 @@ setMethod(
nf <- rep_len(NA, ncol(mat)) # Should error out if something fails below
if (is.null(lib.size) & norm == "RLE" & is.null(groups)) {
message("Calculating default DESeq2 normalisation factors...")
nf <- DESeq2::estimateSizeFactorsForMatrix(mat)
dds <- DESeq2::estimateSizeFactors(dds)
} else {
if (is.null(groups)) {
message("Calculating ", norm, " normalisation factors...")
Expand All @@ -346,8 +348,8 @@ setMethod(
)
}
}
DESeq2::sizeFactors(dds) <- nf
}
DESeq2::sizeFactors(dds) <- nf

## 3. Estimate dispersions
ft <- "local"
Expand Down
12 changes: 7 additions & 5 deletions man/fitAssayDiff-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions vignettes/differential_signal_sliding.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if (!"BiocManager" %in% rownames(installed.packages()))
pkg <- c(
"tidyverse", "Rsamtools", "csaw", "BiocParallel", "rtracklayer", "edgeR",
"patchwork", "extraChIPs", "plyranges", "scales", "glue", "here", "quantro",
"cqn", "ggrepel", "BSgenome.Hsapiens.UCSC.hg19"
"ggrepel", "BSgenome.Hsapiens.UCSC.hg19"
)
BiocManager::install(pkg, update = FALSE)
```
Expand All @@ -87,7 +87,6 @@ library(glue)
library(here)
library(magrittr)
library(quantro)
library(cqn)
library(ggrepel)
theme_set(theme_bw())
```
Expand Down

0 comments on commit 36cd0b0

Please sign in to comment.