Metabolomics Society Forum

Software => XCMS => R => XCMS - Cookbook => Topic started by: hpbenton on February 02, 2013, 12:02:03 PM

Title: Heatmap of data
Post by: hpbenton on February 02, 2013, 12:02:03 PM
You want to look at a heatmap of your final data, maybe have a dendrogram as well.

 
Code: [Select]
library(xcms)
cdfpath <- system.file("cdf", package = "faahKO")
cdffiles <- list.files(cdfpath, recursive = TRUE,full=T)
xset <- xcmsSet(cdffiles)
xsg <- group(xset)
xsg <- retcor(xsg)
xsg <- group(xsg,bw=10)
xsg <- fillPeaks(xsg)

Load up the default toy dataset. Extract the intensities for each sample for each feature from the xcmsSet object. We'll take the 'into' group here but if you have used centWave for peak detection then you can also use 'intb' which is the background subtracted intensity.



Code: [Select]
library(gplots)
dat<-groupval(xsg, "medret", "into")
heatmap.2(dat, col=redgreen, scale="row", trace="none")

This code will produce a heatmap of all of your data matrix. The scaling will scale each row (feature) of your data into a Z-score. For more on z-scores look at
http://http://en.wikipedia.org/wiki/Standard_score

(http://http://www.metabolomics-forum.com/download/file.php?mode=view&id=104&sid=4c8e1e70c72b6a8b3b3c5e9868cc1d25)

[attachment deleted by admin]