-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmultiple-sample-visualization-functions.R
48 lines (44 loc) · 1.67 KB
/
multiple-sample-visualization-functions.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
# ---------------------------------------------------------------------------
#
# Intensity Matrix Visualization
#
# ---------------------------------------------------------------------------
plotIntensityMatrix <- function(peaksMatrix) {
colorPalette <- colorpanel(n = 10, low = "white", high = "black")
heatmap.2(
peaksMatrix, # peaks matrix
main = "", # heat map title
notecol = "black", # change font color of cell labels to black
density.info = "none", # turns off density plot inside color legend
key = FALSE, # turns off the color key
trace = "none", # turns off trace lines inside the heat map
margins = c(12, 9), # widens margins around plot
col = colorPalette, # use on color palette defined earlier
dendrogram = "none", # disable dendogram
Colv = "NA", # disable columns clustering
Rowv = "NA", # disable rows clustering,
lwid = c(0.5, 5), # adjust plot margins
lhei = c(0.5, 5) # adjust plot margins
)
}
# ---------------------------------------------------------------------------
#
# Inverse Spectra Comparison
#
# ---------------------------------------------------------------------------
compareSpectra <- function(positive, negative) {
plot(
NULL,
xlim = c(min(mass(positive), mass(negative)), max(mass(positive), mass(negative))),
ylim = c(-1.1, 1.1),
xlab = "m/z",
ylab = "Intensity"
)
for (i in 1:length(positive)) {
segments(mass(positive)[i], 0, y1 = intensity(positive)[i])
}
for (i in 1:length(negative)) {
segments(mass(negative)[i], 0, y1 = -intensity(negative)[i])
}
abline(h = 0)
}