Converts a DESeqResults object into a plain data frame with the gene
identifier as a column, sorted by p-value, with significance and direction
flags. Optionally joins shrunken log fold changes alongside the raw ones.
Arguments
- res
A
DESeqResultsobject.- fdr
Adjusted p-value cutoff for the
significantflag.- shrunk
Optional output of
DESeq2::lfcShrink(). Its log fold changes are joined by gene identifier, not by position.
Value
A data frame ordered by p-value, with gene_id, the columns
present in res, a logical significant and a direction of
"up", "down" or "ns".
Examples
res <- data.frame(
baseMean = c(100, 50, 10),
log2FoldChange = c(2, -3, 0.1),
pvalue = c(1e-20, 1e-10, 0.8),
padj = c(1e-18, 1e-8, 0.9),
symbol = c("AAA", "BBB", "CCC")
)
rownames(res) <- c("ENSG1.1", "ENSG2.2", "ENSG3.3")
tidy_results(res, fdr = 0.05)
#> gene_id symbol baseMean log2FoldChange pvalue padj significant direction
#> 1 ENSG1.1 AAA 100 2.0 1e-20 1e-18 TRUE up
#> 2 ENSG2.2 BBB 50 -3.0 1e-10 1e-08 TRUE down
#> 3 ENSG3.3 CCC 10 0.1 8e-01 9e-01 FALSE ns