This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I get DESeq2 heatmap result in tabular format?

Hello guy, I have use DEseq2 got the heat map based on unigenes’ readcounts. The command lines I have used are:

colData <- read.table("colData.txt") countData <- read.table("countData_DEGs(count_larger_1).txt")

rownames(colData) <- sub("fb","",rownames(colData)) all(rownames(colData) %in% colnames(countData))

countData <- countData[, rownames(colData)] all(rownames(colData) == colnames(countData))

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

pheatmap(log2.norm.counts, cluster_rows=TRUE, show_rownames=FALSE, cluster_cols=TRUE, annotation_col=df)

dev.print(pdf, 'countData_DEGs(count_larger_1_heatmap_include_cluster.pdf')

But I want to know detailed information like which unigenes clustered together. And if I could get this cluster result in tabular format would be great. How can I do that? I am very new at R language. any suggestion would be appreciated.

rna-seq

1 answer

Hi Kurban,

first you can save pheatmap as an object:

cluster.object <- pheatmap(log2.norm.counts, cluster_rows=TRUE, show_rownames=FALSE, cluster_cols=TRUE, annotation_col=df)

Then you can inspect the hierarchical tree of cluster results by

cutree(cluster.object$tree_col, number_of_clusters)

assuming that your genes are in columns. The variable number_of_clusters has to be set by you.

hi @e.rempel,

could not cut the tree, and reported this error:

cutree(cluster.object$tree_col,60) Error in cutree(cluster.object$tree_col, 60) : invalid 'tree' ('merge' component)

Hi Kurban,

the error message implies that there is something wrong with cluster.object$tree_col: an object of class hclust. Can you have a look at cluster.object$tree_col$merge?

Log in to answer this question.