Heatmap using pheatmap issues
0
0
Entering edit mode
7.3 years ago
1769mkc ★ 1.2k

I have already asked this question how can I annotate my heat-map with respective genes or sample

mat<-matrix(ncol=2,nrow=4)
mat[,1]<-c(0.0387765,0.0306198,0,0)
mat[,2]<-c(0.0407321,0,0.00212375,0.0000484229)
colnames(mat)<-c("Value1","Value2")
rownames(mat)<-c("DDX11L1","AL627309.2","RP11-34P13.9","OR4F29")
pheatmap(mat)

this was the code i got and it works pretty good but since I gave that data was very small subset of my cuffdiff output .Now i want to do the same after filtering the cuffdiff output with some threshold value the dimension would be really huge.So I cannot use this code to construct the dataframe manually I suppose.I tried to convert the dataframe into matrix then add the gene name into the matrix when i try to plot I get this error

Error in hclust(d, method = method) :

I guess there is fundamentally wrong the way Im trying to do, any help or suggestion would be appreciated .

My filtered data filtered data set which I want to make heatmap

R • 7.9k views
ADD COMMENT
0
Entering edit mode

Your output is lacking the error message that normally follows the ':'

ADD REPLY
0
Entering edit mode

I tried with the normal heatmap function im getting the error "Error in heatmap(df) : 'x' must be a numeric matrix ". I guess as one of my column is character which contains the gene name ..

ADD REPLY
1
Entering edit mode

Likely, you should assign them using rownames and then remove that column, e.g.:

rownames(df) <- df[,1]
mat <- as.matrix(df[,-1])
ADD REPLY
0
Entering edit mode

rownames(df) <- df[,1] so you are assigning rownames to the data frame while selecting only the column?

ADD REPLY
1
Entering edit mode

Assuming, the row names are in the first column, yes. If in doubt, look at the output of head(df). When converting to matrix, all remaining columns must be numeric, as a matrix can only consist of a single element type, otherwise you get a character matrix.

ADD REPLY
0
Entering edit mode

thank you every much it worked....

ADD REPLY

Login before adding your answer.

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