Skip to main content

ADAMIXTURE logo

Fast Biobank-Scale Population Genetics Clustering

Python Version PyPI Version License Status Downloads


ADAMIXTURE is a fast CPU/GPU implementation of ADMIXTURE for biobank-scale genetic clustering. .P and .Q outputs remain compatible with ADMIXTURE.

System requirements

Hardware & Platform compatibility

ADAMIXTURE runs cross-platform on Linux, macOS, and Windows, supporting CPU computation as well as GPU acceleration on NVIDIA GPUs (CUDA) and Apple Silicon (MPS).

Software requirements

We recommend creating a fresh Python 3.10+ virtual environment. For a faster installation experience, we highly recommend using uv.

[!IMPORTANT]
If you plan to use GPU acceleration, ensure that the CUDA toolkit is correctly loaded (e.g., module load cuda) before starting the installation. This ensures that the dependencies and internal components are correctly configured for your hardware.

As an example, using uv (recommended):

$ uv venv --python 3.10
$ source .venv/bin/activate
$ uv pip install adamixture

Installation Guide

The package can be easily installed in at most a few minutes using pip (make sure to add the --upgrade flag if updating the version):

$ pip install adamixture

Running ADAMIXTURE

To train a model, simply invoke the following commands from the root directory of the project. For more info about all the arguments, please run adamixture --help. Note that BED, VCF, PGEN and BCF are supported.

Supported input files include:

  • PLINK BED: .bed, .bed.gz, .bed.zst, with .bim/.fam sidecars that may also be plain, .gz or .zst.
  • PLINK PGEN: .pgen or .pgen.zst, with .pvar/.psam sidecars that may be plain, .gz or .zst.
  • VCF: .vcf, .vcf.gz and .vcf.zst.
  • BCF: .bcf, .bcf.gz and .bcf.zst.

As an example, the following ADMIXTURE call

$ ./admixture snps_data.bed 8 -s 42

would be equivalent in ADAMIXTURE by running

$ adamixture -k 8 --data_path snps_data.bed --save_dir SAVE_PATH --name snps_data -s 42

By default, the following files will be output to the SAVE_PATH directory (the name parameter will be used to create the full filenames):

  • A .P file, similar to ADMIXTURE.
  • A .Q file, similar to ADMIXTURE.
  • A .png plot file containing the visualization of the inferred ancestry proportions (Q matrix).

Logs are printed to the stdout channel by default. If you want to save them to a file, you can use the command tee along with a pipe:

$ adamixture -k 8 ... | tee run.log

Running with multi-threading

To run ADAMIXTURE using multiple CPU threads, use the -t flag:

$ adamixture -k 8 --data_path data.bed --save_dir out/ --name test -t 8

Running with GPU acceleration

To leverage GPU acceleration (highly recommended for large datasets), use the --device flag:

  • NVIDIA GPU (CUDA):
    $ adamixture -k 8 --data_path data.bed --save_dir out/ --name test --device gpu
    
  • macOS Apple Silicon (MPS):
    $ adamixture -k 8 --data_path data.bed --save_dir out/ --name test --device mps
    

[!TIP] GPU Acceleration: Using GPUs greatly speeds up processing and is highly recommended for large datasets. You can specify the hardware to use with the --device parameter:

  • For NVIDIA GPUs, use --device gpu (requires CUDA).
  • For macOS users with Apple Silicon (M1/M2/M3/M4/M5), use --device mps to enable Metal Performance Shaders (MPS) acceleration.
  • Note that biobank-scale datasets are best handled on dedicated CUDA-capable GPUs due to high RAM requirements.

For a step-by-step guide on how to run a complete analysis workflow, see the 1000 Genomes Tutorial.

Multi-K Sweep

Instead of running ADAMIXTURE for a single K, you can automatically sweep over a range of K values using --min_k and --max_k. The data is loaded once, and each K is trained sequentially:

$ adamixture --min_k 2 --max_k 10 --data_path snps_data.bed --save_dir SAVE_PATH --name snps_sweep

Cross-validation

Use --cv to estimate the optimal K by masking a fraction of genotype entries and measuring prediction error. → Full documentation

$ adamixture -k 8 --cv --data_path data.bed --save_dir out/ --name test

Plotting

By default, ADAMIXTURE automatically generates a png plot at 300 DPI without needing any additional flags. Following the method of Clumppling, it automatically aligns clusters across runs and K values. → Full documentation

Plots can include hierarchical population labels if you provide the arguments (--labels, --labels2, --labels3).

If you want to customize the format and resolution (e.g., to generate a PDF), use --plot (or --plot_single for individual per-K plots in multi-K sweeps):

  • Single K runs (-k): Use --plot.

    $ adamixture -k 8 --data_path data.bed --save_dir out/ --name test --plot pdf 300
    
  • Multi-K sweeps (--min_k and --max_k): Use --plot to configure the combined sweep plot (or --plot_single for individual plots per K).

    $ adamixture --min_k 2 --max_k 10 --data_path data.bed --save_dir out/ --name test --plot pdf 300
    

Projection Mode

