Question: Heatmap using pheatmap issues
0
gravatar for krushnach80
11 months ago by
krushnach80200
krushnach80200 wrote:

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 • 640 views
ADD COMMENTlink modified 11 months ago • written 11 months ago by krushnach80200

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

ADD REPLYlink written 11 months ago by Michael Dondrup43k

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 REPLYlink written 11 months ago by krushnach80200
1

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

rownames(df) <- df[,1]
mat <- as.matrix(df[,-1])
ADD REPLYlink modified 11 months ago • written 11 months ago by Michael Dondrup43k

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

ADD REPLYlink written 11 months ago by krushnach80200
1

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 REPLYlink written 10 months ago by Michael Dondrup43k

thank you every much it worked....

ADD REPLYlink written 10 months ago by krushnach80200
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 2.3.0
Traffic: 1517 users visited in the last hour