Available datasets

To see a full list of datasets call the omnipath_show_db function:

`%>%` <- magrittr::`%>%`
library(OmnipathR)
omnipath_show_db()

It returns a tibble where each dataset has a human readable name and a key which can be used to refer to it. We can also check here if the dataset is currently loaded, the time it's been last used, the loader function and its arguments.

Access a dataset

Datasets can be accessed by the get_db function. Ideally you should call this function every time you use the dataset. The first time it will be loaded, the subsequent times the already loaded dataset will be returned. This way each access is registered and extends the expiry time. Let's load the human UniProt-GeneSymbol table. Above we see its key is up_gs.

up_gs <- get_db('up_gs')
up_gs

This dataset is a two columns data frame of SwissProt IDs and Gene Symbols. Looking again at the datasets, we find that this dataset is loaded now and the last_used timestamp is set to the time we called get_db:

omnipath_show_db()

The above table contains also a reference to the dataset, and the arguments passed to the loader function:

d <- omnipath_show_db()
d %>% dplyr::pull(db) %>% magrittr::extract2(16)
d %>% dplyr::pull(latest_param) %>% magrittr::extract2(16)

If we call get_db again, the timestamp is updated, resetting the expiry counter:

# some sleep time to make sure we see a time difference
Sys.sleep(10)
up_gs <- get_db('up_gs')
omnipath_show_db()

Where are the loaded datasets?

The loaded datasets live in an environment which belong to the OmnipathR package. Normally users don't need to access this environment. As we see below, omnipath_show_db presents us all information availble by directly looking at the environment:

OmnipathR:::omnipath.env$db$up_gs

How to extend the expiry period?

The default expiry of datasets is given by the option omnipath.db_lifetime. By calling omnipath_save_config this option is saved to the default config file and will be valid in all subsequent sessions. Otherwise it's valid only in the current session.

options(omnipath.db_lifetime = 600)
omnipath_save_config()

Where are the datasets defined?

The built-in dataset definitions are in a JSON file shipped with the package. Easiest way to see it is by the git web interface.

How to add custom datasets?

Currently no API available for this, but it would be super easy to implement. It would be matter of providing a JSON similar to the above, or calling a function. Please open an issue if you are interested in this feature.

Session information

sessionInfo()


saezlab/OmnipathR documentation built on May 18, 2024, 2:17 a.m.