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 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. 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.0.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.8.0-cp312-cp312-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.12Windows x86-64

adamixture-1.8.0-cp312-cp312-manylinux_2_28_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

adamixture-1.8.0-cp312-cp312-macosx_14_0_x86_64.whl (11.1 MB view details)

Uploaded CPython 3.12macOS 14.0+ x86-64

adamixture-1.8.0-cp312-cp312-macosx_14_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

adamixture-1.8.0-cp311-cp311-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.11Windows x86-64

adamixture-1.8.0-cp311-cp311-manylinux_2_28_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

adamixture-1.8.0-cp311-cp311-macosx_14_0_x86_64.whl (11.1 MB view details)

Uploaded CPython 3.11macOS 14.0+ x86-64

adamixture-1.8.0-cp311-cp311-macosx_14_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

adamixture-1.8.0-cp310-cp310-win_amd64.whl (11.0 MB view details)

Uploaded CPython 3.10Windows x86-64

adamixture-1.8.0-cp310-cp310-manylinux_2_28_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

adamixture-1.8.0-cp310-cp310-macosx_14_0_x86_64.whl (11.1 MB view details)

Uploaded CPython 3.10macOS 14.0+ x86-64

adamixture-1.8.0-cp310-cp310-macosx_14_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: adamixture-1.8.0.tar.gz
  • Upload date:
  • Size: 20.6 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.0.tar.gz
Algorithm Hash digest
SHA256 1b50b71f3813c164b51f700a88995a1ba68940a2d71f310f6b651f0d41ba4750
MD5 a4a58f823b877bfb7388914d98e4bfe7
BLAKE2b-256 8d9818337be9287f4255de684420ef837bd7bd983e484a132580111eebc55656

See more details on using hashes here.

File details

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

File metadata

  • Download URL: adamixture-1.8.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 11.0 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.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d5bb87d87b8ab3b124ebbf66396998c68ddc370ccd7aae93f2053fec8f7ce482
MD5 6c99609dc885f8cb6be72622832d46e4
BLAKE2b-256 2a2caa4970cc233a27d87651a64a265e7b93cb5ae49d9d2720f80affa0129a88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0d0e93d5d125335d691798367bbe9ec691993b166c0bffd81a98b1c06771e55e
MD5 efba6bdcb81181a0941511d53159567d
BLAKE2b-256 5ee28a8c9b6350356e208c95fb48ecf7e7288e1269d80fd12be9475d27f1e13e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp312-cp312-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 262c16b55229fd5209e6a1812317273af065c7f4780c1fff1ecf64755b4dede0
MD5 af8d564b843e86178a665b2d6d27b214
BLAKE2b-256 b49014e781f7bedf93ca677b573ea60d4999a263019c8cf647dd8be4ab3fd01e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 5742427f93b9f174c74ab41263aec697d41ca4c80ebe37b15d637ce62b4992aa
MD5 184364e6e011ba0c968fafe38efbfd1b
BLAKE2b-256 21c5e92b244c3fd64102051d86494ef5f63289543d480d3709238bdf14cd951a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: adamixture-1.8.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 11.0 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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a976535df9062e911ee3fe0f736cf5b6a9f7fe3a921ddf1a3f8e242d9033d187
MD5 aeb4d46ed007219bc85ab45474422bda
BLAKE2b-256 d3fd5084c4bd4ee8e4266f61fbe482035bc1c1f1a70597a1f55733221528226d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c16f4559be7553bf489e57b608d1b571750684bccbf787b5da5bef840ecf39b2
MD5 d63750359ede96ed323a4505e7588a95
BLAKE2b-256 87f61eb08ab8434bb8045d1b57dc8e448ba2891fdb83d68b454b3c019a22fc1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp311-cp311-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 649f9860509a27910da5b0e7e2e54d6379c273bb542625f8407e26648bc0beb3
MD5 1e44ae93b3bbe9fc70e824d13fb8e611
BLAKE2b-256 5a4335ee562724f4db83d96cf52dff1312fa7bd58ebb7a3b130d2781d0c976c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 260a397953248687f23b31e0c1ca2b598e0710892cf8f80bfd5171734bff31e9
MD5 8aeee7934f01d71110ef053895f676ae
BLAKE2b-256 abdc076f1889b3b65ac69e654488c816911d1b63d33b351627f66fcd109c5618

See more details on using hashes here.

File details

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

File metadata

  • Download URL: adamixture-1.8.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 11.0 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.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a6889a915b580d6746a8d3c4166453b530d1085aaaa40847c9ca7bc6935a0285
MD5 81b8abad917fcc394bf85044f5a093ae
BLAKE2b-256 4dec9fee613b949ca890759c6b559f8953c435958ac1d57915ab2d28feccb17a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 330394475bad6a353380b8d04ad39c1873d2042595ff5b8081939c5fd9af6188
MD5 aebfa49fcc826ce8b31fe086604b70b2
BLAKE2b-256 06b91c16b6d0e65c8329a4e1de3c3a3dcf7ca02aebbee52f279572dc4a2d747b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp310-cp310-macosx_14_0_x86_64.whl
Algorithm Hash digest
SHA256 74cff5a28f66ecf10343dcc3ba1a4569094ea3a9e911fe79c322869e90fd1e16
MD5 d7f7ce71670a148d19dfc2392c029841
BLAKE2b-256 798cc01bce777da19d406eb73d2152d488192487e6b6eb6c5b0aeb0b1668dcb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adamixture-1.8.0-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2692a0a9080b79683ba4dd7a02ed38ae01a85e279e280664b643ffa15072bc4b
MD5 2414f80cc768cbf076ae61900edb1fa3
BLAKE2b-256 9e639cb6ef8fb3633bac4177cb5468a6aa52fd5f413a0b1f6514a2c5b057b07b

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