Summarizes the number of DEGs in each assay of a geneda object according
to thresholds
for adjusted p-value and log2 fold-change, separately reporting
upregulated and downregulated genes.
Thresholds are inclusive (padj <= alpha, |log2FoldChange| >= lfc),
matching FilterDEGs().
Genes with a missing log2FoldChange or padj are not counted; missing
values in
other columns (e.g., gene annotations) are ignored.
Arguments
- object
A
genedaobject containing DEGs in itsDEGsslot.- alpha
Numeric; adjusted p-value threshold. Default is 0.05.
- lfc1
Numeric; lower log2 fold-change threshold. Default is 1.
- lfc2
Numeric; higher log2 fold-change threshold. Default is 2.
- assays
Optional character vector of assay names to summarize. Defaults to all assays in
object@DEGs.
Examples
data(Snail1KO)
counts <- as.matrix(Snail1KO$rawCounts)
counts <- counts[rowSums(counts >= 10) >= 3, ]
meta <- Snail1KO$metadata
rownames(meta) <- meta$Sample
meta$Genotype <- factor(meta$Genotype, levels = c("WT", "Snai1_KO"))
norm <- log2(t(t(counts) / colSums(counts)) * 1e6 + 1)
obj <- GenEDA(normalized = norm, metadata = meta, counts = counts)
# Differential expression with DESeq2 (Snai1_KO vs WT)
dds <- DESeq2::DESeqDataSetFromMatrix(counts, meta, design = ~Genotype)
dds <- DESeq2::DESeq(dds, quiet = TRUE)
res <- as.data.frame(DESeq2::results(dds))
obj <- SetDEGs(obj, res, assay = "KO_vs_WT")
SummarizeDEGs(obj, alpha = 0.05, lfc1 = 1, lfc2 = 2)
#> KO_vs_WT
#> padj<=0.05 & log2FC >=1 (Up) 656
#> padj<=0.05 & log2FC <=-1 (Down) 542
#> padj<=0.05 & log2FC >=2 (Up) 228
#> padj<=0.05 & log2FC <=-2 (Down) 181