Estimate ancestry proportions for new samples using a pre-trained, fixed P matrix (Q-only optimisation). K is detected automatically from P. → Full documentation

$ adamixture-project \
    --data_path new_samples.bed \
    --p_path trained_model/results.8.P \
    --save_dir projection_out/ \
    --name projected

Supervised Mode

Anchor the model with known population labels for a subset of samples while estimating Q freely for unlabeled ones. Labels use the same format as --labels (population name or -). → Full documentation

$ adamixture-supervised \
    --data_path all_samples.bed \
    --labels labels.txt \
    --save_dir supervised_out/ \
    --name supervised_run \
    -k 8

Other options

All hyperparameters and flags can be explored with:

$ adamixture --help

Key arguments:

Argument                                          Default Description
--init als Initialization method: SVD+ALS (als) or random EM priming (em).
--tol 0.1 Convergence tolerance for log-likelihood changes.
--max_iter 10000 Maximum optimization iterations.
-t 1 Number of CPU threads.
-s 42 Random seed.
--device cpu Device to use: cpu, gpu, or mps.
--chunk_size 8192 Number of SNPs in chunk operations.
--n_inits 1 Number of independent initializations (keeps run with best log-likelihood).
--chrom_mode autosomes Chromosome filter: autosomes keeps autosomes 1 to --autosomes; all keeps every chromosome.
--autosomes 22 Number of autosomes kept when --chrom_mode autosomes (equivalent to --specific_chrom 1 2 ... 22).
--specific_chrom None List of specific chromosomes to analyze when --chrom_mode autosomes (overrides --autosomes).
--no_freqs False Do not save the .P allele-frequency matrix.

Algorithm note

The ADAMIXTURE paper introduced Adam-EM as an adaptive first-order optimizer for admixture inference. The package still includes this solver via --algorithm adamem.

In the current implementation, the default is --algorithm brqn. Empirical benchmarking showed that block relaxation with ZAL quasi-Newton acceleration, when paired with our improved SVD+ALS initialization, reaches high-quality solutions in fewer iterations and better wall-clock time. For that reason, BR-QN is the default solver, while Adam-EM remains available for experimentation and reproducibility. Adam-EM tuning parameters are documented in Troubleshooting and Tips.

Troubleshooting and Tips

Common issues and platform notes:

  • macOS: Install libomp via Homebrew (brew install libomp) before compiling.
  • Windows: Pre-compiled wheels are provided on PyPI (pip install adamixture). If compiling from source (pip install -e .), install Build Tools for Visual Studio with Desktop development with C++.
  • CUDA: Set CUDA_HOME or install nvcc via Conda (conda install -c nvidia nvcc).

Full documentation

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

The cluster alignment and mode detection used for plotting are a port of Clumppling (MIT License, Xiran Liu et al.), reimplemented on NumPy and Cython in adamixture/src/clumppling.py.

Cite

When using this software, please cite the following paper:

