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.

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
    

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. K=1 is the no-structure null model and is a valid start for a sweep or a CV baseline:

$ adamixture --min_k 1 --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}
}

Metadata

Release files for adamixture 1.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adamixture 1.8.3
File Size Uploaded
adamixture-1.8.3.tar.gz 21.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for adamixture 1.8.3
File
adamixture-1.8.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
adamixture-1.8.3-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
adamixture-1.8.3-cp312-cp312-macosx_14_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 14.0+ x86-64 Details
adamixture-1.8.3-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
adamixture-1.8.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
adamixture-1.8.3-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
adamixture-1.8.3-cp311-cp311-macosx_14_0_x86_64.whl CPython 3.11 CPython 3.11 macOS 14.0+ x86-64 Details
adamixture-1.8.3-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
adamixture-1.8.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
adamixture-1.8.3-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
adamixture-1.8.3-cp310-cp310-macosx_14_0_x86_64.whl CPython 3.10 CPython 3.10 macOS 14.0+ x86-64 Details
adamixture-1.8.3-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details

Total release size: 170.8 MB

Release files / adamixture-1.8.3.tar.gz

Download URL adamixture-1.8.3.tar.gz
Size 21.7 MB
Tags Source
SHA-256 checksum
How to use checksums
3852a45ff21bf8bd70d31ecb2e5b47bdbc6ed46036d47b9e2c1fd7a0bd3c961e
BLAKE2b-256 checksum
How to use checksums
e84200f02ea9a382d2f498e80c28e91593f1d4436b0772f1e2248521b4f86061
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp312-cp312-win_amd64.whl

Download URL adamixture-1.8.3-cp312-cp312-win_amd64.whl
Size 12.2 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
c8bf8cd84f58ffbe3021dfe4da9336c5064d3be42459bfaf049076e8ed792fe9
BLAKE2b-256 checksum
How to use checksums
4e3b23e6c99ed8f15f6e0197722757ce281dff86550ae268ea93d3992b829d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL adamixture-1.8.3-cp312-cp312-manylinux_2_28_x86_64.whl
Size 12.7 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4a4f157574d56e6a0d780618906eb793f8c6ffd4e50ac8ad7c09fe721a2b89b2
BLAKE2b-256 checksum
How to use checksums
be01e5c30ad9b62455464371a9c766318f640f19a2a14e0f38ce59960db44e60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp312-cp312-macosx_14_0_x86_64.whl

Download URL adamixture-1.8.3-cp312-cp312-macosx_14_0_x86_64.whl
Size 12.3 MB
Tags CPython 3.12 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
5d919182911a78d42f9e03b72427e2f82dcaece5214c62fd77bf3fdc052028e1
BLAKE2b-256 checksum
How to use checksums
43fe19303e104eaf366fbbb7e9e519599d4816d11b8405fa0f15f7f3d857ba66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp312-cp312-macosx_14_0_arm64.whl

Download URL adamixture-1.8.3-cp312-cp312-macosx_14_0_arm64.whl
Size 12.5 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
01a407239b78219fff36575c74a1e62bd9c94e9f84cefad582957450ff01db93
BLAKE2b-256 checksum
How to use checksums
2aa9ea02e802ea4247d8b7a7fb4a6269bf04608bd4e1833e66e09993f30e8e3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp311-cp311-win_amd64.whl

Download URL adamixture-1.8.3-cp311-cp311-win_amd64.whl
Size 12.2 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
0dc816ce9dc790ca93739faf44f0a73d760396cc597c999bfc5099568423d384
BLAKE2b-256 checksum
How to use checksums
1cb0625b13159fc1915ec52d914610ca2c3b19fa2e84827ca14c925fe60a1710
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL adamixture-1.8.3-cp311-cp311-manylinux_2_28_x86_64.whl
Size 12.7 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
27daadb89ef1efe80c8fc463db16018409d7d86d145adf0321094ec969f53d33
BLAKE2b-256 checksum
How to use checksums
c2192f2f59185d237f2f53b51f0c8e5cb38d2ae3e7f709a35bc2417ec86bd84a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp311-cp311-macosx_14_0_x86_64.whl

Download URL adamixture-1.8.3-cp311-cp311-macosx_14_0_x86_64.whl
Size 12.3 MB
Tags CPython 3.11 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
107b0bdaaba68d16d0f0517e480aedfab7aefd98baa5ea25300c4a37c6fb4cac
BLAKE2b-256 checksum
How to use checksums
01faaf3092570937a3c5a6fca94e485ce9d50ad3016791fc6102fe792479c513
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp311-cp311-macosx_14_0_arm64.whl

Download URL adamixture-1.8.3-cp311-cp311-macosx_14_0_arm64.whl
Size 12.5 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
d80b79d6e08c71c5111e3c148690b78c91465dbd3771327d3b6a16f09d175f62
BLAKE2b-256 checksum
How to use checksums
f00d9be4d2835748b1dcc0e1308f6d3bc054d7dc4801daf30d47195c0b9ae74d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp310-cp310-win_amd64.whl

Download URL adamixture-1.8.3-cp310-cp310-win_amd64.whl
Size 12.2 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
3bee98a263c766930cc4e36d8b42fe208c5f3703f019f1be2de25d78891c4ebe
BLAKE2b-256 checksum
How to use checksums
4ad4551ce3aed5c86507f8c904f3facfcef476ae92fae2a29e6cdac84854fc0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL adamixture-1.8.3-cp310-cp310-manylinux_2_28_x86_64.whl
Size 12.7 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a6ea0f8b3d678a5693ba88fc6b53686cbb55a37919deeeea0dda93b8509ca0d9
BLAKE2b-256 checksum
How to use checksums
ecebbcde31c8350b8b1f3819784d8a938d2c75c6913729c4c8c4f02b19c67351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp310-cp310-macosx_14_0_x86_64.whl

Download URL adamixture-1.8.3-cp310-cp310-macosx_14_0_x86_64.whl
Size 12.3 MB
Tags CPython 3.10 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
ccbe0bf0eb0e10a4d2491e1915a050ee32e20efa01a432d8100ed9120cadd9ee
BLAKE2b-256 checksum
How to use checksums
85c925d33d75863cece6b4d6d86b455f23ee290d73b5e7dff41114a077d5287d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / adamixture-1.8.3-cp310-cp310-macosx_14_0_arm64.whl

Download URL adamixture-1.8.3-cp310-cp310-macosx_14_0_arm64.whl
Size 12.5 MB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
0354fcfd67a21d2744c80f32a95bcddbfb97d5f9e85ba1a9df48f585fe79f9c8
BLAKE2b-256 checksum
How to use checksums
aba1b43dfb7e56f1d1154a00ecf1d5ebde924acb3fc97aee0e395d2ce207e7a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

1.8.7

13 release files

1.8.6

13 release files

1.8.5

13 release files

1.8.4

13 release files

This release

1.8.3 This release

13 release files

1.8.2

13 release files

1.8.1

13 release files

1.8.0

13 release files

1.6.2

10 release files

1.6.1

10 release files

1.6.0

10 release files

1.5.5

10 release files

1.5.4

10 release files

1.5.3

10 release files

1.5.2

10 release files

1.5.1

10 release files

1.5.0

10 release files

1.0.2

10 release files

1.0.1

10 release files

1.0.0

10 release 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