vignettes/Version0_9_2.Rmd
Version0_9_2.Rmd
In version 0.9.2
, I just modified the
database
argument in identify_metabolites()
and identify_metabolite_alls
functions. Now you can put the
database in the work directory and then give the database name, and you
can also directory provide the database (databaseClass
) to
it.
First we load the MS1 peak and 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 MS1 peak table from metid
ms1_peak <- system.file("ms1_peak", package = "metid")
file.copy(from = file.path(ms1_peak, "ms1.peak.table.csv"),
to = path, overwrite = TRUE, recursive = TRUE)
#> [1] TRUE
##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 two files, namely
ms1.peak.table.csv
and msDatabase_rplc_0.0.2
,
respectively.
<-
annotate_result1 identify_metabolites(ms1.data = "ms1.peak.table.csv",
ms1.match.ppm = 15,
rt.match.tol = 1000000,
polarity = "positive",
column = "rp",
path = path,
candidate.num = 3,
database = "msDatabase_rplc0.0.2",
threads = 5)
#>
[33mYou don't provide MS2 data, so only use mz and/or RT for matching.
#>
[39m
[33mYou set rt.match.tol > 10,000, so RT will not be used for matching.
#>
[39m
|
| | 0%
|
|= | 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%
#>
#>
[41mAll done.
#>
[49m
msDatabase_rplc0.0.2
#> -----------Base information------------
#> Version: 0.0.2
#> Source: MS
#> Link: http://snyderlab.stanford.edu/
#> Creater: Xiaotao Shen ( shenxt1990@163.com )
#> With RT information
#> -----------Spectral information------------
#> There are 14 items of metabolites in database:
#> Lab.ID; Compound.name; mz; RT; CAS.ID; HMDB.ID; KEGG.ID; Formula; mz.pos; mz.neg; Submitter; Family; Sub.pathway; Note
#> There are 833 metabolites in total
#> There are 356 metabolites in positive mode with MS2 spectra.
#> There are 534 metabolites in negative mode with MS2 spectra.
#> Collision energy in positive mode (number:):
#> Total number: 2
#> NCE25; NCE50
#> Collision energy in negative mode:
#> Total number: 2
#> NCE25; NCE50
#>
Then we can directory provide this database to
identify_metabolites()
:
<-
annotate_result2 identify_metabolites(ms1.data = "ms1.peak.table.csv",
ms1.match.ppm = 15,
rt.match.tol = 1000000,
polarity = "positive",
column = "rp",
path = path,
candidate.num = 3,
database = msDatabase_rplc0.0.2,
threads = 5)
#>
[33mYou don't provide MS2 data, so only use mz and/or RT for matching.
#>
[39m
[33mYou set rt.match.tol > 10,000, so RT will not be used for matching.
#>
[39m
|
| | 0%
|
|= | 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%
#>
#>
[41mAll done.
#>
[49m
But what should be noticed is that it have different name for database in the final result:
annotate_result1@database
#> [1] "msDatabase_rplc0.0.2"
annotate_result2@database
#> [1] "MS_0.0.2"
It is because that if you give the
databaseClass
, soidentify_metabolites
can know the name of database, if just use thesource
andversion
as the name for database.
paste(msDatabase_rplc0.0.2@database.info$Source,
msDatabase_rplc0.0.2@database.info$Version,
sep = "_")
#> [1] "MS_0.0.2"
sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] tinytools_0.9.1 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.8
#> [5] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.6
#> [9] ggplot2_3.3.5 tidyverse_1.3.1 massdataset_0.99.7 magrittr_2.0.2
#> [13] masstools_0.99.3 metid_1.2.2
#>
#> loaded via a namespace (and not attached):
#> [1] readxl_1.3.1 backports_1.4.1 circlize_0.4.14
#> [4] systemfonts_1.0.3 plyr_1.8.6 lazyeval_0.2.2
#> [7] BiocParallel_1.28.3 crosstalk_1.2.0 listenv_0.8.0
#> [10] leaflet_2.1.0 digest_0.6.29 foreach_1.5.2
#> [13] yulab.utils_0.0.4 htmltools_0.5.2 fansi_1.0.2
#> [16] memoise_2.0.1 cluster_2.1.2 doParallel_1.0.17
#> [19] tzdb_0.2.0 openxlsx_4.2.5 limma_3.50.0
#> [22] ComplexHeatmap_2.10.0 globals_0.14.0 modelr_0.1.8
#> [25] matrixStats_0.61.0 vroom_1.5.7 pkgdown_2.0.2
#> [28] colorspace_2.0-2 rvest_1.0.2 textshaping_0.3.6
#> [31] haven_2.4.3 xfun_0.29 crayon_1.5.0
#> [34] jsonlite_1.7.3 impute_1.68.0 iterators_1.0.14
#> [37] glue_1.6.1 gtable_0.3.0 zlibbioc_1.40.0
#> [40] GetoptLong_1.0.5 shape_1.4.6 BiocGenerics_0.40.0
#> [43] scales_1.1.1 vsn_3.62.0 DBI_1.1.2
#> [46] Rcpp_1.0.8 mzR_2.28.0 viridisLite_0.4.0
#> [49] clue_0.3-60 gridGraphics_0.5-1 bit_4.0.4
#> [52] preprocessCore_1.56.0 stats4_4.1.2 MsCoreUtils_1.6.0
#> [55] htmlwidgets_1.5.4 httr_1.4.2 RColorBrewer_1.1-2
#> [58] ellipsis_0.3.2 pkgconfig_2.0.3 XML_3.99-0.8
#> [61] sass_0.4.0 dbplyr_2.1.1 utf8_1.2.2
#> [64] ggplotify_0.1.0 tidyselect_1.1.1 rlang_1.0.1
#> [67] munsell_0.5.0 cellranger_1.1.0 tools_4.1.2
#> [70] cachem_1.0.6 cli_3.2.0 generics_0.1.2
#> [73] broom_0.7.12 evaluate_0.15 fastmap_1.1.0
#> [76] mzID_1.32.0 yaml_2.3.4 ragg_1.2.1
#> [79] bit64_4.0.5 knitr_1.37 fs_1.5.2
#> [82] zip_2.2.0 ncdf4_1.19 pbapply_1.5-0
#> [85] future_1.23.0 xml2_1.3.3 compiler_4.1.2
#> [88] rstudioapi_0.13 plotly_4.10.0 png_0.1-7
#> [91] affyio_1.64.0 reprex_2.0.1 bslib_0.3.1
#> [94] stringi_1.7.6 desc_1.4.0 MSnbase_2.20.4
#> [97] lattice_0.20-45 ProtGenerics_1.26.0 ggsci_2.9
#> [100] vctrs_0.3.8 pillar_1.7.0 lifecycle_1.0.1
#> [103] furrr_0.2.3 BiocManager_1.30.16 jquerylib_0.1.4
#> [106] MALDIquant_1.21 GlobalOptions_0.1.2 data.table_1.14.2
#> [109] R6_2.5.1 pcaMethods_1.86.0 affy_1.72.0
#> [112] IRanges_2.28.0 parallelly_1.30.0 codetools_0.2-18
#> [115] MASS_7.3-55 assertthat_0.2.1 rprojroot_2.0.2
#> [118] rjson_0.2.21 withr_2.4.3 S4Vectors_0.32.3
#> [121] parallel_4.1.2 hms_1.1.1 grid_4.1.2
#> [124] rmarkdown_2.11 Biobase_2.54.0 lubridate_1.8.0