There are also a lot of useful tools in metid.

library(metid)
#> ── Attaching packages ─────────────────────────────────────────── metid 1.2.1 ──
#>  tinytools   0.9.1       massdataset 0.99.1
#> ── Conflicts ────────────────────────────────────────────── metid_conflicts() ──
#> x massdataset::apply()       masks base::apply()
#> x methods::body<-()          masks base::body<-()
#> x massdataset::colMeans()    masks base::colMeans()
#> x massdataset::colnames()    masks base::colnames()
#> x massdataset::colSums()     masks base::colSums()
#> x massdataset::filter()      masks stats::filter()
#> x massdataset::head()        masks utils::head()
#> x massdataset::intersect()   masks base::intersect()
#> x methods::kronecker()       masks base::kronecker()
#> x massdataset::mz_rt_match() masks tinytools::mz_rt_match()
#> x tinytools::read_mgf()      masks metid::read_mgf()
#> x massdataset::rowMeans()    masks base::rowMeans()
#> x massdataset::rownames()    masks base::rownames()
#> x massdataset::rowSums()     masks base::rowSums()
#> x massdataset::scale()       masks base::scale()
#> x massdataset::tail()        masks utils::tail()
#> 
#> Attaching package: 'metid'
#> The following object is masked _by_ 'package:tinytools':
#> 
#>     read_mgf
library(tidyverse)
#> ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
#>  ggplot2 3.3.5      purrr   0.3.4
#>  tibble  3.1.3      dplyr   1.0.7
#>  tidyr   1.1.3      stringr 1.4.0
#>  readr   2.0.0      forcats 0.5.1
#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
#> x tidyr::extract()   masks magrittr::extract()
#> x dplyr::filter()    masks massdataset::filter(), stats::filter()
#> x dplyr::lag()       masks stats::lag()
#> x purrr::set_names() masks magrittr::set_names()

Read MS2 data

Read msp format file using readMGF

result <- readMGF(file)

Read mzXML format file using readMZXML

result <- readMZXML(file, threads = 3)

Read MGF format file using readMGF

result <- readMGF(file)

Show metid version and logo

metid::metid_logo()
#> Thank you for using metid!
#> Version 1.1.0 (20210702)
#> More information: google tidymass metid.
#>                 _    _____  ___ 
#>  _ __ ___   ___| |_  \_   \/   \
#> | '_ ` _ \ / _ \ __|  / /\/ /\ /
#> | | | | | |  __/ |_/\/ /_/ /_// 
#> |_| |_| |_|\___|\__\____/___,'  
#>                                 

Session information

sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> 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.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] forcats_0.5.1      stringr_1.4.0      dplyr_1.0.7        purrr_0.3.4       
#>  [5] readr_2.0.0        tidyr_1.1.3        tibble_3.1.3       ggplot2_3.3.5     
#>  [9] tidyverse_1.3.1    massdataset_0.99.1 magrittr_2.0.1     tinytools_0.9.1   
#> [13] metid_1.2.1       
#> 
#> loaded via a namespace (and not attached):
#>   [1] colorspace_2.0-2      rjson_0.2.20          ellipsis_0.3.2       
#>   [4] leaflet_2.0.4.1       rprojroot_2.0.2       circlize_0.4.14      
#>   [7] GlobalOptions_0.1.2   fs_1.5.0              clue_0.3-59          
#>  [10] rstudioapi_0.13       mzR_2.26.1            listenv_0.8.0        
#>  [13] furrr_0.2.3           affyio_1.62.0         lubridate_1.7.10     
#>  [16] fansi_0.5.0           xml2_1.3.2            codetools_0.2-18     
#>  [19] ncdf4_1.17            doParallel_1.0.16     cachem_1.0.5         
#>  [22] impute_1.66.0         knitr_1.33            jsonlite_1.7.2       
#>  [25] Cairo_1.5-12.2        broom_0.7.9           dbplyr_2.1.1         
#>  [28] cluster_2.1.2         vsn_3.60.0            png_0.1-7            
#>  [31] BiocManager_1.30.16   compiler_4.1.0        httr_1.4.2           
#>  [34] backports_1.2.1       rvcheck_0.1.8         assertthat_0.2.1     
#>  [37] fastmap_1.1.0         lazyeval_0.2.2        limma_3.48.1         
#>  [40] cli_3.0.1             htmltools_0.5.2       tools_4.1.0          
#>  [43] gtable_0.3.0          glue_1.4.2            affy_1.70.0          
#>  [46] Rcpp_1.0.7            MALDIquant_1.20       Biobase_2.52.0       
#>  [49] cellranger_1.1.0      jquerylib_0.1.4       pkgdown_2.0.1        
#>  [52] vctrs_0.3.8           preprocessCore_1.54.0 iterators_1.0.13     
#>  [55] crosstalk_1.1.1       xfun_0.24             globals_0.14.0       
#>  [58] rvest_1.0.1           openxlsx_4.2.4        lifecycle_1.0.0      
#>  [61] XML_3.99-0.6          future_1.21.0         zlibbioc_1.38.0      
#>  [64] MASS_7.3-54           scales_1.1.1          MSnbase_2.18.0       
#>  [67] ragg_1.1.3            pcaMethods_1.84.0     hms_1.1.0            
#>  [70] ProtGenerics_1.24.0   parallel_4.1.0        RColorBrewer_1.1-2   
#>  [73] ComplexHeatmap_2.8.0  yaml_2.2.1            memoise_2.0.0        
#>  [76] pbapply_1.4-3         sass_0.4.0            stringi_1.7.3        
#>  [79] S4Vectors_0.30.0      desc_1.3.0            foreach_1.5.1        
#>  [82] BiocGenerics_0.38.0   zip_2.2.0             BiocParallel_1.26.1  
#>  [85] shape_1.4.6           rlang_0.4.11          pkgconfig_2.0.3      
#>  [88] systemfonts_1.0.2     matrixStats_0.60.0    mzID_1.30.0          
#>  [91] evaluate_0.14         lattice_0.20-44       htmlwidgets_1.5.3    
#>  [94] tidyselect_1.1.1      ggsci_2.9             parallelly_1.27.0    
#>  [97] plyr_1.8.6            R6_2.5.0              IRanges_2.26.0       
#> [100] generics_0.1.0        DBI_1.1.1             withr_2.4.2          
#> [103] haven_2.4.1           pillar_1.6.2          MsCoreUtils_1.4.0    
#> [106] modelr_0.1.8          crayon_1.4.1          utf8_1.2.2           
#> [109] plotly_4.9.4.1        tzdb_0.1.2            rmarkdown_2.9        
#> [112] GetoptLong_1.0.5      grid_4.1.0            readxl_1.3.1         
#> [115] data.table_1.14.0     reprex_2.0.0          digest_0.6.27        
#> [118] gridGraphics_0.5-1    textshaping_0.3.6     stats4_4.1.0         
#> [121] munsell_0.5.0         ggplotify_0.0.8       viridisLite_0.4.0    
#> [124] bslib_0.3.1