Filters the unfiltered DEGs in DEGs[[assay]] and stores the filtered
results
in a new named slot DEGs[[saveAssay]]. Multiple filtered result sets can
be stored with different assay names.
Arguments
- object
A
genedaobject with a DEG table set viaSetDEGs()- assay
The DEG slot to filter
- alpha
Adjusted p-value threshold (<=)
- l2fc
Absolute log2 fold change threshold (>=)
- saveAssay
Character name for the filtered result set (e.g., "padj05_lfc1")
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")
obj <- FilterDEGs(obj,
assay = "KO_vs_WT", alpha = 0.05, l2fc = 1,
saveAssay = "KO_vs_WT_filtered"
)
nrow(DEGs(obj, "KO_vs_WT_filtered"))
#> [1] 1198
