Skip to contents

iscream currently has Rhtslib as a “LinkingTo” dependency so if a system installation of htslib is not found with pkg-config, the installer will fall back to using Rhtslib as the htslib header source. However, we recommend getting a more up-to-date htslib from another source. You or your system administrator can install htslib with the system package manager which usually sets PKG_CONFIG_PATH automatically. On MacOS you can get htslib with the Homebrew package manager. On HPC systems, htslib may be provided as a module. Make sure these methods also set the PKG_CONFIG_PATH.

If you aren’t able to install htslib development libraries system-wide for lack of admin permissions, you can install them from other channels. We recommend pixi or conda since their htslib is compiled with libdeflate support and is faster than htslib without libdeflate. If you’re compiling your own htslib, compile libdeflate first and then htslib. With Rhtslib we’ve seen poorer performance compared to a standard htslib installation, both with and without libdeflate.

To see what htslib version iscream is using and whether it has libdeflate, run

library(iscream)
htslib_version()
#> 1.21
#> build=configure libcurl=yes S3=yes GCS=yes libdeflate=yes lzma=yes bzip2=yes plugins=no htscodecs=1.6.1

and check that libdeflate=yes.

Effect of htslib v1.18 source on iscream matrix creation runtime from one bulk WGBS BED file

Effect of htslib v1.18 source on iscream matrix creation runtime from one bulk WGBS BED file

Conda/miniconda/mamba/micromamba

Create an environment.yaml with the following contents to install htslib 1.21:

name: iscream
channels:
  - bioconda
  - conda-forge
dependencies:
  - htslib=1.21
  - pkg-config=0.29.2

Add this file to your project directory and run

conda env create -f environment.yaml
conda activate iscream
export PKG_CONFIG_PATH=$CONDA_PREFIX/lib
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib/

Confirm that the headers are available for compilation

pkg-config --cflags --libs htslib

You should get something like

-I/home/user/miniconda3/envs/iscream/include -L/home/user/miniconda3/envs/iscream/lib -lhts

Pixi

Pixi uses the conda repositories to install packages. Create a pixi.toml file with this content and add the file to your project directory:

[project]
channels = ["conda-forge", "bioconda"]
name = "iscream"
platforms = ["linux-64"]
version = "0.1.0"

[activation.env]
LD_LIBRARY_PATH="$CONDA_PREFIX/lib"

[dependencies]
htslib = "1.21.*"
pkg-config = ">=0.29.2,<0.30"

To create an environment with the required system dependencies run

pixi shell

Confirm that the headers are available for compilation

pkg-config --cflags --libs htslib

You should get something like

-I/home/user/iscream/.pixi/envs/default/include -L/home/user/iscream/.pixi/envs/default/lib -lhts