Skip to contents

setup_conda_hrrt() creates a conda environment holding NCBI's Human Read Removal Tool (HRRT, the bioconda package sra-human-scrubber), installed from the conda-forge and bioconda channels, for hrrt_local(). It then downloads HRRT's human k-mer database into the environment and runs HRRT's own test.

Usage

setup_conda_hrrt(
  env_name = "hrrt_env",
  yes = FALSE,
  overwrite = FALSE,
  download_db = TRUE
)

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.

download_db

If TRUE (the default), download HRRT's human database into the environment, and run HRRT's test (scrub.sh test).

Value

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

Details

HRRT's core program, aligns_to, is built only for Linux on x86-64 (Intel or AMD) processors. The bioconda package installs on other systems too, but cannot scrub there, so setup_conda_hrrt() and hrrt_local() stop with an error anywhere else (macOS included): run them on a Linux server or cluster.

Before creating anything, setup_conda_hrrt() 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.

Finding conda

conda is often a shell function rather than a program on the PATH, so it may not be visible to R. lims2sra looks for the conda executable, in order, in:

  1. the lims2sra.conda option, e.g. options(lims2sra.conda = "/opt/miniconda3/bin/conda");

  2. the sra2lab.conda option, so that one setting serves both lims2sra and sra2lab;

  3. the Miniconda location ~/miniconda3/bin/conda;

  4. the CONDA_EXE environment variable, set by conda init;

  5. conda on the PATH.

The same applies to document_conda_hrrt() and hrrt_local().

The HRRT database

HRRT identifies human reads with a database of k-mers found in human RefSeq records (and others found in the Eukaryota) but not in any bacterial, archaeal or viral RefSeq record. It is not part of the conda package: with download_db = TRUE, HRRT's init_db.sh downloads the current version from NCBI (about 1 GB), checks its MD5 sum, and saves it in the environment as share/sra-human-scrubber-<version>/data/human_filter.db, where hrrt_local() finds it. To update the database later, run init_db.sh again from that directory:

conda run -n hrrt_env bash -c \
  'cd "$CONDA_PREFIX"/share/sra-human-scrubber-* && init_db.sh'

document_conda_hrrt() reports which database version is installed.

See also

document_conda_hrrt() to export the environment, and hrrt_local() to scrub reads with it.

Examples

if (FALSE) { # \dontrun{
setup_conda_hrrt()
setup_conda_hrrt(yes = TRUE)

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