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. Powered by 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 5 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.

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.1.tar.gz (21.4 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.1-cp312-cp312-win_amd64.whl (11.8 MB view details)

Uploaded CPython 3.12Windows x86-64

adamixture-1.8.1-cp312-cp312-manylinux_2_28_x86_64.whl (12.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

adamixture-1.8.1-cp312-cp312-macosx_14_0_x86_64.whl (11.9 MB view details)

Uploaded CPython 3.12macOS 14.0+ x86-64

adamixture-1.8.1-cp312-cp312-macosx_14_0_arm64.whl (12.1 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

adamixture-1.8.1-cp311-cp311-win_amd64.whl (11.8 MB view details)

Uploaded CPython 3.11Windows x86-64

adamixture-1.8.1-cp311-cp311-manylinux_2_28_x86_64.whl (12.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

adamixture-1.8.1-cp311-cp311-macosx_14_0_x86_64.whl (11.9 MB view details)

Uploaded CPython 3.11macOS 14.0+ x86-64

adamixture-1.8.1-cp311-cp311-macosx_14_0_arm64.whl (12.1 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

adamixture-1.8.1-cp310-cp310-win_amd64.whl (11.8 MB view details)

Uploaded CPython 3.10Windows x86-64

adamixture-1.8.1-cp310-cp310-manylinux_2_28_x86_64.whl (12.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

adamixture-1.8.1-cp310-cp310-macosx_14_0_x86_64.whl (11.9 MB view details)

Uploaded CPython 3.10macOS 14.0+ x86-64

adamixture-1.8.1-cp310-cp310-macosx_14_0_arm64.whl (12.1 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for adamixture-1.8.1.tar.gz
Algorithm Hash digest
SHA256 e5cc22278e54e9d573321a1bb828d225a1a728f5f2b34defb0e7fa46a4ad15c6
MD5 ac3d4178879db35d8be1bc9df939783c
BLAKE2b-256 f61c27e77d1e9b0e31e2a480ea8335c3118d7109cca666a0b2aa2c0a7663f6e3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for adamixture-1.8.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8c8d02c42918c3939ca020428cd7ca695a4d2ae7d53c7a14ac04ebd96182b0b3
MD5 4f6741c72f20295c92043b24ffa072b4
BLAKE2b-256 e3cb3ed5e2638fb47ea55eaeaf346fb874ae2f14da4a33d9d6cf06320cf9c723

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d9d7b45726e265aeab891bb107613029cb3b1193cf7c4650fe9b8e09215f00e7
MD5 a1b480d7b1cab7676672fc1876920682
BLAKE2b-256 ef50f98a4cea6a89b3bf846342316022102403c1fb7b21ba27f39f2040baac54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp312-cp312-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 afcdd527568f762ff3bdb55723b81be518281736400ff6a788f2e6c3d574dd4c
MD5 c84e190424282c6ccb615dabb24e4e24
BLAKE2b-256 b9fd30af666b9a222f31c0b06d47a4d71c168786ddbaee0c02417f6e1283bc53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 905ec60e7262e87daf3624525920ee0a8f038bce5ac117120d717d33b7730073
MD5 28fcfd7befffabed6ecd37f2b60e3257
BLAKE2b-256 40bbe1175c415775b41187e7b8430ccc757d52e20e9860c7c7195393262664ae

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for adamixture-1.8.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e1f983997055d3a92afdca25f0f626062dd5e371e284e4e94ce352be946fe995
MD5 497ab6bd40c75ea230575662b3808056
BLAKE2b-256 2f213e4ad1225eb515d49d90aec80d34f1a41551a8599688f355c2710aa167cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 45fe766561c13179fc48314dd57a5ab66ed2574cae22ff66ca1aaa42cc31402d
MD5 c0f0d2f4c952f69dd9f3fe078dc2256d
BLAKE2b-256 0726a4437f14b9e2f880960f6cf052fdc06a8e39c9b172228f578ab411d6c266

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp311-cp311-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 2e017c5aff39f0c79fcc6b3c7f1d96149be8236b825f3095fcb6727369240b52
MD5 6b0ea5b0f4bba88b8e04da2af9f39de6
BLAKE2b-256 ae78cd07a80f8839cf51b675e60630011473d3af16354a8baf7af5c7df472685

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a4eb6496449355e6e085283651394a3fa0d56b8f2afe81b5e472db12b40bb1e6
MD5 8ccd182f8d49172924c5391abd30a58e
BLAKE2b-256 d33624413242d6baebb4503a2615df3e9d5914e0e60826f74719e0a0f3eb44fb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for adamixture-1.8.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 62e931ef6d0a828359bbc84f8ff66df6ef4333f497a73c35909a1bfb832f3e22
MD5 28dab1b18e9fc37437077de6bcb0ead5
BLAKE2b-256 4e9c1ce1eaab9b80429ed6c432369aadff4ab673e1961bc037da537c99db411b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0574c1127d5f47636ffa884a61b0a59794ba2dcdc861ba1e51392f10e2f2df5c
MD5 e9794e5fb6b68ec7b0ea7491e13af46c
BLAKE2b-256 bcc47eb1dede43dffdd3e6e93a65a15d8238601ee0428fce5213e8cc8710159c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp310-cp310-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 5f8e452593c3ef17e119e2e7f60893d9ea78d33a9eda7923d69e72c8ce0510ce
MD5 e8f929f24bbb9abd31fe1a47c7185e83
BLAKE2b-256 06d6c4823471b08b8343effc1633fe5c15fade859bd66fe94ee8687416d7fb15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.1-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 13f563ad9d8b7419f862d17177a713e40334182b2204b8d186b034749657179e
MD5 eb0ec40bb627635d9186af3874aa3b99
BLAKE2b-256 f04a99378f64997cbda03585232bc19b7e9228084ba77ed290e0ca4f8e6c086c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page