Hi, I identified DEGs with LRT test in DESeq2 and clustered them with degPatterns. There were 78 DEGs but 48 genes were clustered by degPatterns. And all 48 DEGs were clustered into cluster 5 and 6. But why there was no gene in cluster 1-4? And the plots only shows cluster 5 and 6. If the 48 genes can only clustered into 2 clusters, why there were total 6 clusters? Thanks
The R script was follow: ddsfullgtt <- DESeqDataSetFromMatrix(countData = countData, colData= coldata, design = ~ ge+ti+tim) ddsLRTtt <- DESeq(ddsfullgtt,test = "LRT", reduced = ~ti + tim) resultsNames(ddsLRTtt) results(ddsLRTtt) resLRTgtt <- results(ddsLRTtt)
# mcols(resLRTgtt, use.names = TRUE) resLRTgtt = resLRTgtt[order(resLRTgtt$pvalue),] head(resLRTgtt) summary(resLRTgtt)
Subset the LRT results to return genes with padj < 0.05
library("tibble") library("dplyr") library("tidyr") library("DEGreport") library("ggplot2") sigresLRT <- resLRTgtt %>% data.frame() %>% rownamestocolumn(var="gene") %>% as_tibble() %>% filter(padj < 0.05)
Get sig gene lists
sigLRTgenes <- sigresLRT %>% pull(gene) length(sigLRTgenes)
Subset results for faster cluster finding (for classroom demo purposes)
clusteringsiggenes <- sigresLRT %>% arrange(padj)
Obtain rlog values for those significant genes
Input is a matrix of log transformed values
rld <- rlog(ddsLRTtt, blind=T) rldmat <- assay(rld) clusterrlog <- rldmat[clusteringsig_genes$gene, ]
Use the degPatterns
function from the 'DEGreport' package to show gene clusters across sample groups
coldata$titi <- factor(coldata$titi, levels=unique(coldata$titi)) clusters <- degPatterns(cluster_rlog, metadata = coldata, time = "titi", col="genotype", reduce = TRUE)
Extract the Group 1 genes
cluster_groups <- clusters$df group1 <- clusters$df %>% filter(cluster == 1)