| Title: | CEU Mass Mediator RESTful API | 
| Version: | 1.0.3 | 
| Depends: | R (≥ 4.4.0) | 
| Imports: | httr, progress, RJSONIO, cli | 
| Description: | CEU (CEU San Pablo University) Mass Mediator is an on-line tool for aiding researchers in performing metabolite annotation. 'cmmr' (CEU Mass Mediator RESTful API) allows for programmatic access in R: batch search, batch advanced search, MS/MS (tandem mass spectrometry) search, etc. For more information about the API Endpoint please go to https://github.com/YaoxiangLi/cmmr. | 
| License: | GPL-3 | 
| Encoding: | UTF-8 | 
| URL: | https://github.com/YaoxiangLi/cmmr | 
| RoxygenNote: | 7.3.2 | 
| Suggests: | testthat | 
| NeedsCompilation: | no | 
| Packaged: | 2024-10-04 17:47:54 UTC; bach | 
| Author: | Yaoxiang Li  | 
| Maintainer: | Yaoxiang Li <liyaoxiang@outlook.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2024-10-04 20:10:34 UTC | 
Advanced Batch Search using CEU Mass Mediator API
Description
advanced_batch_search performs an advanced batch search on the CEU Mass Mediator API
and returns a dataframe of search results.
Usage
advanced_batch_search(
  cmm_url = "https://ceumass.eps.uspceu.es/api/v3/advancedbatch",
  chemical_alphabet = "ALL",
  modifiers_type = "none",
  metabolites_type = "all-except-peptides",
  databases = "[\"HMDB\"]",
  masses_mode = "mz",
  ion_mode = "positive",
  adducts = "[\"all\"]",
  deuterium = FALSE,
  tolerance = 7.5,
  tolerance_mode = "ppm",
  masses = NULL,
  all_masses = "[]",
  retention_times = NULL,
  all_retention_times = "[]",
  composite_spectra = NULL
)
Arguments
cmm_url | 
 A character string specifying the CEU Mass Mediator API endpoint.
Default is   | 
chemical_alphabet | 
 A character string specifying the chemical alphabet to use.
Options are   | 
modifiers_type | 
 A character string specifying the modifier type.
Options are   | 
metabolites_type | 
 A character string specifying the metabolites type.
Options are   | 
databases | 
 A JSON-formatted character string specifying the databases to search.
Examples include   | 
masses_mode | 
 A character string specifying the masses mode. Options are   | 
ion_mode | 
 A character string specifying the ionization mode. Options are   | 
adducts | 
 A JSON-formatted character string specifying the adducts to include in the search.
Examples include   | 
deuterium | 
 A logical value indicating whether to consider deuterium substitutions.   | 
