Question: Collapse Replicates effect on heat map construction
0
gravatar for coyoung
5 months ago by
coyoung0
coyoung0 wrote:

Hello,

I cannot seem to figure out why my heat map does not group my samples by condition when I use collapse replicate function. The only thing that is changed is dds --> ddsColl and vstdds --> vstddsColl. Any help would be appreciated. 

### DESeq2 Analysis on Personal ###

setwd('/Users/Corey/Desktop/DESeq2/Final_DESeq2/')

library('DESeq2')

cts <- read.csv(file='/Users/Corey/Desktop/DESeq2/Final_DESeq2/cts.csv')

nrow(cts)

ncol(cts)

colData <- read.csv(file='colData.csv')

ncol(colData)

nrow(colData)

rownames(cts) <- cts$Geneid

cts$Geneid <- NULL

#library("BiocParallel")

#register(MulticoreParam(12))

dds <- DESeqDataSetFromMatrix(countData=cts, colData=colData, design= ~ patient + condition)

keep <- rowSums(counts(dds) >= 10) >= 5

dds <- dds[keep,]

dds$condition <- relevel(dds$condition, ref='NT')

# micheal said it doesnt matter what the refernce is b/c the comparision between the sample remains the same

ddsColl <- collapseReplicates(dds, dds$id)

ddsColl <- DESeq(ddsColl)


# Does ddsColl throw off heatmap generation

dds <- DESeq(dds)

resultsNames(ddsColl)

res <- results(ddsColl, name="condition_MPT_vs_NT", lfcThreshold=0.585, alpha=0.05)

res

resOrder <- res[order(res$padj),]

write.csv(as.data.frame(resOrder), file='DESeqResults.csv')

summary(resOrder)

library('pheatmap')

#ddsColl

pdf('heatmap_top100.pdf', height=10, )
select <- order(rowMeans(counts(ddsColl,normalized=TRUE)), decreasing=TRUE)[1:100]
df <- as.data.frame(colData(ddsColl)[,c("condition","patient")])
pheatmap(assay(vstddsColl)[select,], cluster_rows=FALSE,show_rownames=FALSE,cluster_cols=FALSE, annotation_col=df)
dev.off()

#dds

pdf('heatmaptop100.pdf', height=10, )
select <- order(rowMeans(counts(dds,normalized=TRUE)), decreasing=TRUE)[1:100]
df <- as.data.frame(colData(dds)[,c("condition","patient")])
pheatmap(assay(vstdds)[select,], cluster_rows=FALSE,show_rownames=FALSE,cluster_cols=FALSE, annotation_col=df)
dev.off()

 

deseq2 • 120 views
ADD COMMENTlink modified 5 months ago by Michael Love24k • written 5 months ago by coyoung0
Answer: Collapse Replicates effect on heat map construction
0
gravatar for Michael Love
5 months ago by
Michael Love24k
United States
Michael Love24k wrote:

pheatmap groups samples by distance. Take a look at the help pages in the pheatmap package. I don’t understand how this has anything to do with collapseReplicates. These operations aren’t repeated. If you collapse technical replicates, pheatmap doesn’t “know” about this, it only sees the collapsed samples you provide to it.

ADD COMMENTlink written 5 months ago by Michael Love24k

Before Collapse Replicates

After CollapseReplicates

As noted before the only changes were the dds to ddsColl objects. It seems to now group by patients rather than condition. I will also look at help pages of pheatmap also but any other information you could provide would be greatly appreciated. 

ADD REPLYlink modified 5 months ago • written 5 months ago by coyoung0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 262 users visited in the last hour