/ImaGene

Primary LanguageJupyter NotebookGNU General Public License v3.0GPL-3.0

ImaGene

ImaGene implements a supervised machine learning algorithm to predict natural selection and estimate selection coefficients from population genomic data. It can be used to estimate any parameter of interest from an evolutionary model.

ImaGene implements a convolutional neural network (CNN) which takes as input haplotypes of a locus of interest for a population. It outputs confusion matrices as well as point estimates of the selection coefficient (or any parameter of interst) along with its posterior distribution and various metrics of confidence.

Citation

The original manuscript can be found here and it is open access. You should cite it as:

Torada, L., Lorenzon, L., Beddis, A. et al. ImaGene: a convolutional neural network to quantify natural selection from genomic data. BMC Bioinformatics 20, 337 (2019)

doi:10.1186/s12859-019-2927-x

and you can download the citation file in .ris or .json format.

Download and installation

Download the repository using git.

git clone https://github.com/mfumagalli/ImaGene

ImaGene runs under Python3 and it is interfaced with tensorflow and keras. We recommend using conda to set the environment and take care of all dependencies. There are detailed instructions on how to download conda for linux and macOS. For instance, a suitable environment can be created with

conda create -n ImaGene python=3.6 tensorflow=2 keras numpy scipy scikit-image scikit-learn matplotlib pydot pymc3 ipython jupyter

which can be activated with

conda activate ImaGene

and deactivated with

conda deactivate.

ImaGene is currently interfaced with msms but you are required to download it separately following the instructions here. Follow the link, download the .zip folder and extract it. The .jar file of interest will be in the lib folder. There are no requirements for msms to be installed in a specific folder. However, msms requires java to be installed. On unix Debian systems just type sudo apt-get update && apt-get upgrade; sudo apt-get install default-jdk Otherwise follow the link here if you need to install java on other systems. Remember that java must be in your /usr/bin folder. In unix systems you can create a symbolic link with ln -s ~/Downloads/java-XXX/jre/bin/java /usr/bin/java, as an example.

Usage

Please look at the jupyter notebook 01_binary.ipynb for a tutorial on how to use ImaGene for predicting natural selection with a simple binary classification. We also provide examples on how ImaGene can be used for multiclass classification in 02_multiclass.ipynb and 03_multiclass_for_continuous.ipynb.

Finally, we provide an utility generate_dataset.sh to quickly generate simulations with msms to be used for training. This script takes an input file with all parameters needed for the simulations. An example of this file is params.txt and tutorials show how to run such simulations in practice. More information can be found in the tutorials.

The folder Reproduce contains all scripts used for the analyses shown in the manuscript.

Contributors (in alphabetical order)

Alice Beddis, Matteo Fumagalli, Ulas Isildak, Lucrezia Lorenzon, Luis Torada