Skip to main content

Project (ancient) human genomes onto pre-computed standard PCA

Project description

projectPCA

Project genomes onto pre-computed principal components widely used in ancient DNA. Enables fast analysis without re-computing the principal components. The software accepts ancient DNA data in eigenstrat or PLINK format as input. No modern samples are required, as the packages include the pre-computed PCA weights and PC coordinates for relevant modern samples (based on publicly available Human Origin array data).

Installation

The package projectPCAis available as a Python package via pip. To install, simply run a version of:

python3 -m pip install projectPCA

List of available PCAs

As of early 2026, three pre-computed PCAs are officially bundled into projectPCA. The bracket denotes the code you can use for all this PCA.

  • HO Westeurasia (HO) Standard Western Eurasian PCA, which is widely used in aDNA studies. PC1 corresponds to West-East, and PC2 to North-South.

  • HO Eurasian (EUAS) Standard whole-Eurasian PCA, widely used in aDNA studies. Excellent to resolve West versus East Asian ancestry (on PC1). PC2 generally corresponds to North-South.

  • HO Mediterranean (MED) This PCA is an extension of the standard Western Eurasian PCA (see above) and includes additional North African populations. That gives a more useful resolution for North African ancestry. The PCA is based on the one from the Puncic paper (Ringbauer et al 2025). Important: You have to use maf=0.001 here, which is different from the default. See an example Vignette here.

Usage

Project single Samples

To project onto a PCA, the key function is project_eigenstrat. To import it and run a single sample, use:

from projectPCA.run import project_eigenstrat

project_eigenstrat(es_path="/mnt/archgen/Autorun_eager/eager_outputs/TF/SUA/SUA002/genotyping/pileupcaller.double",
                   pca="HO", es_type="default")

This function also returns the dataframe with PCA coordinates. Note that the input path is the path of the eigenstrat files up to .geno but without the suffix.

The keyword pca denotes which PCA type to project onto (see above).

If you want to save the figure, you can add the keyword fig_path="". If this string is filled in, the program saves the resulting figure there. If the path ends in .html, the figure is saved as an interactive plot, where you can hover over the individuals to see their labels (both ancient and modern reference samples). Otherwise, the standard matplotlib libraries are used to plot and save the figure (including in .png or .pdf format, based on the extension you provide).

project_eigenstrat(es_path="/mnt/archgen/Autorun_eager/eager_outputs/TF/SUA/SUA002/genotyping/pileupcaller.double",
                   pca="EUAS", es_type="unpacked_fast", plot_bgrd_c=False, fig_path='./figs/SUA002_EUAS.html')

Project multiple samples

It is also possible to project multiple samples. For this, you can use the keyword iids=[]. If the keyword is empty (the default), all samples in a file are projected and plotted. If you specify a list of individuals, only individuals with these IDs are projected.

Project PLINK files

To project PLINK files, you can use the keyword es_type="plink", and provide the path of the PLINK file up to the suffix:

project_eigenstrat(es_path="/mnt/archgen/users/hringbauer/git/EPIDEMIC/output/plink/bd_ptn_335",
                   pca="EUAS", es_type="plink", iids=[],
                   plot_bgrd_c=False, verbose=True, flip=True, 
                   fig_path='/mnt/archgen/users/hringbauer/git/projectPCA/figs/ptn335PLINK_EUAS.html')

@Harald Ringbauer, 2026

Project details


Download files

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

Source Distribution

projectpca-0.4.1.tar.gz (80.5 MB view details)

Uploaded Source

Built Distribution

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

projectpca-0.4.1-py3-none-any.whl (81.2 MB view details)

Uploaded Python 3

File details

Details for the file projectpca-0.4.1.tar.gz.

File metadata

  • Download URL: projectpca-0.4.1.tar.gz
  • Upload date:
  • Size: 80.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for projectpca-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4e1cbface13f167421022d149475430721921b08032fb45802ca0af6cede40f3
MD5 b9d11e951614a2683cd8ec7c1c35647f
BLAKE2b-256 485945b955e0561adb5e7d2cc2db92ba172f72d8bf68e5d16fe3826e1a50e199

See more details on using hashes here.

File details

Details for the file projectpca-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: projectpca-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 81.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for projectpca-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dcf255ad719e2044bbe652c9dc4ceba64af342ee5a14f911de8a6b08c8f7aa7
MD5 4bbf34d2e2b1a52523ef981467eedf84
BLAKE2b-256 cdd64a63b0b1f19b268a03fbca351d3d9fe962eb238783a5ec45d0c208a20a97

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