Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Configuring biodb

Pierrick Roger edited this page Mar 6, 2018 · 3 revisions

This page has been generated automatically from a package vignette. Please do not edit, since your modifications will later be removed.

Introduction

In this vignette, we will explain how to configure biodb behaviour.

When you create an instance of the Biodb class:

mybiodb <- biodb::Biodb()

You get, by default (i.e.: when not setting info = FALSE), a list of configuration setting.

This configuration setting can be modified either directly inside R with the BiodbConfig class or beforehand by setting environment variables.

BiodbConfig instance

The main way to tune biodb to your needs is to use the BiodbConfig single instance, accessible through the biodb instance:

config <- mybiodb$getConfig()

If you look at the config instance, you will get a list of keys with their current values:

config

Keys information and value

Get all available configuration keys:

config$getKeys()

Get description of a field:

config$getDescription('cache.directory')

Get a field value:

config$get('cache.directory')

If the field is boolean, you can use the following method instead:

if (config$isEnabled('offline')) 'Biodb is running offline.' else 'Biodb is running online.'

To get a complete of all configuration keys and their description, call:

config$listKeys()

Setting a value

Set a field value:

config$set('cache.directory', '~/my.biodb.cache')
config$get('cache.directory') # See modifications

If the field is boolean, you can use the following methods instead:

config$enable('offline')    # set to TRUE
config$disable('offline')   # set to FALSE

Default values

Get field default value:

config$getDefaultValue('cache.directory')

Environment variables

Environment variables can be used to overwrite default values.

To get the name of the environment variable associated with a particular key, call the following method:

config$getAssocEnvVar('cache.directory')