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.
Arguments
- env_name
Name of the conda environment to create.
- yes
If
TRUE, pass--yesto conda so it runs without asking for confirmation.- overwrite
If
TRUEandenv_namealready exists, remove it and create it again. IfFALSE(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).
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:
the
lims2sra.condaoption, e.g.options(lims2sra.conda = "/opt/miniconda3/bin/conda");the
sra2lab.condaoption, so that one setting serves both lims2sra and sra2lab;the Miniconda location
~/miniconda3/bin/conda;the
CONDA_EXEenvironment variable, set byconda init;condaon thePATH.
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.