question about heatmap.2
3
0
Entering edit mode
Wei Xu ▴ 100
@wei-xu-2693
Last seen 9.6 years ago
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 -- Wei Xu Aquatic Animal Health Laboratory Pathobiology and Diagnostic Investigation College of Veterinary Medicine Michigan State University East Lansing, MI, 48824 Tel: 1-517-432-8258 [[alternative HTML version deleted]]
probe probe • 1.6k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 13 hours ago
United States
Hi Wei, dat <- read.csv("file.csv", header = TRUE, row.names = 1) heatmap.2(as.matrix(dat)) Best, Jim Wei Xu wrote: > 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 > -- James W. MacDonald, M.S. Biostatistician Douglas Lab 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826
ADD COMMENT
0
Entering edit mode
@christof-winter-3264
Last seen 9.6 years ago
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 > Try heatmap.2(x, labRow=x$ID) Christof
ADD COMMENT
0
Entering edit mode
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. Best, Saroj ----- Original Message ----- From: "Christof Winter" <winter@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 > Try heatmap.2(x, labRow=x$ID) Christof _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Computational Biology VBI @ Virginia Tech
ADD REPLY
0
Entering edit mode
Thanks a lot for the help. It works fine now. Wei On Mon, Mar 16, 2009 at 12:25 PM, Saroj K Mohapatra <smohapat@vbi.vt.edu>wrote: > 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. > > Best, > Saroj > > ----- Original Message ----- > From: "Christof Winter" <winter@biotec.tu-dresden.de> > To: bioconductor@stat.math.ethz.ch > Cc: public- bioconductor-J/1JLT8/XkkyrOtl8ohm9u1GAupnlqi7@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 > > > > Try > > heatmap.2(x, labRow=x$ID) > > Christof > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > > -- > Computational Biology > VBI @ Virginia Tech > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > > -- Wei Xu Aquatic Animal Health Laboratory Pathobiology and Diagnostic Investigation College of Veterinary Medicine Michigan State University East Lansing, MI, 48824 Tel: 1-517-432-8258 [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
@christof-winter-3264
Last seen 9.6 years ago
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 > Try heatmap.2(x, labRow=x$ID) Christof
ADD COMMENT

Login before adding your answer.

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