2

I have a matrix of real biological data, where the rows are chromosome regions, the columns are cell types, and each entry is a real value that represents a particular sensitivity.

Here are my data:

                    gm12878  h1.hesc    hela.s3     hepg2     huvec       k562
chr1-66660-66810    0.00000 0.000000  2.8250000   0.75000 0.0000000   0.850000
chr1-564520-564670 15.63564 4.546988 57.7813793 130.22636 5.8088889 101.680952
chr1-568060-568210 17.90698 3.697059 15.9627451  34.88667 4.1000000  31.039474
chr1-568900-569050 41.70294 7.456818 28.3984615  59.46496 8.5194444  44.658333
chr1-601040-601190  0.40000 0.750000  0.5333333   0.40000 0.3000000   0.300000
chr1-662500-662650  0.00000 3.450000  0.2500000  63.00000 0.9923077   5.746988

I would like to visualize these data into a 3D bar plot in R, where each real value is a parallelepipedon with height proportional to its value.

Something like this figure (from: "A semantic analysis of the annotations of the human genome", Sorin Draghici, Bioinformatics 2005): A semantic analysis of the annotations of the human genome

I would have to have all the chromosome region labels on the Y axis, all the cell types on the X axis, and the data sensitivities on the Z axis. How could I do it?

EDIT: I tried to follow this question but the format of my data is different from that example data format.

Community
  • 1
  • 1
DavideChicco.it
  • 3,318
  • 13
  • 56
  • 84
  • [**latticeExtra**](http://cran.r-project.org/web/packages/latticeExtra/index.html) does still exist, and is a very useful extension to **lattice**. Did you try `install.packages("latticeExtra")`, taking care to get the spelling and caps just right? – Josh O'Brien Apr 09 '15 at 20:28
  • Oh sorry, you're right! I still cannot make it work: what does 'y~x+z' mean? Thanks – DavideChicco.it Apr 09 '15 at 20:42
  • It's an example of **lattice**'s formula notation (see e.g. `?xyplot`). In the linked example, which calls `cloud()`, it indicates that the variable named `y` should get plotted in the vertical dimension, with the variables `x` and `z` supplying the conditioning values (i.e. the ones along the the x and y axes in the image attached to your question.) – Josh O'Brien Apr 09 '15 at 20:52
  • Yes, I'm reading the documentation. Anyway I noticed that my data format is different from that example. That example data are in the x y z format, while mine are just a real matrix. Should I convert my data into that format or is there any way I could use them in the format they are? Thanks! – DavideChicco.it Apr 09 '15 at 20:56
  • Yep, you'll need to convert the data into that format (with three adjacent columns for the `x`, `y`, and `z` variables), if you want to use most any of the **lattice** plotting functions. – Josh O'Brien Apr 09 '15 at 21:05
  • try the bar3d function in package `vrmlgen` – baptiste Apr 09 '15 at 21:22
  • I don't understand how the proposed graphing format is better than a heatmap. To use a Tufte-ism, the ink-to-data ratio is crazy high in that plot. In addition the axes labels are hard to read and hard to match to the appropriate row/column, and the data in the back corner is obscured. – Curt F. Apr 09 '15 at 23:42
  • 1
    @CurtF. This is not a debate on heatmaps versus 3D plots. On the contrary, it is a question on how to generate a 3D plot in R. – DavideChicco.it Apr 10 '15 at 17:03

0 Answers0