-
Notifications
You must be signed in to change notification settings - Fork 0
/
S02-boxcar.R
62 lines (46 loc) · 1.47 KB
/
S02-boxcar.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
## -------------------------------------
## Based on the MSnbaseBoxCar vignette
## -------------------------------------
library("MSnbaseBoxCar")
library("magrittr")
library("ggplot2")
library("patchwork")
f <- dir(system.file("extdata", package = "MSnbaseBoxCar"),
pattern = "boxcar.mzML",
full.names = TRUE)
basename(f)
x <- readMSData(f, mode = "onDisk") %>%
filterMz(c(299, 555))
x <- bc_groups(x)
xbc <- filterBoxCar(x)
xbc2 <- bc_zero_out_box(xbc, offset = 0)
res <- combineSpectra(xbc2,
fcol = "bc_groups",
method = boxcarCombine)
p1 <- plot(x[[1]], plot = FALSE) +
labs(title = element_text("")) +
xlab(element_text(""))
p2 <- plot(x[2:4], plot = FALSE) +
labs(title = element_text("")) +
xlab(element_text(""))
p01 <- bc_plot(xbc[2:4]) +
xlim(290, 455) +
xlab(element_text(""))
p02 <- bc_plot(xbc2[2:4]) +
xlim(290, 455) +
xlab(element_text("")) +
ylab(element_text(""))
p3 <- p01 + p02
p4 <- plot(res[[1]], plot = FALSE) +
labs(title = element_text(""))
## 3D MS map
x <- readMSData(f, mode = "onDisk") %>%
bc_groups()
## use MS level to draw the full and BoxCar spectra in different
## colours
fData(x)$msLevel <- ifelse(is.na(fData(x)$bc_groups), 1, 2)
map <- MSmap(x, 1:12, 200, 1000, .005)
lattice::trellis.par.set("axis.line",
list(col = NA,lty = 1,lwd = 1))
pmap <- plot3D(map)
save(p1, p2, p3, p4, pmap, file = "boxcar.rda")