Getting Started
Install AlphaImpute2
Here is a sample guide for installing AlphaImpute2 as a Python package.
For more information on installing Python packages, visit Python Packaging User Guide.
Install via pip
AlphaImpute2 is available on PyPI
hence you can install it simply by running the following command in a terminal:
pip install AlphaImpute2
Install from the git repository
You can also install AlphaImpute2 from the code in git repository.
Clone the repository:
git clone --recurse-submodules https://github.com/AlphaGenes/AlphaImpute2.git
Change the working directory to the one holding the repository:
cd AlphaImpute2
Create a virtual environment:
python -m venv AlphaImpute2_env
Activate the environment:
If you are using macOS/Linux:
source AlphaImpute2_env/bin/activateIf you are using Windows:
AlphaImpute2-env\Scripts\activate
Upgrade pip:
python -m pip install --upgrade pip
Upgrade the build:
python -m pip install --upgrade build
Build the distributions:
Note
If you are building on a branch other than the main branch, you may need to first check if the submodule reference is correct before the build.
python -m build
Install the package by using the built wheel distribution:
python -m pip install dist/alphaimpute2*.whl
Run examples
Change the working directory to the one holding the example:
cd example
Run the example:
bash run_examples.sh
If you have installed R, you can check the accuracy of the example code:
Rscript check_accuracy.R
Deactivate the environment:
deactivate
Install on Eddie
Note
This section is only for the users from the University of Edinburgh.
To use AlphaImpute2 on the Eddie, the University of Edinburgh’s Research Compute Cluster,
you can find information to create an environment without causing the home directory to go over quota at
Eddie wiki page.
If you encountered the issue that the files show as modified directly after a git clone, you may can try:
git config core.fileMode false
An example
The following is a very simple example to demonstrate
the principle of estimating unknown haplotypes and genotypes.
The example is deliberately simplistic for the demonstration.
Note that AlphaImpute2 can handle much more complex examples.
The example contains two parents with known genotypes and
one progeny with unknown genotypes.
Our task is to estimate the haplotypes of all the individuals (we name this task “phasing”) and
genotypes of the progeny (we name this task “imputation”).
Since the two parents are fully homozygous and the progeny has no information,
you can easily solve this problem yourself and check your solution with AlphaImpute2.
We first prepare a genotype input file:
A 2 2 0 0 0
B 0 0 2 2 2
C 9 9 9 9 9
And a pedigree file:
A 0 0
B 0 0
C A B
We named the two file as simple_genotype.txt and simple_pedigree.txt.
You can create the files yourself.
They are also available in the example/simple_example/ directory of the repository.
To use these files you have to change the working directory to the one holding the simple example:
cd simple_example
We perform the phasing and imputation with the following command:
AlphaImpute2 \
-genotypes simple_genotype.txt \
-pedigree simple_pedigree.txt \
-ped_only \
-out simple_output
Above we provided the two input files, asked for the pedigree-only method, and
requested the output filenames starting with simple_output.
If the run was successful, you should see the following output:
------------------------------------------
AlphaImpute2
------------------------------------------
Version: 0.0.3
Email: alphagenes@roslin.ed.ac.uk
Website: http://alphagenes.roslin.ed.ac.uk
------------------------------------------
Reading in AlphaGenes format: simple_genotype.txt
Read in: 0.00 seconds
Pedigree Imputation Only
------------------------------------------
Number of peeling cycles: 4
Final cutoff: 0.1
Imputation cycle 1
Peel down: 3.57 seconds
Peel up: 2.40 seconds
Imputation cycle 2
Peel down: 0.00 seconds
Peel up: 0.00 seconds
Imputation cycle 3
Peel down: 0.00 seconds
Peel up: 0.00 seconds
Imputation cycle 4
Peel down: 0.00 seconds
Peel up: 0.00 seconds
Core peeling cycles: 5.97 seconds
Heuristic Peeling: 7.03 seconds
Writing Out Results
------------------------------------------
Write out: 0.00 seconds
Full Program Run: 7.18 seconds
And the following output file:
simple_output.genotypes
The simple_output.genotypes provides the called genotypes:
A 2 2 0 0 0
B 0 0 2 2 2
C 1 1 1 1 1
For more information about how to use AlphaImpute2, please see Usage.