I recently published AdmixPy on GitHub, a fast implementation of f-statistics, qpAdm, and qpWave in Python that runs on Linux, macOS, and Windows. It works directly on the new AADR TGENO distribution format and is notably faster than ADMIXTOOLS 2 and simpler to set up. Supported input formats: EIGENSTRAT (.geno/.snp/.ind), packed AncestryMap (.geno/.snp/.ind), TGENO (.tgeno/.snp/.ind), and SNP-major PLINK binary (.bed/.bim/.fam).

AdmixPy is implemented in Python and depends only on NumPy, SciPy, and pandas. Installation is handled through pip, and it should behave the same on every platform.


Setup

AdmixPy requires Python 3.10 or newer and runs on Linux, macOS, and Windows.

It is recommended to install AdmixPy in a virtual environment. Create one in your working directory:

python3 -m venv venv
source venv/bin/activate

Then install or upgrade to the latest release from PyPI:

python -m pip install --upgrade admixpy

Verify the installation:

python -c "import admixpy; print(admixpy.__version__)"

Alternative: Installing from source

Clone the repository and enter it:

git clone https://github.com/system0x7/admixpy.git
cd admixpy

Create and activate a virtual environment:

python3 -m venv venv
source venv/bin/activate

On Windows, activate with venv\Scripts\activate instead.

Install the package:

python -m pip install --upgrade pip
python -m pip install -e .

Verify the install:

python -c "import admixpy; print(admixpy.__file__)"

You should see a path ending in admixpy/__init__.py. If you get an ImportError, double-check that the virtual environment is activated.


Usage

The main functions are:

admixpy.f2(data, pop1, pop2)
admixpy.fst(data, pop1, pop2) 
admixpy.f3(data, pop1, pop2, pop3)
admixpy.f4(data, pop1, pop2, pop3, pop4)
admixpy.qpwave(data, left, right)
admixpy.qpadm(data, target, left, right)

data can be a genotype dataset prefix or precomputed f2 data. For PLINK input, population labels are read from the FID column of the .fam file.

Start a Python REPL (after activating the venv) in the directory containing your AADR files and run an f4 statistic:

>>> import admixpy as a
>>> prefix = "v66_compatibility"
>>> a.f4(prefix, "Chimp", "Turkey_N", "Sardinian", "French")

Result:

    pop1      pop2       pop3    pop4          est           se       z         p       n
0  Chimp  Turkey_N  Sardinian  French  -0.00138048  9.23816e-05  -14.94  1.72e-50  682551

The significantly negative (Z=14.94Z=-14.94) estimate with AA as outgroup indicates that Anatolian Neolithic farmers share more drift with Sardinians than with French, reflecting the stronger Neolithic Farmer affinity in Sardinia. Follow-up posts will work through f-statistics, qpAdm and qpWave models on AADR data using AdmixPy.