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 requirements

The successful usage of this package requires a computer with enough RAM to be able to handle the large datasets the network has been designed to work with. Due to this, we recommend using compute clusters whenever available to avoid memory issues.

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 and PGEN 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.

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. → 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), you must use the appropriate flag depending on your execution mode:

  • Single K runs (-k): Use --plot_single. Note that --plot will be ignored in single K mode.

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

    $ 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: improved 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
--chromosome_mode autosomes Chromosome filter: autosomes keeps autosomes 1..--autosome_count; all keeps every chromosome
--autosome_count 22 Number of autosomes kept when --chromosome_mode autosomes
--no_freqs False Do not save the .P allele-frequency matrix

Algorithm note

The ADAMIXTURE preprint 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

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 preprint:

@article{saurina2026adamixture,
  title={ADAMIXTURE: Adaptive First-Order Optimization for Biobank-Scale Genetic Clustering},
  author={Saurina-i-Ricos, Joan and Mas Monserrat, Daniel and Ioannidis, Alexander G.},
  journal={bioRxiv},
  year={2026},
  doi={10.64898/2026.02.13.700171},
  url={https://doi.org/10.64898/2026.02.13.700171}
}

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.7.5.tar.gz (20.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.7.5-cp312-cp312-manylinux_2_28_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

adamixture-1.7.5-cp312-cp312-macosx_14_0_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.12macOS 14.0+ x86-64

adamixture-1.7.5-cp312-cp312-macosx_14_0_arm64.whl (11.2 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

adamixture-1.7.5-cp311-cp311-manylinux_2_28_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

adamixture-1.7.5-cp311-cp311-macosx_14_0_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.11macOS 14.0+ x86-64

adamixture-1.7.5-cp311-cp311-macosx_14_0_arm64.whl (11.2 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

adamixture-1.7.5-cp310-cp310-manylinux_2_28_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

adamixture-1.7.5-cp310-cp310-macosx_14_0_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.10macOS 14.0+ x86-64

adamixture-1.7.5-cp310-cp310-macosx_14_0_arm64.whl (11.2 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for adamixture-1.7.5.tar.gz
Algorithm Hash digest
SHA256 4194c155f05cb1e76315d178498f4db30ecd0cf381121d59544b16a5580d22ec
MD5 4b1a3ced255b3c78078651113779cdc2
BLAKE2b-256 e3b0617989c480846ee4abd384182934bdd2bda88565240c7a410237d99bff24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fe07a6e51b99ede796c5e393e1e1e2014246d120f8e98e85aec3ae59e9906ded
MD5 379e85de3d65e1e09c4b9b3c8f8c45b1
BLAKE2b-256 4db0dadae81ac4dcdd93c1ce4961fb613dde9c3fb89ddb56a6b095ebbd2441ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp312-cp312-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 9fc482125ca76b8c9ed4061f531198e83c545db10d2e30d863182d3c2b6a2398
MD5 0891feeb3e74df2d86c8d93e53188243
BLAKE2b-256 fd22f66dad5e8e88be22128fd21bc7145ce94f1e61304e4d4403b26787636ed5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 92249bc2c965d64fe0ccc9f3f77cbbdb42649902c8eee9566be356d90d415e7b
MD5 fbc3a984078d4f77c7d2f55bb2e55889
BLAKE2b-256 88b89d3418c3d1e3fa686711215300fb990448cc66a2e89bca7e730fedb148c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b021aaae5bfb487213cfbed6a8e83596bed82d557187eb9cbe8f8073bb84eb9b
MD5 6c55532b006468f428503165a6d27c1a
BLAKE2b-256 efd6d9bfbefbbebb2941fcb54c44b145fbdf3c6c38167b13652f71699611e92d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp311-cp311-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 a4988b32ab8f6bb5930d4aaec95a67af2893905e24550fde7c88816f7d2636a7
MD5 67d2de3cbacee394da0d4ac86c14a416
BLAKE2b-256 b786d03e878c343ec8c893e1e3e577e5757364397e4bf8de214eec50b2a8be79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 5f14e088a74eddfc3d8486d8e4f80c16586d661de784a38dddf02414e5a5a3e8
MD5 8be7ba69f6ab3b02823b34dc654818f8
BLAKE2b-256 82a246cc1ef9a97e290e2cc5a63cff91d34d585209215c7f216af22dca2baf62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 663fe5f68553104d4aa8882f01f7ee98dbafa399140edc3642e0c29709e17af3
MD5 0911d5b8373a560d91b00b7731a1e68b
BLAKE2b-256 705acb21abbc48ec52894de3ea390070d936cf71fb37191bb4826d6c563d7853

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp310-cp310-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 39ca1be7fe61e5417a85906f84b05deb587bb2070e0126d732684ecd2f3acdaf
MD5 41e188059b7e9a36f95bfe022706b915
BLAKE2b-256 58ad4e095ac338a4ee32014e0612280fe1ccc31ede2a9bcce7682510e9731893

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.7.5-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d0b2ad989fc0eb7a9b2734957a5072c68ae3ad5a4588b8e75c76e0867d258411
MD5 86cd92d698b2ca64b54a2b785690e5e6
BLAKE2b-256 653020e13e01cc14eb62edc01dca3a90697c508b7f8212502c328073cc6506d2

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