tolerance | 
 A numeric value specifying the mass tolerance (Range:   | 
tolerance_mode | 
 A character string specifying the tolerance mode. Options are   | 
masses | 
 A numeric vector of masses to search.  | 
all_masses | 
 A JSON-formatted character string representing an array of mass arrays.  | 
retention_times | 
 A numeric vector of retention times corresponding to the masses.  | 
all_retention_times | 
 A JSON-formatted character string representing an array of retention time arrays.  | 
composite_spectra | 
 A JSON-formatted character string representing composite spectra.  | 
Value
A dataframe containing the search results from the CEU Mass Mediator API.
Examples
## Not run: 
df <- advanced_batch_search(
  cmm_url = "https://ceumass.eps.uspceu.es/api/v3/advancedbatch",
  chemical_alphabet = "ALL",
  modifiers_type = "none",
  metabolites_type = "all-except-peptides",
  databases = '["HMDB"]',
  masses_mode = "mz",
  ion_mode = "positive",
  adducts = '["all"]',
  deuterium = FALSE,
  tolerance = 7.5,
  tolerance_mode = "ppm",
  masses = c(400.3432, 288.2174),
  all_masses = "[]",
  retention_times = c(18.842525, 4.021555),
  all_retention_times = "[]",
  composite_spectra = paste0(
    '[ [ { "mz": 400.3, "intensity": 307034.9 },',
    '   { "mz": 311.2, "intensity": 400.1 } ] ]'
  )
)
## End(Not run)
Encapsulation of CEU Mass Mediator batch search API
Description
batch_search returns a dataframe with the results from the database search.
Usage
batch_search(
  cmm_url = "https://ceumass.eps.uspceu.es/api/v3/batch",
  metabolites_type = "all-except-peptides",
  databases = "[\"all-except-mine\"]",
  masses_mode = "mz",
  ion_mode = "positive",
  adducts = "[\"M+H\",\"M+Na\"]",
  tolerance = 10,
  tolerance_mode = "ppm",
  unique_mz
)
Arguments
cmm_url | 
 A URL string for the CEU Mass Mediator or a local API endpoint.  | 
metabolites_type | 
 Search metabolites type: "all-except-peptides", "only-lipids", or "all-including-peptides".  | 
databases | 
 A JSON array of databases to search: e.g., "all", "HMDB", "LipidMaps", etc.  | 
masses_mode | 
 Masses mode: "neutral" or "mz".  | 
ion_mode | 
 Ionization mode: "positive" or "negative".  | 
adducts | 
 A JSON array of adducts to include in the search, e.g., '["M+H", "M+Na"]'.  | 
tolerance | 
 A numeric tolerance value (range: 0-100).  | 
tolerance_mode | 
 Tolerance mode: "ppm" or "mDa".  | 
unique_mz | 
 A numeric vector of unique m/z values for the search.  | 
Value
A dataframe containing search results.
Examples
## Not run: 
df_pos <- batch_search(
  "https://ceumass.eps.uspceu.es/api/v3/batch",
  "all-except-peptides",
  '["all-except-mine"]',
  "mz",
  "positive",
  '["M+H","M+Na"]',
  10,
  "ppm",
  c(670.4623, 1125.2555, 602.6180)
)
## End(Not run)
Create POST request Body for batch search
Description
create_advanced_batch_body returns a string of advanced search POST request body.
Usage
create_advanced_batch_body(
  chemical_alphabet = "all",
  modifiers_type = "none",
  metabolites_type = "all-except-peptides",
  databases = "[\"hmdb\"]",
  masses_mode = "mz",
  ion_mode = "positive",
  adducts = "[\"all\"]",
  deuterium = "false",
  tolerance = "7.5",
  tolerance_mode = "ppm",
  masses = "[400.3432, 288.2174]",
  all_masses = "[]",
  retention_times = "[18.842525, 4.021555]",
  all_retention_times = "[]",
  composite_spectra = paste0("[[{ \"mz\": 400.3432, \"intensity\": 307034.88 }, ",
    "{ \"mz\": 311.20145, \"intensity\": 400.03336 }]]")
)
Arguments
chemical_alphabet | 
 "CHNOPS", "CHNOPSCL", "ALL"  | 
modifiers_type | 
 "none", "NH3", "HCOO", "CH3COO", "HCOONH3", "CH3COONH3"  | 
metabolites_type | 
 "all-except-peptides", "only-lipids", "all-including-peptides"  | 
databases | 
 "all", "all-except-mine", "HMDB", "LipidMaps", "Metlin", "Kegg", "in-house", "mine"  | 
masses_mode | 
 "neutral", "mz"  | 
ion_mode | 
 "positive", "negative"  | 
adducts | 
 for positive mode ["M+H", "M+2H", "M+Na", "M+K", "M+NH4", "M+H-H2O"] for negative mode ["M-H", "M+Cl", "M+FA-H", "M-H-H2O"], for neutral ["M"]  | 
deuterium | 
 boolean 'true' 'false'  | 
tolerance | 
 double (Range: [0..100])  | 
tolerance_mode | 
 "ppm", "mDa"  | 
masses | 
 double  | 
all_masses | 
 array of doubles  | 
retention_times | 
 double  | 
all_retention_times | 
 array of doubles  | 
composite_spectra | 
 array of arrays of spectra_object  | 
Value
If all inputs are all correctly formatted, a dataframe will be returned for the result.
Create POST request Body for batch search
Description
create_batch_body returns a string of a POST request body.
Usage
create_batch_body(
  metabolites_type = "all-except-peptides",
  databases = "[\"all-except-mine\"]",
  masses_mode = "mz",
  ion_mode = "positive",
  adducts = "[\"M+H\",\"M+Na\"]",
  tolerance = 10,
  tolerance_mode = "ppm",
  unique_mz
)
Arguments
metabolites_type | 
 "all-except-peptides", "only-lipids", "all-including-peptides"  | 
databases | 
 "all", "all-except-mine", "HMDB", "LipidMaps", "Metlin", "Kegg", "in-house", "mine"  | 
masses_mode | 
 "neutral", "mz"  | 
ion_mode | 
 "positive", "negative"  | 
adducts | 
 for positive mode [M+H, M+2H, M+Na, M+K,M+NH4, M+H-H2O]  | 
tolerance | 
 double (Range: [0..100])  | 
tolerance_mode | 
 "ppm", "mDa"  | 
unique_mz | 
 An array of unique m/zs  | 
Value
If all inputs are all correctly formatted, a string of a POST request will be returned for the result.
Examples
batch_body <- create_batch_body(
  "all-except-peptides",
  '["all-except-mine"]',
  "mz",
  "positive",
  '["M+H","M+Na"]',
  10,
  "ppm",
  c(670.4623, 1125.2555, 602.6180)
)
batch_body <- create_batch_body(
  "all-except-peptides",
  '["all-except-mine"]',
  "mz",
  "negative",
  '["M-H","M+Cl"]',
  10,
  "ppm",
  c(670.4623, 1125.2555, 602.6180)
)
## Not run: 
create_batch_body(c(670.4623, 1125.2555, 602.6180))
## End(Not run)
Create MS/MS search POST request body
Description
create_msms_body returns a string of a POST request body.
Usage
create_msms_body(
  ion_mass,
  ms_ms_peaks,
  precursor_ion_tolerance = 500,
  precursor_ion_tolerance_mode = "mDa",
  precursor_mz_tolerance = 1000,
  precursor_mz_tolerance_mode = "mDa",
  ion_mode = "positive",
  ionization_voltage = "all",
  spectra_types = "experimental"
)
Arguments
ion_mass | 
 ion_mass  | 
ms_ms_peaks | 
 ms_ms_peaks  | 
precursor_ion_tolerance | 
 precursor_ion_tolerance  | 
precursor_ion_tolerance_mode | 
 precursor_ion_tolerance_mode  | 
precursor_mz_tolerance | 
 precursor_mz_tolerance  | 
precursor_mz_tolerance_mode | 
 precursor_mz_tolerance_mode  | 
ion_mode | 
 ion_mode  | 
ionization_voltage | 
 ionization_voltage  | 
spectra_types | 
 spectra_types  | 
Value
If all inputs are all correctly formatted, a string of a POST request will be returned for the result.
MS/MS Search using CEU Mass Mediator API
Description
msms_search performs an MS/MS search on the CEU Mass Mediator API
and returns a dataframe with the search results.
Usage
msms_search(
  ion_mass,
  ms_ms_peaks,
  precursor_ion_tolerance = 100,
  precursor_ion_tolerance_mode = "mDa",
  precursor_mz_tolerance = 500,
  precursor_mz_tolerance_mode = "mDa",
  ion_mode,
  ionization_voltage = "all",
  spectra_types = "experimental",
  cmm_url = "https://ceumass.eps.uspceu.es/api/msmssearch"
)
Arguments
ion_mass | 
 Numeric. Mass of the ion to search for.  | 
ms_ms_peaks | 
 Matrix. The MS/MS peaks, with two columns representing mass and intensity.  | 
precursor_ion_tolerance | 
 Numeric. Tolerance for the precursor ion (default: 100.0).  | 
precursor_ion_tolerance_mode | 
 Character. Tolerance mode for precursor ion:   | 
precursor_mz_tolerance | 
 Numeric. Tolerance for the m/z (default: 500.0).  | 
precursor_mz_tolerance_mode | 
 Character. Tolerance mode for precursor m/z:   | 
ion_mode | 
 Character. Ionization mode:   | 
ionization_voltage | 
 Character. Ionization voltage to use (default: "all").  | 
spectra_types | 
 Character. Spectra types:   | 
cmm_url | 
 Character. URL for the CEU Mass Mediator API (default: "https://ceumass.eps.uspceu.es/api/msmssearch").  | 
Value
A dataframe containing the search results from the CEU Mass Mediator API.
Examples
## Not run: 
ms_ms_peaks <- matrix(
  c(
    40.948, 0.174,
    56.022, 0.424,
    84.370, 53.488,
    101.500, 8.285,
    102.401, 0.775,
    129.670, 100.000,
    146.966, 20.070
  ),
  ncol = 2,
  byrow = TRUE
)
df <- msms_search(
  ion_mass = 147,
  ms_ms_peaks = ms_ms_peaks,
  ion_mode = "positive"
)
## End(Not run)