This is just a tiny tutorial on how to build mosdepth on Mac. There is currently no version for Mac available at conda (hope that changes soon), and from what I've read building from source was a pain so far, still these simple steps worked for me (macOS 10.14.6).
mosdepth is a wickedly fast tool from brentp for depth calculations (e.g. bedGraphs) starting from BAM and CRAM files.
=> Edit: brentp now also provides binaries for macOS, see here and here. Note that these are not static binaries so htslib still needs to be installed, see below. Unpack the linked archive,
chmod +x the binary, get htslib and you should be ready to go. The macOS-one is labelled 10.15 but worked for me on 10.14.6 as well. If you have trouble please add a comment to the GitHub issue.
1. Install the Nim programming language
For this use choosenim via the command:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
The script will instruct you to put the folder that contains the binaries into your
On Mac this is typically done by putting this into your
2. Get htslib
Either compile from source or get it via a package manager such as conda:
conda install -c bioconda htslib
Be sure it is version >= 1.10 since the current hts-nim (which
mosdepth automatically installs and depends on) does not support older versions.
Put the path to the library (
lib) folder that contains
htslib.dylib into your
LD_LIBRARY_PATH, e.g when using miniconda:
3. Install mosdepth
Get the source, extract it and
cd into the folder, then install:
nimble install -y
mosdepth binary should now be available in this folder.
Feel free to comment if problems come up.