@article{saurina2026adamixture,
  title={ADAMIXTURE: adaptive first-order optimization for biobank-scale genetic clustering},
  author={Saurina-i-Ricos, Joan and Mas Montserrat, Daniel and Ioannidis, Alexander G.},
  journal={Bioinformatics},
  volume={42},
  number={Supplement\_1},
  pages={btag236},
  year={2026},
  doi={10.1093/bioinformatics/btag236},
  url={https://doi.org/10.1093/bioinformatics/btag236}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adamixture-1.8.2.tar.gz (21.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

adamixture-1.8.2-cp312-cp312-win_amd64.whl (12.1 MB view details)

Uploaded CPython 3.12Windows x86-64

adamixture-1.8.2-cp312-cp312-manylinux_2_28_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

adamixture-1.8.2-cp312-cp312-macosx_14_0_x86_64.whl (12.2 MB view details)

Uploaded CPython 3.12macOS 14.0+ x86-64

adamixture-1.8.2-cp312-cp312-macosx_14_0_arm64.whl (12.4 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

adamixture-1.8.2-cp311-cp311-win_amd64.whl (12.1 MB view details)

Uploaded CPython 3.11Windows x86-64

adamixture-1.8.2-cp311-cp311-manylinux_2_28_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

adamixture-1.8.2-cp311-cp311-macosx_14_0_x86_64.whl (12.2 MB view details)

Uploaded CPython 3.11macOS 14.0+ x86-64

adamixture-1.8.2-cp311-cp311-macosx_14_0_arm64.whl (12.4 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

adamixture-1.8.2-cp310-cp310-win_amd64.whl (12.1 MB view details)

Uploaded CPython 3.10Windows x86-64

adamixture-1.8.2-cp310-cp310-manylinux_2_28_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

adamixture-1.8.2-cp310-cp310-macosx_14_0_x86_64.whl (12.2 MB view details)

Uploaded CPython 3.10macOS 14.0+ x86-64

adamixture-1.8.2-cp310-cp310-macosx_14_0_arm64.whl (12.4 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file adamixture-1.8.2.tar.gz.

File metadata

  • Download URL: adamixture-1.8.2.tar.gz
  • Upload date:
  • Size: 21.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for adamixture-1.8.2.tar.gz
Algorithm Hash digest
SHA256 25b2c8fa34609c4941042d1ccf4b54f0817605c0ee6fb7fd2d4428d044a67e08
MD5 3d135d90d568b0e2bbbd545deb59a940
BLAKE2b-256 93d24ac7451ea3a7ac5c77d940dd5a44ca3761aea72753d8bdf8f9f3f75ca22b

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: adamixture-1.8.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 12.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for adamixture-1.8.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7f217c750cbf9c6cc65ff52231ddc405c453b01dcbac23c54111b83e181d1324
MD5 453bcb9cab9422b35531cf87ba0d0f89
BLAKE2b-256 98f7416ea58a8e5622ffc696156991d2c56b63ae108925ba0c42994582c1e2fa

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0cdcb15de0fcd3c2905fdeccfbe42d2b7178e5fb9d2692c0869a6c1cff6615df
MD5 dcc024020fb8344ad7758b536465ddd7
BLAKE2b-256 fa52157438eb09dd9fa379a2de187efda422863abc02d296f551b88357c3f244

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp312-cp312-macosx_14_0_x86_64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp312-cp312-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 bf3d38e44bf20eeef0ca553a1001a882c296535e3122d5eed14ec83900ea8380
MD5 6b7092db692319ed5c4d01643ecc3a80
BLAKE2b-256 f3cde99e836e8e95f224e5806544d797dc3c6a509df2591661834be850235137

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f47d12c07efc839c39d42e98a1bc92af4c00b175af50834d74bcf9a938c8ded2
MD5 85a477aceb6e14dac0762949e41dd507
BLAKE2b-256 0f0e08e868710b0b6171605d6d2c5124bc9f84029f698ecc747445e3a681d177

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: adamixture-1.8.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 12.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for adamixture-1.8.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1e22f5e1c486ec65be3e3849ce610a0866000765a3418c1d77f9bb9aba76cf81
MD5 8775524bca2121e0f58cea2d021877e0
BLAKE2b-256 6f8089ecee5e115f8bc08884926d20954ed8a83ea4c190128dfb8213f6a396f7

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d747f074953b5c5ced6852c460e3f7ab73d9d2e749612ba1a4443e39d89c8065
MD5 e64d2e67d15c0fd2aca32a401fc25336
BLAKE2b-256 e68dbb6539dd16f252b968e7b3c61bc08dcfdcfa730f0de0b6e77c8f6645b80e

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp311-cp311-macosx_14_0_x86_64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp311-cp311-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 2581901b171e16f7f69ca3ccf74f48c73afcc24def9c1ad4d032c7ae5f6978e0
MD5 d7ba670dc8ca27c59af8db2def01c577
BLAKE2b-256 aba649bd2d04c43a5cdf3999ca5b2f8604c4be38f57aa3854cfc8348458e7079

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f3c39025793fbd112019f9acb2d2395ee1dd393332e49a0fed7e0427602e65c9
MD5 c591f4ef83cf1b92c7e97afa430e1777
BLAKE2b-256 bb2cc063f25a0f4104db0cbf93963cba1f012da7e7acabf86576e6862208e3d4

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: adamixture-1.8.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 12.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for adamixture-1.8.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 728f7326435999c89e1bf2622444288ab4b283c1ea674d731398765ce0e4bc60
MD5 aeddc3eaf2ec27b38435171b9088d9d3
BLAKE2b-256 ae105d4ffc1168ea507b4adde46743531cfd27e340b30d76d4aa9b1647a4e38f

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c39bcb47af6ce2d2ad2d56b195c452f78b6a2fc5dcc0260c24754b2a121e0b7a
MD5 0667c2789d4e7e8a6c966eddaf5ac063
BLAKE2b-256 ae4120fb17aa8462d489049c8c537e1a4cdc3ab6ca9e3cec5bc7419253f112ec

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp310-cp310-macosx_14_0_x86_64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp310-cp310-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 f5a5707e622497effe9b35114a15f7af80aa2cc0d987b237b51d631509b85dcf
MD5 04391eee7ba01cc3b1835cae63ea7d76
BLAKE2b-256 e4cf7047d86cdd53c3340b14248226f5046ed7dbc4b2f5cfa00984cd6f4dd094

See more details on using hashes here.

File details

Details for the file adamixture-1.8.2-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for adamixture-1.8.2-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 abe0090544b51eb2744d15bc8869bbf9dc7d149130360dfb0ef292fdff717684
MD5 00d4169a225a4dddfe9d93ac7e1f534c
BLAKE2b-256 1c9a8b203015961375bc900d93cb2cc5c21f8b403681dd8acfbbd42a3f3a39d8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.8.2 This release

13 files

1.8.1

13 files

1.8.0

13 files

1.7.5

10 files

1.7.4

10 files

1.7.3

10 files

1.7.2

10 files

1.7.1

10 files

1.7.0

10 files

1.6.2

10 files

1.6.1

10 files

1.6.0

10 files

1.5.5

10 files

1.5.4

10 files

1.5.3

10 files

1.5.2

10 files

1.5.1

10 files

1.5.0

10 files

1.0.2

10 files

1.0.1

10 files

1.0.0

10 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page