knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

How to use SwissLipidsR

SwissLipids is one of the major databases for lipids and lipid related projects. It offers an API for querying the database. SwissLipidsR is a package to interact with this API. It is based on jsonlite to interact with the webservice. This vignette explains the basic functions.

library(SwissLipidsR)

Mapping of identifiers

The SwissLipids API offers to map between different lipid related database identifier. Identifier from Swisslipids, LipidMaps, ChEBI or HMDB can be mapped to identifer from SwissLipids, LipidMaps, ChEBI, HMDB, UniProtKB or Rhea. The following example maps from SwissLipid IDs to LipidMaps IDs.

# define mapping parameters
ids <- c("SLM:000048885", "SLM:000000651")
from <- "SwissLipids"
to <- "LipidMaps"

# perform mapping
results <- swissLipidsMapping(from, to, ids)

results

Perform searches

Beside identifier mapping the SwissLipids API offers different searching functionalities. The basic search can be used to get general information on possible entries.

results <- swissLipidsSearch("Phosphatidate (36:2)")

Different advanced search options are available, e.g. searching by name, SMILES, InChIKey, formula or mass. The first example searches all results that match the lipid shorthand notation PC(34:2).

results <- swissLipidsAdvancedSearch(name = "PC(34:2)")

head(results)

The second example performs a sum formula search. This search might return results from different levels of the lipid classification. The additional function filterResults can be used to filter the results based on the classficiation level.

results <- swissLipidsAdvancedSearch(formula = "C39H76NO8P")

head(results)

results <- swissLipidsAdvancedSearch(formula = "C39H76NO8P") %>% 
  filterResults(classification_level = "Species")

head(results)

Also searches on masses can be performed. The search mass can be either a neutral mass ("MassExact") or an adduct mass. Currently supported adducts are [M]+ ("MassM"), [M+H]+ ("MassMH"), [M+K]+ ("MassMK"), [M+Na]+ ("MassMNa"), [M+Li]+ ("MassMLi"), [M+NH4]+ ("MassMNH4"), [M-H]- ("MassMmH"), [M+Cl]- ("MassMCl"), [M+HAc-H]- ("MassMOAc").

results <- swissLipidsAdvancedSearch(mz = 410.243,
                                     adduct = "MassExact",
                                     massErrorRate = 0.001)

head(results)


michaelwitting/SwissLipidsR documentation built on May 8, 2020, 3:38 a.m.