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.
Arguments
- res_obj
edgeR
results object to be converted- ...
Additional arguments passed to
edgeR::topTags()
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)
#> feature_id logFC logCPM F PValue FDR
#> 1 gene594 -13.24234 10.480084 14.356491 0.001158435 0.6621685
#> 2 gene540 11.21107 8.757970 10.835508 0.003672477 0.6621685
#> 3 gene227 -9.82117 9.394335 10.000609 0.004987501 0.6621685
#> 4 gene457 9.76675 9.684480 9.487327 0.006013172 0.6621685
#> 5 gene278 12.23098 10.813620 9.422147 0.006123842 0.6621685
#> 6 gene347 -11.30740 8.118997 9.386571 0.006125388 0.6621685