biocontext

bioctx answers Bioconductor questions from the package documentation and source on your disk. Every claim cites a file, a line range, and a package version.

bioc-context - Bioconductor package research openai/gpt-5.6-luna/medium

bioctx◉ openai/gpt-5.6-luna/medium

Welcome to bioc-context. 30 Bioconductor package resources loaded locally.

1

You

@DESeq2 How does apeglm log2FoldChange shrinkage differ from ashr shrinkage? What is the recommended log2FoldChange shrinkage method? Show source code chunks to compare.

2

Agent thinking...

AI

  • search (In DESeq2 1.52.0, how does apeglm log2FoldChange shrinkage differ fro...)
  • read (vignettes/Analyzing-RNA-seq-data-with-DESeq2.md)
  • grep (source)
  • read (source/R/lfcShrink.R)
  • read (source/man/lfcShrink.Rd)
  • search (apeglm versus ashr shrinkage: prior distribution, posterior estimate,...)
  • read_many (source/R/lfcShrink.R +2 ranges)
  • evidence (vignettes/Analyzing-RNA-seq-data-with-DESeq2.md +6 spans)
  • evidence (reference-manual.md +5 spans)
3

Scope

This is for DESeq2 1.52.0 (Bioconductor 3.23). Both estimators are called through lfcShrink().

Aspect apeglm ashr
Prior Adaptive, heavy-tailed Student’s-t prior Fitted mixture of Normal distributions
Input used Count matrix, design matrix, dispersions, offsets, weights DESeq2 MLE LFCs and their standard errors
Point estimate Posterior mode / MAP estimate Posterior mean
Large LFC Heavy tails reduce shrinkage of genuinely large effects Mixture components adapt and avoid excessive shrinkage
Contrasts Not supported directly; requires coef Supported

apeglm re-estimates the coefficient under the negative-binomial count likelihood, whereas ashr treats the estimated LFC and its standard error as an approximately Normal measurement and shrinks it under an empirical mixture prior. [E4] [E7]

Recommended method

For the usual single-coefficient LFC shrinkage, use:

res <- lfcShrink(dds, coef=2, type="apeglm")

apeglm has been the DESeq2 default since 1.28.0 and is the general recommendation wherever its coef requirement fits. [E6]

4

DESeq2 source code showing the computation

DESeq2 builds the inputs to the external apeglm optimizer from the count data and the fitted model:

Y       <- counts(dds)
design  <- model.matrix(design(dds), data=colData(dds))
disps   <- dispersions(dds)
mle     <- log(2) * cbind(res$log2FoldChange, res$lfcSE)
 
fit <- apeglm::apeglm(
    Y=Y, x=design, param=disps, coef=coefNum,
    mle=mle, weights=weights, offset=offset,
    method=apeMethod, ...
)
 
res$log2FoldChange <- log2(exp(1)) * fit$map[,coefNum]
res$lfcSE          <- log2(exp(1)) * fit$sd[,coefNum]

apeglm receives the negative-binomial quantities and returns fit$map and fit$sd; DESeq2 converts them from natural-log to log2 scale. [E1] [E2]

5
Sources - Analyzing-RNA-seq-data-with-DESeq2.md:1123-1129 (DESeq2 1.52.0)- reference-manual.md:983-1000 (DESeq2 1.52.0)- lfcShrink.R:118-152 (DESeq2 1.52.0)- DESeq2.Rmd:876-888 (DESeq2 1.52.0)- apeglm.R:64-102 (apeglm 1.32.0)
Ask a Bioconductor question... or / for commandspress esc to cancel
Streaming · [Esc] Cancel [@resource] Switch scope [/] Commands [Ctrl+Q] Quit @Bioconductor v0.1.0

Give the model the package.

Install the package documentation, set the scope, and read the sources behind the answer.

Packages

Install a package’s vignettes, reference manual, R scripts, and filtered source from the Bioconductor catalog.

bioc-context catalog

Bioconductor packages

3,842 indexed · four repositories

Search
clusterProfiler 4.18.0

Materializing documentation and source…

clusterProfiler/ ├─ README.md index · citation ├─ NEWS.md release notes ├─ reference-manual.md Rd ├─ vignettes/clusterProfiler.md vignette ├─ curated/ 3 docs └─ source/ YuLab-SMU/clusterProfiler ├─ R/enrichGO.R ├─ R/gseGO.R ├─ R/compareCluster.R ├─ man/gseGO.Rd ├─ vignettes/clusterProfiler.Rmd └─ DIRECTORY.md inventory

Installed clusterProfiler 4.18.0

Ask a Bioconductor question...

Scope

Name the packages a question can read. bioctx searches only what is already on disk.

bioc-context 2 selected

Resources

@DESeq2package cache @apeglmpackage cache @clusterProfilerpackage cache @Bioconductorall local resources

A mention replaces the scope. No mention keeps the last one.

@DESeq2 @apeglm shrink this interaction coefficient

Evidence

Read the files behind the answer. Each source names a line range in a pinned package version.

bioc-context 2 sources

AI

Take the coefficient name from resultsNames(dds), then pass it to lfcShrink(). apeglm shrinks a named coefficient, so no contrast is needed. [E1] [E2]

Sources - DESeq2.md:1123-1129 (DESeq2 1.52.0) - apeglm.md:212-228 (apeglm 1.32.0) - lfcShrink.R:118-152 (DESeq2 1.52.0)
Ask a follow-up...

Your agent can ask it too.

The BioContext skill runs the same session without a screen. Your agent opens one terminal, asks a package-scoped question, and reads the cited answer before it edits your R.

Check this paired bulk RNA-seq limma-voom script. I am unsure duplicateCorrelation is used correctly. Use $biocontext to verify the workflow, then fix the script.

Verifying duplicateCorrelation workflow

The script runs voom once and passes block only to lmFit. limma documents a different order for a paired design, so I will check the versioned source before I change anything.

$biocontext skill · pty session

@bioc:limma With voom and duplicateCorrelation, what order does limma document for a paired design?

  • search (duplicateCorrelation voom block consensus correlation paired design)
  • read (vignettes/usersguide.md)
  • read (source/R/dupcor.R)
  • evidence (vignettes/usersguide.md +4 spans)

run /copy to copy message to clipboard

Sources - usersguide.md:2142-2170 (limma 3.66.0)- dupcor.R:41-96 (limma 3.66.0)- voom.Rd:58-77 (limma 3.66.0)

BioContext evidence retrieved from the versioned limma vignette, reference manual, and source. limma runs voom twice: once to get weights for duplicateCorrelation, then again with the consensus correlation.

Applying the smallest correction:

v <- limma::voom(dge, design, plot = FALSE)
 
corfit <- limma::duplicateCorrelation(
  v,
  design = design,
  block = sample_info$subject
)
 
v <- limma::voom(
  dge,
  design,
  plot = FALSE,
  block = sample_info$subject,
  correlation = corfit$consensus.correlation
)
 
fit <- limma::lmFit(
  v,
  design,
  block = sample_info$subject,
  correlation = corfit$consensus.correlation
)
 
fit <- limma::eBayes(fit)

The focused test checks that the paired block is retained, the consensus correlation is finite, and the fitted model keeps every coefficient in the design.

Ask Codex to change something
gpt-5.6-luna medium fast Context 36% left weekly 11% left Fast on ~/rnaseq-2026

The skill keeps one session open for the whole task, waits for the copy marker instead of reading the redrawn terminal, and closes it with a single Ctrl-C.