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").
Arguments
- x
edgeRresults object to be converted- ...
Additional arguments passed to
edgeR::topTags()
Examples
library(edgeR)
#> Loading required package: limma
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 gene1 3.2976779 8.636724 1.62710813 0.2022516 0.7999905
#> 2 gene2 1.1300049 11.013724 0.25956733 0.6104738 0.9122581
#> 3 gene3 1.3662738 10.451157 0.35855331 0.5493786 0.9018168
#> 4 gene4 -0.6897648 10.032711 0.08902337 0.7654534 0.9313930
#> 5 gene5 0.5133503 7.443797 0.04442432 0.8330876 0.9481586
#> 6 gene6 -1.1184763 9.084475 0.21682650 0.6415194 0.9163448