Dr. Armin Ahmadvand
2
0
Entering edit mode
@ahmadvandra-13092
Last seen 6.4 years ago

I am a beginner in using R-studio to create a heat map from RNA-Seq data. I have imported csv format of cuffdiff file including FPKMs of control and treated samples, Log2, and p-value. After installing the packages "pheatmap"and "RColorBrewer", I ran the function pheatmap(file.csv):

 View(Negin_AE_BD)
> library(pheatmap)
> library("RColorBrewer")
> pheatmap(Negin_AE_BD)

 

But I got the following error message:

Error in hclust(d, method = method) : 
  NA/NaN/Inf in foreign function call (arg 11)
In addition: Warning messages:
1: In dist(mat, method = distance) : NAs introduced by coercion
2: In dist(mat, method = distance) : NAs introduced by coercion

Can anyone help me out to solve the problem ?

Thank you in advance,

Armin 

R rnaseq • 1.0k views
ADD COMMENT
0
Entering edit mode
@steve-lianoglou-2771
Last seen 13 months ago
United States

I would guess your Negin_AD_BD objet isn't what you think it is. It needs to be a numeric matrix, with no missing values.

Check the output of the following:

  • class(Negin_AD_BD) (is it matrix?)
  • class(Negin_AD_BD[1]) (is it numeric?)
  • anyis.na(Negin_AD_BD)) (is it FALSE?)

Also, you'll probably want minimally log2 your fpkms.

There are a number of tutorials out there to work with RNA-seq data, ie. an official bioconductor wofklow and a number of them on f1000research.com, and it might be beneficial to peruse those ...

ADD COMMENT
0
Entering edit mode
@ahmadvandra-13092
Last seen 6.4 years ago

Dear Steve,

Thank you for your comments. I think you could guess my problem. I tried once again, but I got another problem error message:

  >Error in heatmap3(Negin_AE_BD) : 'x' must be a numeric matrix

 Now, I have realised that the problem is in the gene ID column, which is not numeric. When I try to import the Negin_AD_BD file, the header of this column is "character"not numeric that I think it is correct. I should change the header to something else or I have to run a command in Rstudio after importing the file?  

thanks

 

ADD COMMENT
0
Entering edit mode

You need to create a numeric matrix from your data.frame. You would do this by calling as.matrix(XXX) where XXX is the subset of columns in your Negin_AE_BD data.frame that have the numeric values you are trying to plot. You would then set rownames()<- of your numeric matrix to be the geneID column that you removed to create XXX

Please don't take offense, but these are all extremely basic R data moves and I'd strongly encourage you to first get familiar with the basics of R before you try to hammer out a figure by stabbing at the dark until a heatmap materializes. It'll be much more fruitful in the long term, and in the short term you can be more confident of the results you are beginning to generate and explore.

There are many free beginner R tutorial courses out there, and I'd suggest you find one and run through it.

Good luck!

ADD REPLY

Login before adding your answer.

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