Tutorial:Building mosdepth on macOS
0
4
Entering edit mode
12 months ago
ATpoint 49k

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, edit (3/2021): it did change, see https://anaconda.org/bioconda/mosdepth), 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 PATH. On Mac this is typically done by putting this into your ~/.bash_profile:

export PATH=$HOME/.nimble/bin:$PATH


2. Get htslib

Either compile from source or get it via a package manager such as conda:

For conda it is simply:

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:

export LD_LIBRARY_PATH=$HOME/miniconda3/lib  For source compilation get the source from the Github release, then cd into the folder and type make, then (while being in the htslib folder) type export LD_LIBRARY_PATH=$HOME/\$(pwd)


3. Install mosdepth

Get the source, extract it into a folder of choice and cd into the folder, then install:

nimble install -y


A mosdepth binary should now be available in this folder. Feel free to comment if problems come up.

mosdepth nim Tutorial • 602 views