Write Your Own Configuration File

knitr::opts_chunk$set(comment = "#>", collapse = TRUE, screenshot.force = FALSE)

Configuration files in BioInstaller are important. We used these configuration files to stored the software and databases URL, the script of installation, and other useful information.

Most of the configuration files are parsed by configr. Compared with original configr package syntax #R# R CMD #R# is a different point. It can be used to mark those R format command.

github.toml, nongithub.toml and db.toml

Built-in configuration files: github.toml, nongithub.toml and db.toml (db_annovar.toml/db_main.toml, nongithub.toml format) can be used to download and install several software and database. install.bioinfo(show.all.names = TRUE) can be used to get all of avaliable softwares and databases existed in github.toml and nongithub.toml.

Softwares and databases deposited on Github

Variables to control the download and installation steps of software and databases deposited on github:

[bwa]
github_url = "https://github.com/lh3/bwa"
after_failure = "echo 'fail!'"
after_success = "echo 'successful!'"
make_dir = ["./"]
bin_dir = ["./"]

[bwa.before_install]
linux = ""
mac = ""

[bwa.install]
linux = "make"
mac = "make"

Github software version control can be done by git2r package and github tag API. Source URL of software or files deposited in github can be found by github_url in github.toml.

Softwares and databases of non-github

Variables to control the download and installation steps of software and databases not be deposited on github:

[gmap]
# {{version}} will be parsed to your install.bioinfo `version` parameter
# or the newest version parsed from fetched data.
source_url = "http://research-pub.gene.com/gmap/src/{{version}}.tar.gz"
after_failure = "echo 'fail!'"
after_success = "echo 'successful!'"
make_dir = ["./"]
bin_dir = ["./"]

[gmap.before_install]
linux = ""
mac = ""

[gmap.install]
linux = "./configure --prefix=`pwd` && make && make install"
mac = ["sed -i s/\"## CFLAGS='-O3 -m64' .*\"/\"CFLAGS='-O3 -m64'\"/ config.site",
"./configure --prefix=`pwd` && make && make install"]

Version control of non-github software and databases need a function parsing URL and use {{version}} to replace in the source_url.

Besides, BioInstaller uses configr glue to reduce the length of files name. It can help you to use less word to store more files name.

library(configr)
library(BioInstaller)
blast.databases <- system.file('extdata', 
  'config/db/db_blast.toml', package = 'BioInstaller')

read.config(blast.databases)$db_blast_nr$source_url
x <- read.config(blast.databases, glue.parse = TRUE)$db_blast_nr$source_url
length(x)
head(x)
mask.github <- tempfile()
file.create(mask.github)
install.bioinfo(nongithub.cfg = blast.databases, github.cfg = mask.github,
  show.all.names = TRUE)

Reading from BIO_SOFTWARES_DB_ACTIVE database

To resolve some software dependence, BioInstaller using the {{key:value}} format expression, and get its value from BBIO_SOFWARES_DB_ACTIVE database.

For example, htslib is the dependence of Pindel, and we use ./INSTALL {{htslib:source.dir}} as the install step of Pindel. In the session of R, the value of {{htslib:source.dir}} will be replaced by the real value stored in BIO_SOFTWARES_DB_ACTIVE or db in install.bioinfo function.

Parsing from install.bioinfo parameter extra.list

To improve the flexibility of configuration templet, BioInstall using the {{parameters}} format expression to get the function install.bioinfo parameter extra.list. Noteably, the name, version, os.version, destdir were default pass to extra.list.

For example, source_url of GMAP need the version value, and we use source_url = "http://research-pub.gene.com/gmap/src/{{version}}.tar.gz" as the download URL. In the session of R, the {{version}} will be replaced by the version parameter value of install.bioinfo (if the version were NULL, it will be set to be the newest version).

More operation of configuration file

configr was another package to parse the configuration file. More examples can be found in here.



Try the BioInstaller package in your browser

Any scripts or data that you put into this service are public.

BioInstaller documentation built on May 1, 2019, 11:17 p.m.