Association testing of bisulfite sequencing methylation data via a Laplace approximation
MALAX (Mixed model Association via Laplace ApproXimation) is a Python package for association testing of bisulfite sequencing methylation data. It models the phenotype as an explanatory variable and each tested site as a reponse variable, using a binomial generalized linear mixed model (GLMM). The likelihood is approximated via a Laplace approximation.
MALAX was published in: Association testing of bisulfite-sequencing methylation data via a Laplace approximation. Bioinformatics 33.14, i325-i332 (2017).
Several parts of the code are loosely based on code translated from the GPML toolbox.
MALAX is designed to work in Python 2.7, and depends on the following freely available Python packages:
- numpy and scipy
- scikit-learn
- cython
Typically, the packages can be installed with the command "pip install --user <package_name>".
MALAX is particularly easy to use with the Anaconda Python distribution. The numerically optimized version of Anaconda can speed MALAX significantly. Alternatively (if numerically optimized Anaconda can't be installed), for very fast performance it is recommended to have an optimized version of Numpy/Scipy installed on your system, using optimized numerical libraries such as OpenBLAS or Intel MKL (see Compilation instructions for scipy with Intel MKL).
Once all the prerequisite packages are installed, MALAX can be installed on a git-enabled machine by typing:
git clone https://github.com/omerwe/MALAX
The project can also be downloaded as a zip file from the Github website.
After downloading the code, please compile the code by going to the MALAX directory and typing:
python setup.py build_ext --inplace
To verify that the compilation succeeded, please verify that the file laplace_cython.so
was created in the directory.
MALAX can be invoked via the script run_laplace.py
.The list of available options can be seen by typing run_laplace.py --help
.
For an example, please run the following command (using the anaconda version of python if available):
python run_laplace.py --mcounts example/y.txt --counts example/r.txt --predictor example/pred.txt --kernel example/K.txt --kernel2 example/cell_types_K.txt --covar example/covars.txt --out example/malax_2K.txt
This will analyze the data in the example
directory using two variance components and will print the results to the file example/malax_2K.txt
.
MALAX takes as input a file with number of reads (r.txt
in the example directory), a file with with number of methylated reads (y.txt
), a file with a predictor (pred.txt
), a file with covariates (covars.txt
), and one or two covariance matrices associated with random effects (K.txt
and cell_types_K.txt
). The corresponding flags can be seen in the example above. The code will print a file with a p-value for every tested site.
Additionally, the code supports a fixed effects beta-binomial model, which can be invoked by adding the flag --test bb
to the example command above. This code will ignore the --kernel
and --kernel2
commands.
The format of the files can be seen in the example directory. It is the same format as used by MACAU.