MKtest.jl

MKtest.jl is a Julia package including a fast Approximate Bayesian Computation version of the McDonald-Kreitman test (ABC-MK) presented in Uricchio et al. (2019). The new ABC-MK implementation significantly improves the efficiency of the population genetics inferences. Following Uricchio et al.(2019), the analytical estimations were used to explore the effect of background selection and selective interference on weakly beneficial alleles. Nonetheless, we developed a more straightforward and computationally efficient ABC-based inference procedure that accounts for the DFE of deleterious and beneficial alleles and partial recombination between selected genomic elements. Our approach estimates $\alpha$, $\alpha_W$, $\alpha_S$, and the Gamma distribution DFE parameters.

In addition, the package automatizes other MK-like analyses parsing polymorphic and divergence data as well as including several extensions such as Grapes, aMK, imputedMK or fwwMK.

Scratch installation

To install our module from scratch, we highly recommend using LTS official Julia binaries. Once you have installed Julia in your system, consider to install some important dependencies to automatize your pipelines. We have prepared a file to install them.

curl -o julia_dependencies.jl https://raw.githubusercontent.com/jmurga/MKtest.jl/master/scripts/julia_dependencies.jl
julia julia_dependencies.jl

You can easily install our Julia package manually executing

julia -e 'using Pkg;Pkg.add(PackageSpec(path="https://github.com/jmurga/MKtest.jl"))'

Or from Pkg REPL (by pressing ] at Julia interpreter):

add https://github.com/jmurga/MKtest.jl

To parallelize your estimation please remember to use -t/--threads option when starting Julia. Set -t/threads to auto to set the threads to the number of CPU threads.You also can export the environment variable JULIA_NUM_THREADS into your .bashrc to avoid thread indication when starting Julia.

julia -t 8
# or
julia -t auto
# or
printf "\nexport JULIA_NUM_THREADS=8\n" >> ~/.bashrc && source ~/.bashrc

To check the number of avaibles threads you can run the command Threads.nthreads() into your Julia session

Julia still have some latency problem loading packages. Please consider to create a custom sysimages for reduced latency.

curl -o mktest/julia_dependencies.jl https://raw.githubusercontent.com/jmurga/MKtest.jl/master/scripts/precompile_mktest.jl 
julia -e 'using PackageCompiler;PackageCompiler.create_sysimage(:MKtest, sysimage_path="/mktest/mktest.so", precompile_execution_file="mktest/precompile_mktest.jl")'

You can run the sysimage using -J option when starting Julia

julia -t8 -J mktest/mktest.so

ABCreg

We have linked ABCreg with Julia to perform ABC inference. Nonetheless others ABC softwares could be used (like abc (R package) or ABCToolBox). If you are going to use ABCreg to directly make inference from our software please cite the publication

Docker installation

The Docker image is based on Debian and includes all the software needed to run the pipeline. You can access Julia or Jupyter pulling the image from Docker Hub or build yourself using the Dockerfile on github.

By default the Docker image will use any available CPU thread in your machine. Please, remember to use julia -t to use multiple threads and parallelize the estimation. To save the results, you can link the folder /mktest with any folder in your ${HOME} directory.

MYPATH="/home/jmurga/temporal_mktest/"
# Pull the image
docker pull jmurga/mktest

# Runninh temporal docker container linking some local volume to export data. Consider to create a container.
docker run -it -v --rm ${MYPATH}:/mktest/folder jmurga/mktest abcmk_cli.jl
# Using -t 8 to parallelize using 8 threads
# Using -J mktest.so to avoid loading package latency
docker run -it -v --rm ${MYPATH}:/mktest/folder jmurga/mktest julia -J mktest.so -t8 abcmk_cli.jl

# Run jupyter notebook from docker image. Change the port if 8888 is already used
docker run -it --rm -v ${MYPATH}:/mktest/folder -p 8888:8888 jmurga/mktest /bin/bash -c "jupyter-lab --ip='*' --port=8888 --no-browser --allow-root"

To use our command-line interface, just run

docker run --rm -it -v ${MYPATH}:/mktest/ jmurga/mktest

Singularity installation

The Docker image is based on Debian and includes all the software needed to run the pipeline. You can access Julia pulling the image from Sylabs Cloud Library.

singularity pull mktest.sif library://jmurga/default/mktest

singularity run mktest.sif julia ulia -J mktest.so -t8 abcmk_cli.jl