queryPubchem <- function(mz,ppm,mode,db_path){
if(mode=="p"){
adducts <- c("[M+2Na]2+","[M+H+K]2+","[M+H+Na]2+","[M+H+NH4]2+","[M+2H]2+","[M+2H-H2O-NH3]2+","[2M+K]1+","[2M+Na]1+","[2M+NH4]1+","[2M+H]1+","[M+2K-H]1+","[M+2Na-H]1+","[M+K]1+","[M+Na]1+","[M+Na]1+","[M+H]1+","[M1+.]1+","[M+H-NH3]1+","[M+H-H2O]1+","[M+H-FA]1+")
}
if(mode=="n"){
adducts <- c("[2M+Na-2H]1-","[2M-H]1-","[M+K-2H]1-","[M+Cl]1-","[M+Na-2H]1-","[M1-.]1-","[M-H]1-","[M-2H]2-")
}
if(mode=="ne"){
adducts <- c("M")
}
res <- lapply(adducts,getAdduct,mz=mz,ppm=ppm,db_path=db_path)
res <- ldply(res)
return(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.