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
edgeR
results 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.7779918 9.371120 2.04697888 0.1526648 0.7462376
#> 2 gene2 3.2978201 8.637149 1.62487056 0.2025621 0.7985199
#> 3 gene3 1.1295838 11.013706 0.25943857 0.6105623 0.9124108
#> 4 gene4 1.3664148 10.451487 0.35823979 0.5495532 0.9023199
#> 5 gene5 -0.6896122 10.033066 0.08880224 0.7657364 0.9317677
#> 6 gene6 0.5129702 7.443869 0.04437207 0.8331844 0.9485190