vignettes/identify_single_peak.Rmd
identify_single_peak.Rmd
Some times we only want to match one peak. We can use identify_single_peak()
function to identify single peak.
We need the m/z, rt and MS2 information. MS2 must be a matrix with two columns: mz
and intensity
.
mz <- 472.3032
rt <- 772.906
ms2 <- data.frame(
mz = c(81.38455,82.19755,85.02840,86.5934,86.98958,89.48135,90.70250,
93.03886, 102.09140, 103.03903, 116.01658, 127.98412,
134.06819, 152.46967, 162.02180, 162.05521, 162.11261),
intensity = c(1396.341,1488.730,15473.604, 1740.842,2158.014,1351.686,
1547.099,1325.864,22441.047,76217.016,17809.395,
1439.743, 1729.786, 1543.765, 2228.743,
3508.225, 529120.000),
stringsAsFactors = FALSE
)
ms2 %>% head()
#> mz intensity
#> 1 81.38455 1396.341
#> 2 82.19755 1488.730
#> 3 85.02840 15473.604
#> 4 86.59340 1740.842
#> 5 86.98958 2158.014
#> 6 89.48135 1351.686
identify_single_peak()
function
First we load the database from metID
package and then put them in a example
folder.
##create a folder named as example
path <- file.path(".", "example")
dir.create(path = path, showWarnings = FALSE)
##get database from metID
database <- system.file("ms2_database", package = "metID")
file.copy(from = file.path(database, "msDatabase_rplc0.0.2"),
to = path, overwrite = TRUE, recursive = TRUE)
#> [1] TRUE
Now in your ./example
, there are one file, namely msDatabase_rplc_0.0.2
.
<-
annotation_result identify_single_peak(ms1.mz = mz,
ms1.rt = rt,
ms2 = ms2,
ms1.match.ppm = 15,
rt.match.tol = 30,
ms2.match.tol = 0.5,
database = "msDatabase_rplc0.0.2",
path = path)
#> Use all CE values.
#>
#> Identifing metabolites with MS/MS database...
#>
|
| | 0%
|
|======================================================================| 100%
#>
#> All done.
annotation_result
is a metIdentifyClass
object, so you can use all the functions for it to process.