R package:xcms(一):导入数据

导入所需要的包

library(xcms)
library(pheatmap)
library(RColorBrewer)

多组数据的导入

myfiles <- list.files(pattern = "^neg")
myfiles
pd <- data.frame(sample_name = sub(basename(myfiles), pattern = ".mzML",replacement = "", 
                                   fixed = TRUE),sample_group = c(rep("FA", 4), rep("HFD", 4)),stringsAsFactors = FALSE)
pd
raw_data <- readMSData(files = myfiles, pdata = new("NAnnotatedDataFrame", pd),mode = "onDisk")

单个数据的导入

dda_data <- readMSData("neg_20211-fa-68.mzML", mode = "onDisk",centroided = FALSE)

提取基峰色谱图

bpis <- chromatogram(raw_data, aggregationFun = "max")
#定义两组颜色
group_colors <- c("blue","red")
names(group_colors) <- c("FA","HFD")
## 绘制所有色谱图
plot(bpis, col = group_colors[raw_data$sample_group])

BPC.png

参考资料:
LCMS data preprocessing and analysis with xcms (bioconductor.org)

你可能感兴趣的:(R package:xcms(一):导入数据)