Filter top differentially experssed for pheatmap from DESeq2
0
0
Entering edit mode
2.3 years ago
synat.keam ▴ 100

Dear All experts,

Hope you are all well. I am doing hierachical clustering to see whether sample in each group is clustered together. I used DESeq2 model and my code chunk below to do the clustering. I am wondering if I wanted to filter say top 100 differentially expressed genes, where should I add to my existing code chunk. Looking forward to hearing from you soon. This is just example dataset.

Kind Regards,

Synat

## Heatmap 

sampleDists <- dist(t(assay(vsd)))
library("RColorBrewer")
sampleDistMatrix <- as.matrix(sampleDists)
rownames(sampleDistMatrix) <- paste(vsd$Mouse, sep="-")
colnames(sampleDistMatrix) <- NULL
colors <- colorRampPalette( rev(brewer.pal(9, "Blues")))(255)

## annotation ============================ 

annotation.row <- data.frame(Treatment = factor(vsd@colData$Treatment,
                                                levels = c("Radiotherapy", "Sham-radiotherapy")), 
                             Group = factor(vsd@colData$Group,
                                            levels = c("0Gy:0.1 day","0Gy:1 day","0Gy:4 days",
                                                       "0Gy:8 days", "2Gy×5:0.1 day", "2Gy×5:1 day", 
                                                       "2Gy×5:4 days", "2Gy×5:8 days")))


## mapping =======================
rownames(annotation.row)<- rownames(sampleDistMatrix)

# plot the pheatmap ====================
library(pheatmap)
pheatmap(sampleDistMatrix,
         clustering_distance_rows=sampleDists,
         clustering_distance_cols=sampleDists,
         annotation_row = annotation.row, 
         border_color = TRUE, cluster_cols = F)

enter image description here

DESeq2 pheatmap • 1.1k views
ADD COMMENT
1
Entering edit mode

Scaling RNA-Seq data before clustering?#

You would extract the DEGs from the results DESeq2 object (based on padj or logFC, or both) and then subset the vsd object with it, then scaling and plotting the heatmap.

ADD REPLY

Login before adding your answer.

Traffic: 1890 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6