Collapse Replicates effect on heat map construction
1
0
Entering edit mode
coyoung ▴ 10
@coyoung-17963
Last seen 4.8 years ago

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 • 968 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 1 day ago
United States

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 COMMENT
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 841 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