Skip to main content
Topic: xcms Cluster Dendrogram (Read 6296 times) previous topic - next topic

xcms Cluster Dendrogram

Clustering can be a very useful tool to see if your classes are defined by your feature list or only a certain number of features.

First use xcms to collect the data and fill peaks.
Code: [Select]
library(xcms)
library(faahKO)
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)

And now for clustering and creating the dendrogram. Notice here that we have taken all of the features. You can of course create an index that will allow you to only have certain features.
Code: [Select]
## plot the dendrogram for all of the features
plot(hclust(dist(t(groupval(fill, "medret", "into")))))
## an index can be easily made and  then used to restrict the number of features used in clustering.
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page