Skip to contents

Each `setup_conda_*()` function creates a conda environment holding one tool, installed from the conda-forge and bioconda channels:

`setup_conda_sra()`

[SRA Toolkit](https://github.com/ncbi/sra-tools) (`sra-tools`) and [EDirect](https://www.ncbi.nlm.nih.gov/books/NBK179288/) (`entrez-direct`, which provides `esearch` and `efetch` for [get_bioproject_runs()]), and [pigz](https://zlib.net/pigz/), which compresses the downloaded reads on several threads, in `sra_env`. To add pigz to an `sra_env` made by an earlier version of sra2lab, run `conda install -n sra_env -c conda-forge pigz` in a terminal; without it, the reads are compressed (more slowly) with `gzip`.

`setup_conda_sylph()`

[sylph](https://github.com/bluenote-1577/sylph), in `sylph_env`, for [sylph_runs()].

`setup_conda_sourmash()`

[sourmash](https://github.com/sourmash-bio/sourmash), in `smash_env`, for [smash_runs()].

`setup_conda_funprofiler()`

[fmh-funprofiler](https://github.com/KoslickiLab/fmh-funprofiler), in `funprofiler_env`, for [funprofiler_runs()]. Its dependencies (pandas, numpy, sourmash and biom-format, per the project's `environment.yml`) come from conda; funprofiler itself is then installed into the environment with `pip` from GitHub.

`setup_conda_rgi()`

[RGI](https://github.com/arpcard/rgi), the Resistance Gene Identifier for the Comprehensive Antibiotic Resistance Database (CARD), in `rgi_env`. `rgi` brings its own tools (BLAST, DIAMOND, Prodigal, Bowtie2, BWA, KMA, SAMtools and others). The Jellyfish k-mer counter, which `rgi kmer_build` uses, is added as the bioconda package `kmer-jellyfish`, because conda would otherwise install an unrelated Python package that shares the name `jellyfish`. RGI needs CARD's reference data loaded before it can analyse anything; see "Loading CARD reference data" below.

Usage

setup_conda_sra(env_name = "sra_env", yes = FALSE, overwrite = FALSE)

setup_conda_sylph(env_name = "sylph_env", yes = FALSE, overwrite = FALSE)

setup_conda_sourmash(env_name = "smash_env", yes = FALSE, overwrite = FALSE)

setup_conda_funprofiler(
  env_name = "funprofiler_env",
  yes = FALSE,
  overwrite = FALSE
)

setup_conda_rgi(env_name = "rgi_env", yes = FALSE, overwrite = FALSE)

Arguments

env_name

Name of the conda environment to create.

yes

If `TRUE`, pass `–yes` to conda so it runs without asking for confirmation.

overwrite

If `TRUE` and `env_name` already exists, remove it and create it again. If `FALSE` (the default), an existing environment raises an error.

Value

The exit status of the last conda command, invisibly (`0` on success).

Details

The conda executable is found by [conda_bin()].

Before creating anything, each function checks (with `conda env list`) whether an environment named `env_name` already exists. If it does, the function stops with an error and leaves that environment untouched, unless `overwrite = TRUE`, in which case the existing environment is removed (`conda env remove`) and created again.

Loading CARD reference data

`setup_conda_rgi()` installs RGI but not CARD's reference data, which RGI must load before analysis. Download the latest data from CARD and load it into the working directory (`–local`), as described in RGI's [loading documentation](https://github.com/arpcard/rgi/blob/master/docs/rgi_load.rst):

wget https://card.mcmaster.ca/latest/data
tar -xvf data ./card.json
conda run -n rgi_env rgi load --card_json card.json --local

Different analyses (e.g. `rgi bwt` for metagenomic reads, or k-mer prediction of pathogen of origin) need further CARD and WildCARD data; see RGI's documentation.

See also

[document_conda_sra()] to export an environment created here.

Examples

if (FALSE) { # \dontrun{
setup_conda_sra()
setup_conda_sylph(yes = TRUE)
setup_conda_rgi(yes = TRUE)

# rebuild an environment that already exists
setup_conda_sra(overwrite = TRUE)
} # }