-
Notifications
You must be signed in to change notification settings - Fork 3
/
mutate_ms2.Rmd
executable file
·87 lines (69 loc) · 2.18 KB
/
mutate_ms2.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
---
title: "Add MS2 spectra data into mass_dataset class object"
author:
- name: Xiaotao Shen (https://www.shenxt.info/)
date: "Created on 2021-12-04 and updated on `r Sys.Date()`"
output:
html_document:
df_print: paged
toc: no
pdf_document:
toc: no
vignette: >
%\VignetteIndexEntry{mutate_ms2}
%\VignettePackage{massdataset}
% \VignetteEngine{knitr::rmarkdown}
% \usepackage[utf8]{inputenc}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE, echo=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
warning = FALSE,
message = TRUE,
out.width = "100%"
)
```
`mass_data` class object can also contain MS2 data.
# **Data preparation**
## mass_data class object
We need to create a `mass_data` class object first, [see this document](https://tidymass.github.io/massdataset/articles/data_import_and_export.html). And here we use the data from this step as examples.
```{r,eval=TRUE,warning=FALSE, R.options="", message=FALSE, cache=TRUE}
load("feature_table/object_pos")
load("feature_table/object_neg")
```
## MS2 data
The MS2 raw data should be converted to mgf format data. Please [refer this document](https://tidymass.github.io/metid/articles/database_construction.html).
Here we use the demo data for `tidymass`, please download it and put it in the `feature_table` folder.
[Download linke is here.](https://drive.google.com/file/d/1lDf9i49jQQ-Ar98EMdj0EwhlmtDBbG0g/view?usp=sharing)
Then uncompress it.
# **Add MS2 to `mass_dataset` class object**
Positive mode.
```{r,eval=FALSE,warning=FALSE, R.options="", message=FALSE, cache=TRUE}
object_pos2 =
mutate_ms2(
object = object_pos,
column = "rp",
polarity = "positive",
ms1.ms2.match.mz.tol = 10,
ms1.ms2.match.rt.tol = 15,
path = "feature_table/MS2_data/POS/"
)
```
Negative mode.
```{r,eval=FALSE,warning=FALSE, R.options="", message=FALSE, cache=TRUE}
object_neg2 =
mutate_ms2(
object = object_neg,
column = "rp",
polarity = "negative",
ms1.ms2.match.mz.tol = 10,
ms1.ms2.match.rt.tol = 15,
path = "feature_table/MS2_data/NEG/"
)
```
# **Session information**
```{r,eval=TRUE,warning=FALSE, R.options="", message=FALSE, cache=TRUE}
sessionInfo()
```