Skip to main content
Topic: Data visulizations: PCA, scatter plot, heatmap, cloud plot (Read 5399 times) previous topic - next topic

Data visulizations: PCA, scatter plot, heatmap, cloud plot

According to literatures, there are so many kinds of plot to present LC/MS-derived metabolomic data such as principal component analysis (PCA), scatter plot, heatmap, volcano plot. As a green hand of xcms, I don't know how to use it for generating these plots. In addition, xcms online can present data in Cloud Plot. I wanna know whether it is possible to produce Cloud plot using xcms. If so, how to generate using xcms? I am desperately waiting for the answers for the questions. Your prompt responses are greatly appreciated in advance.

Best wishes,

Yong

 

Re: Data visulizations: PCA, scatter plot, heatmap, cloud pl

Reply #1
Yong,

You might want to check out the cookbook and FAQ's. We have put a lot of code for sorting different problems and frequent requests.
PCA: viewtopic.php?f=26&t=124
PLS: viewtopic.php?f=26&t=123
Heatmaps: viewtopic.php?f=26&t=385&p=1233#p1233
As for the cloud plot, it came out along side online xcms and has not been included into xcms.
I've put a little code together below for something similar however, things like the m/z scale of the points, m/z y-axis (currently showing intensity) and continuous RT plot could probably use some playing with to make it more suitable. For the RT plot I just used a mean Intensity across all samples. I did this pretty quickly, so improvements could be easyly found. You could also wrap it into the playwith package or the googleviz package to use for identification of which point is which

Code: [Select]
makePseudoCloud<-function(fill, classA, classB, pval){
require(xcms)
diff<-diffreport(fill, classA, classB, eicmax=0, file=NULL)

gr<-groups(fill)
d<-ncol(gr)
rtmed<-gr[,"rtmed"]


dat<-data.frame(X=c(rtmed, rtmed), Y=c(rowMeans(diff[,(d+6):ncol(diff)]), -(rowMeans(diff[,(d+6):ncol(diff)])) ))
plot(dat, type="h")
abline(0,0) ## make the plot

ix<-which(diff[,"pvalue"] < pval)
fold<-max(diff[ix,"fold"])
m.mz<-max(diff[,"mzmed"])
m.int<-max(dat[,"Y"])

for(i in ix){
if(diff[i, "tstat"] > 0){
foo<-(diff[i,"mzmed"]/m.mz)*m.int
#foo<-mean(as.numeric(diff[i,(d+6):ncol(diff)]))
points(diff[i,"rtmed"], foo, col="blue", pch=16, cex=5*(diff[i,"fold"]/max(fold)) )
} else if(diff[i, "tstat"] < 0){
foo<-(diff[i,"mzmed"]/m.mz)*m.int
points(diff[i,"rtmed"], -foo, col="red", pch=16, cex=5*(diff[i, "fold"]/max(fold) ))
}
}
}
~~
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