[BioC] question about heatmap.2

Saroj K Mohapatra smohapat at vbi.vt.edu
Mon Mar 16 17:25:55 CET 2009

Hi Wei,

I think you need to set the row.names argument in read.csv to 1.

> ?read.csv
row.names: a vector of row names.  This can be a vector giving the
          actual row names, or a single number giving the column of the
          table which contains the row names, or character string
          giving the name of the table column containing the row names.

          If there is a header and the first row contains one fewer
          field than the number of columns, the first column in the
          input is used for the row names.  Otherwise if 'row.names' is
          missing, the rows are numbered.

          Using 'row.names = NULL' forces row numbering. Missing or
          'NULL' 'row.names' generate row names that are considered to
          be 'automatic' (and not preserved by 'as.matrix'). 

Because the row.names are missing from your command, the rows were numbered automatically (see above).

If you call:
>  data=read.csv("file.csv", header=T, row.names=1)

it would automatically read the row labels which should show as expected on the heatmap. I hope that solves this problem.


----- Original Message -----
From: "Christof Winter" <winter at biotec.tu-dresden.de>
To: bioconductor at stat.math.ethz.ch
Cc: public-bioconductor-J/1JLT8/XkkyrOtl8ohm9u1GAupnlqi7 at ciao.gmane.org
Sent: Monday, March 16, 2009 12:15:53 PM GMT -05:00 US/Canada Eastern
Subject: Re: [BioC] question about heatmap.2

Wei Xu wrote, On 16.03.2009 16:52:
> Hi, there,
> This is a simple question.
> I'm trying to read my data from a .csv file and draw a heatmap with
> heatmap.2.
> Here is my code,
> data=read.csv("file.csv", header=T)
> x=as.matrix(data[,2:5])
> heatmap.2(x)
> The file.csv includes 5 columns and 118 rows. First columns are the labels
> for the each probe.
>               ID Temperature Agitation Oxygen Adhesion
> BG03_B01      -0.098     0.013  0.007    0.064
> BG04_A09       0.025     0.013 -0.011   -0.054
> BG04_A11      -0.005     0.000  0.018    0.050
> When I had my heatmap, the probes were labeled with the number from 1 to 117
> instead of the ID numbers in the file. My question is how can I label each
> probe in the heatmap with their IDs. Thanks.
> Wei


heatmap.2(x, labRow=x$ID)


Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

Computational Biology
VBI @ Virginia Tech

More information about the Bioconductor mailing list