# NOT RUN {
devtools::install_github("maialba3/LipidMSdata2")
library(LipidMS)
# for msobjects
#####################
msobject <- idPOS(msobject)
msobject <- plotLipids(msobject)
# display the first plot
msobject$annotation$plots[[1]]
msobject$annotation$plots[["yourpeakIDofinterest"]]
# save plots to a pdf file
pdf("plotresults.pdf")
for (p in 1:length(msobject$annotation$plots)){
print(msobject$annotation$plots[[p]])
}
dev.off()
# for msobjects
#####################
msbatch <- annotatemsbatch(msbatch)
# lipids plots
for (m in 1:length(msbatch$msobjects)){
if (msbatch$msobjects[[m]]$metaData$generalMetadata$acquisitionmode %in% c("DIA", "DDA")){
msbatch$msobjects[[m]] <- plotLipids(msbatch$msobjects[[m]])
}
}
# save plots to a pdf file
for (s in 1:length(msbatch$msobjects)){
if (msbatch$msobjects[[s]]$metaData$generalMetadata$acquisitionmode %in% c("DIA", "DDA")){
print(s)
if (msbatch$msobjects[[s]]$metaData$generalMetadata$acquisitionmode == "DIA"){
height <- 7
} else {
height <- 9
}
pdf(file = gsub(".mzXML", "_plots.pdf", msbatch$msobjects[[s]]$metaData$generalMetadata$file),
width = 8, height = height)
for ( pl in 1:length(msbatch$msobjects[[s]]$annotation$plots)){
print(msbatch$msobjects[[s]]$annotation$plots[[pl]])
}
dev.off()
}
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab