-
Notifications
You must be signed in to change notification settings - Fork 0
/
match-standards-water-mix04.Rmd
executable file
·2287 lines (1681 loc) · 75 KB
/
match-standards-water-mix04.Rmd
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Identifying mix04 standards in water"
author: "Andrea Vicini, Vinicius Verri Hernandes, Johannes Rainer"
output:
rmarkdown::html_document:
highlight: pygments
toc: true
toc_float: true
toc_depth: 3
fig_width: 5
---
```{r, include = FALSE, cached = FALSE}
knitr::read_chunk("R/match-standards-chunks.R")
MIX <- 4
MATRIX <- "Water"
POLARITY <- "POS"
## settings to find MS2 spectra for features. Be rather inclusive here.
FEATURE_MS2_PPM <- 20
FEATURE_MS2_TOLERANCE <- 0.05
```
```{r, libraries, echo = FALSE, message = FALSE}
```
```{r, general-settings, echo = FALSE, message = FALSE}
```
**Current version: 0.10.0, 2022-05-30.**
# Introduction
Mixes of standards have been solved in water or added to human serum sample
pools in two different concentration and these samples were measured with the
LC-MS setup from Eurac (used also to generate the CHRIS untargeted metabolomics
data). Assignment of retention time and observed ion can be performed for each
standard based on MS1 information such as expected m/z but also based on the
expected difference in signal between samples with low and high concentration of
the standards. Finally, experimental fragment spectra provide the third level of
evidence. Thus, the present data set allows to annotate features to standards
based on 3 levels of evidence: expected m/z, difference in measured intensity
and MS2-based annotation.
A detailed description of the approach is given in
[match-standards-introduction.Rmd](match-standards-introduction.Rmd).
The list of standards that constitute the present sample mix are listed below
along with the expected retention time and the most abundant adduct for positive
and negative polarity as defined manually in a previous analysis by Mar
Garcia-Aloy.
```{r, standards-table, echo = FALSE, results = "asis"}
```
# Data import
We next load the data and split it according to matrix and polarity.
```{r, data-import}
```
We next also load the reference databases we will use to compare the
experimental MS2 spectra against. Below we thus load HMDB and MassBank data. We
create in addition *neutral loss* versions of the databases. Since HMDB does not
provide precursor m/z values we assume the fragment spectra to represent `[M+H]+`
ions (respectively `[M-H]-` ions for negative polarity) and add the m/z for
these adducts as *precursor m/z*.
```{r, load-reference-databases, message = FALSE}
```
```{r, setup-ion-db, message = FALSE, echo = FALSE}
```
# Initial evaluation of available MS2 data
Before performing the actual analysis that involves chromatographic peak
detection and evaluation of feature abundances, we compare all experimental MS2
spectra against the reference libraries. This provides already a first hint for
which standards a valid MS2 spectrum was recorded (and hence would allow
annotation based on evidence 3) and what related retention time might be.
We first extract all MS2 spectra from the respective data files and process them
by first removing all peaks with an intensity below 5% of the highest peak
signal, then scaling all intensities to a value range between 0 and 100 and
finally remove all MS2 spectra with less than 2 peaks.
```{r prepare-all-ms2}
fls <- fileNames(data_all)[data_all$polarity == "POS"]
```
```{r, all-ms2}
```
We next match these spectra against all reference spectra from HMDB for the
standards in `r MIX_NAME`.
The settings for the matching are defined below. These will be used for all MS2
spectra similarity calculations. All matching spectra with a similarity larger
0.7 are identified.
```{r, compare-spectra-param}
```
Standards for which no MS2 spectrum in HMDB is present are listed in
the table below.
```{r, echo = FALSE, results = "asis"}
tmp <- std_dilution[!(std_dilution$HMDB %in% hmdb_std$compound_id), ]
pandoc.table(tmp[, c("name", "HMDB", "formula")], style = "rmarkdown",
caption = "Standards for which no reference spectrum is available")
```
The table below lists all standards and the number of matching reference spectra
(along with their retention times).
```{r, table-all-ms2-hmdb, echo = FALSE, results = "asis"}
```
We repeat the same analysis for the negative polarity data (code not shown
again).
```{r, echo = FALSE}
fls <- fileNames(data_all)[data_all$polarity == "NEG"]
```
```{r, all-ms2, echo = FALSE}
```
```{r, table-all-ms2-hmdb, echo = FALSE, results = "asis"}
```
We next perform the full analysis of the data set involving MS1 and MS2 data.
# Water, positive polarity
We first perform the analysis on the samples with the standards solved in pure
water acquired in positive polarity mode.
```{r}
POLARITY <- "POS"
data <- filterFile(data_all, which(data_all$polarity == POLARITY))
hmdb <- hmdb_pos
hmdb_nl <- hmdb_pos_nl
```
## Data pre-processing
We perform the pre-processing of our data set which consists of the
chromatographic peak detection followed by a peak refinement step to reduce peak
detection artifacts, the correspondence analysis to group peaks across samples
and finally the gap-filling to fill in missing peak data from samples in which
no chromatographic peak was detected. For details on settings please refer to
the analysis of *mix 01* samples.
```{r, preprocessing, eval = !file.exists(paste0(RDATA_PATH, "processed_data_", POLARITY, ".RData")), message = FALSE}
```
```{r, echo = FALSE}
load(paste0(RDATA_PATH, paste0("processed_data_", POLARITY, ".RData")))
data_FS <- filterFile(data, which(data$mode == "FS"),
keepFeatures = TRUE)
```
## Signal intensity difference
We compute the difference in (log2) signals between samples with high and low
concentration of the standards and calculate the p-value for this difference
using the Student's t-test.
```{r, abundance-difference}
```
## Identification of features matching standards
We now identify all features matching the any of the pre-defined set of adducts
for the standards of mix `r MIX`. Matching features are further subsetted to
those that show an at least twice as high signal in samples with high
concentration compared to those with low concentrations. Also, features with a
signal in low concentration but no detectable signal in high concentration are
removed.
```{r, define-adducts-pos}
```
```{r, match-features}
```
For most of the standards (`r length(unique(mD$target_name))` out of
`r nrow(std_dilution)`) in mix `r MIX` at least one feature was found
matching the standards adducts' m/z.
```{r, table-standard-no-feature, results = "asis", echo = FALSE}
```
In the next sections we investigate for each standard which assignment would be
the correct one or, for those for which no signal was detected, why that was the
case.
## Standards with matching features
While for some standards a matching feature was found we still need to evaluate
whether this matching is correct. For each standard we thus first evaluate the
EICs for all matching features, then we match their MS2 spectra (if available)
against reference libraries. To ensure correct assignment of a feature, its
retention time and eventually related MS2 spectra, we consider the following
criteria to determine the annotation confidence:
- feature(s) was/were found with m/z matching those of adduct(s) of the
standard.
- signal is higher for samples with higher concentration.
- MS2 spectra matches reference spectra for the standard (if available).
- MS2 spectra don't match MS2 spectra of other compounds.
### Acetylalanine
```{r, echo = FALSE}
std <- "Acetylalanine"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on
m/z matching. Based on their retention times, these seem however to represent
ions from different compounds.
We next plot the EICs for the assigned features and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-acetylalanine-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectra against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-acetylalanine-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
```{r mix04-water-pos-acetylalanine-acid-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
In addition we perform a neutral loss spectra comparison.
```{r mix04-water-pos-acetylalanine-ms2-hmdb_nl, echo = FALSE, fig.width = 5, fig.height = 5}
std_hmdb_nl <- hmdb_nl[hmdb_nl$compound_id == hmdb_id]
std_ms2_nl <- neutralLoss(std_ms2, nl_param)
sim <- plot_ms2_similarity_heatmap(std_ms2_nl, std_hmdb_nl, csp_nl)
```
```{r mix04-water-pos-acetylalanine-hmdb-nl, echo = TRUE, fig.cap = "Mirror plots"}
tmp_sel <- plot_select_ms2(std_ms2_nl, std_hmdb_nl, 0.2, ppm = csp_nl@ppm,
tolerance = csp_nl@tolerance)
```
Neutral loss spectra seem to match to some degree.
```{r mix04-water-pos-acetylalanine-ms2-mbank_nl, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank_nl <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey), nl = TRUE)
std_ms2_nl <- neutralLoss(std_ms2, nl_param)
sim <- plot_ms2_similarity_heatmap(std_ms2_nl, std_mbank_nl, csp_nl)
```
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
std_ms2_sel <- Spectra()
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
#### Summary
- Inconclusive. `[M+Na]+` seems to be the *closest* real signal, also based on
the EIC. Needs to be confirmed for negative polarity and serum.
- Annotation of FT01376 (RT=65, `[M+Na]+` ion) to `r std` with confidence level
**C**? (because of neutral loss spectra comparison)
- Reference MS2: FT01376 `[M+Na]+`: FT01376_F07.S0310, FT01376_F08.S0292
(low confidence).
### Allantoin
```{r, echo = FALSE}
std <- "Allantoin"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on
m/z matching. Based on their retention times, these seem however to represent
ions from different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-allantoin-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectra against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-allantoin-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
```{r mix04-water-pos-allantoin-acid-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
In both cases we don't find any match. In addition we perform a neutral loss
spectra comparison.
```{r mix04-water-pos-allantoin-ms2-hmdb_nl, echo = FALSE, fig.width = 5, fig.height = 5}
std_hmdb_nl <- hmdb_nl[hmdb_nl$compound_id == hmdb_id]
std_ms2_nl <- neutralLoss(std_ms2, nl_param)
sim <- plot_ms2_similarity_heatmap(std_ms2_nl, std_hmdb_nl, csp_nl)
```
```{r mix04-water-pos-allantoin-ms2-mbank_nl, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank_nl <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey), nl = TRUE)
std_ms2_nl <- neutralLoss(std_ms2, nl_param)
sim <- plot_ms2_similarity_heatmap(std_ms2_nl, std_mbank_nl, csp_nl)
```
For the HMDB comparison we don't find matches while for the MassBank one
the neutral loss spectra cannot be computed.
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
There are high similarity matches involving compounds different from `r std`.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
#### Summary
- Inconclusive. MS2 spectra don't match references.
- EICs also don't look that good.
### Gamma-Aminobutyric acid
```{r, echo = FALSE}
std <- "Gamma-Aminobutyric acid"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on
m/z matching. Based on their retention times, these seem however to represent
ions from different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-gamma-aminobutyric-acid-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectra against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-gamma-aminobutyric-acid-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
```{r mix04-water-pos-gamma-aminobutyric-acid-mirror-hmdb, echo = TRUE, fig.cap = "Mirror plots"}
std_ms2_sel <- plot_select_ms2(std_ms2, std_hmdb, 0.7,
ppm = csp@ppm, tolerance = csp@tolerance)
```
```{r mix04-water-pos-gamma-aminobutyric-acid-acid-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
```{r mix04-water-pos-gamma-aminobutyric-acid-mirror-mbank, echo = TRUE, fig.cap = "Mirror plots"}
tmp_sel <- plot_select_ms2(std_ms2, std_mbank, 0.7,
ppm = csp@ppm, tolerance = csp@tolerance)
```
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
#### Summary
- FT00438 (RT = 134.2, `[M+H]+` ion) with confidence **B**.
- FT00214 (RT = 134.3, `[M+H-NH3]+` ion) with confidence **B-**.
- FT00203 (RT = 133.9, `[M+H-H2O]+` ion) with confidence **B-**.
- Reference MS2: `[M+H]+`: FT00438_F07.S0662, FT00438_F08.S0654; high
confidence. `[M+H-NH3]+`: FT00214_F07.S0641, FT00214_F07.S0717,
FT00214_F08.S0565, FT00214_F08.S0633; low confidence. `[M+H-H2O]+`:
FT00203_F07.S0584, FT00203_F07.S0647, FT00203_F08.S0582, FT00203_F08.S0676;
low confidence.
```{r, echo = FALSE}
## Get MS2 spectra:
ms2 <- std_ms2[c("FT00438_F07.S0662", "FT00438_F08.S0654", "FT00214_F07.S0641",
"FT00214_F07.S0717", "FT00214_F08.S0565", "FT00214_F08.S0633",
"FT00203_F07.S0584", "FT00203_F07.S0647", "FT00203_F08.S0582",
"FT00203_F08.S0676")]
ms2$confidence <- c(rep("high", 2), rep("low", 8))
```
```{r, add-ms2-spectra, echo = FALSE}
```
### AMP
```{r, echo = FALSE}
std <- "AMP"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on m/z matching.
We next plot their EIC and visually inspect them.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The extracted MS2 spectra for the features matched to `r std` is shown
below (peaks with an intensity below 5% of the maximum peak where removed).
```{r mix04-water-pos-amp-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectrum against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-amp-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
```{r mix04-water-pos-amp-mirror-hmdb, echo = TRUE, fig.cap = "Mirror plots"}
std_ms2_sel <- plot_select_ms2(std_ms2, std_hmdb, 0.7,
ppm = csp@ppm, tolerance = csp@tolerance)
```
```{r mix04-water-pos-amp-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
```{r mix04-water-pos-amp-mirror-mbank, echo = TRUE, fig.cap = "Mirror plots"}
tmp_sel <- plot_select_ms2(std_ms2, std_mbank, 0.7,
ppm = csp@ppm, tolerance = csp@tolerance)
```
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
#### Summary
- FT05824 (RT=211.6, `[M+H]+` ion) with confidence **B**.
- FT06441 (RT=212.2, `[M+Na]+` ion) with confidence **B-**.
- FT06861 (RT=211.5, `[M+K]+` ion) with confidence **B-**.
- Eventually FT07015 (RT=226.4, `[M+2Na-H]+` ion) with confidence **B-**.
- Reference MS2: `[M+H]+`: FT05824_F07.S1006, FT05824_F07.S1049,
FT05824_F08.S1004; high confidence. `[M+Na]+`: FT06441_F08.S0996; low
confidence. `[M+K]+`: FT06861_F07.S1008, FT06861_F08.S1005; low confidence.
```{r, echo = FALSE}
## Define the feature (ion) and MS2 spectra to insert
fts <- data.frame(feature_id = c("FT05824", "FT06441", "FT06861"),
confidence_level = c("B", "B-", "B-"))
## Get MS2 spectra:
ms2 <- std_ms2[c("FT05824_F07.S1006", "FT05824_F07.S1049", "FT05824_F08.S1004",
"FT06441_F08.S0996", "FT06861_F07.S1008", "FT06861_F08.S1005")]
ms2$confidence <- c(rep("high", 3), rep("low", 3))
```
```{r, add-ions, echo = FALSE}
```
```{r, add-ms2-spectra, echo = FALSE}
```
### Glutamine
```{r, echo = FALSE}
std <- "Glutamine"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on m/z matching.
Based on their retention times, these seem however to represent ions from
different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-glutamine-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectra against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-glutamine-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
```{r mix04-water-pos-glutamine-mirror-hmdb, echo = TRUE, fig.cap = "Mirror plots"}
std_ms2_sel <- plot_select_ms2(std_ms2, std_hmdb, 0.8, ppm = csp@ppm,
tolerance = csp@tolerance)
```
```{r mix04-water-pos-glutamine-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
```{r mix04-water-pos-glutamine-mirror-mbank, echo = TRUE, fig.cap = "Mirror plots"}
tmp_sel <- plot_select_ms2(std_ms2, std_mbank, 0.7, ppm = csp@ppm,
tolerance = csp@tolerance)
```
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
#### Summary
- FT01239 (RT = 180.6 , ion `[M+H]+`): confidence **A** (A grading because the
MS2 spectra for that ion do really only match those of the standard).
- FT00841 (RT = 180.4, ion `[M+H-NH3]+`): confidence **A-**.
- Reference MS2: `[M+H]+`: FT01239_F07.S0885, FT01239_F08.S0877; high
confidence. `[M+H-NH3]+`: FT00841_F07.S0884, FT00841_F08.S0876; low
confidence.
```{r, echo = FALSE}
## Define the feature (ion) and MS2 spectra to insert
fts <- data.frame(feature_id = c("FT01239", "FT00841"),
confidence_level = c("A", "A-"))
## Get MS2 spectra:
ms2 <- std_ms2[c("FT01239_F07.S0885", "FT01239_F08.S0877", "FT00841_F07.S0884",
"FT00841_F08.S0876")]
ms2$confidence <- c(rep("high", 2), rep("low", 2))
```
```{r, add-ions, echo = FALSE}
```
```{r, add-ms2-spectra, echo = FALSE}
```
### GMP
```{r, echo = FALSE}
std <- "GMP"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on
m/z matching. Based on their retention times, these seem however to represent
ions from two different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-gmp-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectra against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-gmp-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
We find matches for spectra from feature FT06285 and FT06288. The best of them
are shown below.
```{r mix04-water-pos-gmp-mirror-hmdb, echo = TRUE, fig.cap = "Mirror plots"}
std_ms2_sel <- plot_select_ms2(std_ms2, std_hmdb, 0.8, ppm = csp@ppm,
tolerance = csp@tolerance)
```
```{r mix04-water-pos-gmp-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
We find similar results for MassBank.
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
#### Summary
- FT06285 (RT=225.8, `[M+H]+` ion) confidence level **A**.
- FT07248 (RT=225.9, `[M+K]+` ion) confidence level **A-**.
- FT06864 (RT=225.9, `[M+Na]+` ion) confidence level **A-**.
- Reference MS2: `[M+H]+`: FT06285_F07.S1055, FT06285_F07.S1111,
FT06285_F08.S1047, FT06285_F08.S1152; high confidence.
```{r, echo = FALSE}
## Define the feature (ion) and MS2 spectra to insert
fts <- data.frame(feature_id = c("FT06285", "FT07248", "FT06864"),
confidence_level = c("A", "A-", "A-"))
## Get MS2 spectra:
ms2 <- std_ms2[c("FT06285_F07.S1055", "FT06285_F07.S1111", "FT06285_F08.S1047",
"FT06285_F08.S1152")]
ms2$confidence <- c(rep("high", 4))
```
```{r, add-ions, echo = FALSE}
```
```{r, add-ms2-spectra, echo = FALSE}
```
### Leucine
```{r, echo = FALSE}
std <- "Leucine"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on
m/z matching. Based on their retention times, these seem however to represent
ions from different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-leucine-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectra against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-leucine-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
The best matching spectrum is F07.S0659 and F08.S0644 from FT0790.
Also F08.S0257 and F07.S0255 from FT0789 match (with similarity around 0.65).
```{r mix04-water-pos-leucine-mirror-hmdb, echo = TRUE, fig.cap = "Mirror plots"}
std_ms2_sel <- plot_select_ms2(std_ms2, std_hmdb, 0.7,
ppm = csp@ppm, tolerance = csp@tolerance)
```
```{r mix04-water-pos-leucine-acid-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "target_inchikey", "score"),
name = "target_name", param = csp)
```
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank,
sv = c("rtime", "target_name", "target_inchikey", "score"),
name = "target_name", param = csp)
```
There are matches with similarity higher than 0.7 involving more than one
compound (maybe they are similar?).
#### Summary
- FT00903 (RT = 148.1, `[M+H]+`): confidence level **B**.
- FT01380 (RT = 149.3, `[M+Na]+`): confidence level **B-**.
- FT01825 (RT = 149.3, `[M+2Na-H]+`): confidence level **B-**.
- FT02414 (RT = 149.3, `[M+2K-H]+`): confidence level **B-**.
- Reference MS2: `[M+H]+`: FT00903_F08.S0677; high confidence. `[M+2Na-H]+`:
FT01825_F08.S0713 low confidence.
```{r, echo = FALSE}
## Define the feature (ion) and MS2 spectra to insert
fts <- data.frame(feature_id = c("FT00903", "FT01380", "FT01825", "FT02414"),
confidence_level = c("B", "B-", "B-", "B-"))
## Get MS2 spectra:
ms2 <- std_ms2[c("FT00903_F08.S0677", "FT01825_F08.S0713")]
ms2$confidence <- c("high", "low")
```
```{r, add-ions, echo = FALSE}
```
```{r, add-ms2-spectra, echo = FALSE}
```
### Phenylethylamine
```{r, echo = FALSE}
std <- "Phenylethylamine"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on
m/z matching. Based on their retention times, these seem however to represent
ions from different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-phenylethylamine-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
We next match the extracted MS2 spectra against the reference spectra for
`r std` from HMDB and MassBank.
```{r mix04-water-pos-phenylethylamine-ms2-hmdb, echo = FALSE, fig.width = 5, fig.height = 5}
hmdb_id <- std_dilution$HMDB[std_dilution$name == std]
std_hmdb <- Spectra(cdb, filter = ~ compound_id == hmdb_id)
sim <- plot_ms2_similarity_heatmap(std_ms2, std_hmdb, csp)
```
All extracted spectra seem to match reference spectra from `r std` (although
all of the associated features were matched to ions different from `[M+H]+`.
```{r mix04-water-pos-phenylethylamine-hmdb, echo = TRUE, fig.cap = "Mirror plots"}
std_ms2_sel <- plot_select_ms2(std_ms2, std_hmdb, 0.8, ppm = csp@ppm,
tolerance = csp@tolerance)
```
```{r mix04-water-pos-phenylethylamine-ms2-mbank, echo = FALSE, fig.width = 5, fig.height = 5}
std_mbank <- get_mbank(mbank, inchikey = unique(std_hmdb$inchikey))
sim <- plot_ms2_similarity_heatmap(std_ms2, std_mbank, csp)
```
In addition we match (**all**) the MS2 spectra for the matched features against
all spectra from HMDB or MassBank identifying reference spectra with a
similarity larger than 0.7. The results (if any spectra matched) are shown in
the two following tables.
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, hmdb, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
```{r, echo = FALSE, message = FALSE, results = "asis"}
perform_match(std_ms2, mbank, sv = c("rtime", "target_name", "score"),
name = "target_name", param = csp)
```
#### Summary
- Inconclusive: from the EIC it looks the peak is around 37 seconds but then
(column overload?) signal goes until 126 seconds. All MS2 match nicely, but
the difference in precursor m/z is ~ 17.03 (against the **assumed** `[M+H]+`
ion of Phenylethylamine). This difference matches exactly the mass of
`NH3`. Thus, most likely, the MS2 spectra from HMDB do in fact represent also
`[M+H-NH3]+` ions which would make the MS2 spectra matching perfectly.
- Tricky situation is that none of the features' RT would actually match the
correct one.
- FT00449 (RT = 46.62, ion `[M+H-NH3]+`): confidence level **B**?
- FT00448 (RT = 122.6, ion `[M+H-NH3]+`): confidence level **B**?
- FT00450 (RT = 73.43, ion `[M+H-NH3]+`): confidence level **B**?
- Reference MS2: `[M+H-NH3]+`: FT00449_F07.S0121, FT00449_F07.S0213,
FT00448_F07.S0547; high confidence).
```{r, echo = FALSE}
## Get MS2 spectra:
ms2 <- std_ms2[c("FT00449_F07.S0121", "FT00449_F07.S0213", "FT00448_F07.S0547")]
ms2$confidence <- c("high")
```
```{r, add-ms2-spectra, echo = FALSE}
```
### Putrescine
```{r, echo = FALSE}
std <- "Putrescine"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on m/z matching.
Based on their retention times, these seem however to represent ions from
different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less
than 2 peaks were removed).
```{r mix04-water-pos-putrescine-ms2, echo = FALSE}
plot_spectra(std_ms2)
```
#### Summary
- FT00245 (RT = 175.6, `[M+H]+` ion): confidence level **D**.
- FT00093 (RT = 174.2, `[M+H-NH3]+` ion): confidence level **D**.
```{r, echo = FALSE}
## Define the feature (ion) and MS2 spectra to insert
fts <- data.frame(feature_id = c("FT00245", "FT00093"),
confidence_level = c("D", "D"))
```
```{r, add-ions, echo = FALSE}
```
### Pyridoxine
```{r, echo = FALSE}
std <- "Pyridoxine"
```
```{r, table-feature-matches, results = "asis", echo = FALSE, message = FALSE}
```
Many features have been assigned to this standard based on m/z matching.
Based on their retention times, these seem however to represent ions from
different compounds.
We next plot the EIC for the assigned feature and visually inspect these.
```{r, echo = FALSE}
plot_eics(data, std, feature_table, "WP", std_ms2)
```
The cleaned MS2 spectra for the features matched to `r std` are shown below
(peaks with an intensity below 5% of the maximum peak and spectra with less