edger_to_df: Convert EdgeR results object to a data.frame

View source: R/edger-to-df.R

edger_to_dfR Documentation

Convert EdgeR results object to a data.frame

Description

Create a data.frame from an edgeR results object. This function calls edgeR::topTags() on the object and extracts the table data.frame with all features. This function returns all rows unsorted by default i.e. topTags(..., n=Inf, sort.by="none").

Usage

edger_to_df(x, ...)

Arguments

x

edgeR results object to be converted

...

Additional arguments passed to edgeR::topTags()

Value

data.frame

Examples

library(edgeR)
library(coriell)

# create some fake data
x <- data.frame(
  ctl1 = rnbinom(1000, size = 0.4, prob = 1e-5),
  ctl2 = rnbinom(1000, size = 0.4, prob = 1e-5),
  trt1 = rnbinom(1000, size = 0.4, prob = 1e-5),
  trt2 = rnbinom(1000, size = 0.4, prob = 1e-5),
  row.names = paste0("gene", 1:1000)
)

# run edger pipeline
group <- factor(c(1, 1, 2, 2))
y <- DGEList(counts = x, group = group)
y <- calcNormFactors(y)
design <- model.matrix(~group)
y <- estimateDisp(y, design)

# To perform quasi-likelihood F-tests:
fit <- glmQLFit(y, design)
qlf <- glmQLFTest(fit, coef = 2)

# convert the results object to a dataframe -- do not filter the results
res_df <- edger_to_df(qlf)

head(res_df)


jcalendo/coriell documentation built on March 5, 2025, 5:42 a.m.