-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path2_Raw_HRMS_data.qmd
65 lines (47 loc) · 1.52 KB
/
2_Raw_HRMS_data.qmd
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
---
title: "Raw HRMS Data"
editor_options:
chunk_output_type: console
---
# Raw HRMS Data
## A look into the mzml data structure
<https://rformassspectrometry.github.io/book/sec-raw.html>
Loading libraries
```{r}
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("tidyverse")
BiocManager::install("factoextra")
BiocManager::install("msdata")
BiocManager::install("mzR")
BiocManager::install("rhdf5")
BiocManager::install("rpx")
BiocManager::install("MsCoreUtils")
BiocManager::install("QFeatures")
BiocManager::install("Spectra")
BiocManager::install("ProtGenerics")
BiocManager::install("PSMatch")
BiocManager::install("pheatmap")
BiocManager::install("limma")
BiocManager::install("MSnID")
BiocManager::install("RforMassSpectrometry/SpectraVis")
library(Spectra)
```
Open test mzml file (Waters MSe)
```{r}
# This Waters MSe does not have totIonCurrent
# mzf <- "D:/OneDrive - Linköpings universitet/Raw_data/Dust_Florian/LC/LC_pos_mzML/QC_rep2.mzML"
# Agilent qtof data contain totIonCurrent
mzf <- "C:\\Users\\vicer06\\OneDrive - Linköpings universitet\\Documents\\01_Projects\\01_VION_HRMS_MSConvert_Processing_2024\\Test_Spectra_Function_R\\Drugstd-200ppb_1_A,3_1.mzML"
sp <- Spectra(mzf)
```
Checking metainfo
```{r}
#plotting individual spectra
plotSpectra(sp[2784]) #MS1
plotSpectra(sp[2785]) #MS2
with(spectraData(filterMsLevel(sp, 1)),
plot(rtime, totIonCurrent, type = "l"))
abline(v = rtime(sp)[2784], col = "red")
ms_2 <- filterPrecursorScan(sp, 2784)
```