SPCAncestry
A Python package for supervised global population ancestry inference from SNP data using stacking
Installation
SPCAncestry will soon be available through PyPI and installable using the following command:
pip3 install spcancestry
Usage
SPCAncestry assumes the user has SNP training data, in either PLINK, VCF, or Hail MatrixTable, and reliable global population ancestry labels for all the samples in the training data. We compute PCs using the training data, then these PCs (Xs) together with the population labels (Y) are used to train the model. The test SNP data is projected onto the PCs computed using the training data, and then we use the trained model to infer population ancestry. Below are the steps on how you can use the HGDP1KG data, provided with this package, for ancestry inference.
- Read the training and test datasets
import spcancestry
path = '/path/to/spcancestry/test_data/hgdp1kg'
inref_mt = spcancestry.Read(file=f'{path}/hgdp1kg_truth.bed', qc=False).as_matrixtable()
input_mt = spcancestry.Read(file=f'{path}/hgdp1kg_unknown.fam', qc=False).as_matrixtable()
- Intersect the two datasets, compute PCs using training data, and project test data onto training PC space
scores_df, colnames = spcancestry.PCProject(ref_mt=inref_mt, data_mt=input_mt,
ref_info=f'{path}hgdp_1kg_truth_labels.txt').run_pca_projection()
- Infer global population ancestry using spcancestry stacking
spcancestry_infered = spcancestry.infer_ancestry(scores_df, colnames)
Copyright and License
SPCAncestry is generously distributed under the MIT License
Metadata
Release files for spcancestry 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spcancestry-0.1.0.tar.gz | 5.6 kB | Without provenance | Details for spcancestry-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spcancestry-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for spcancestry-0.1.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / spcancestry-0.1.0.tar.gz
| Download URL | spcancestry-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
198595f108bfb3c538873e4d18347451eb1992d98e113653b119bf8fffab163f
|
|
BLAKE2b-256 checksum How to use checksums |
fd324dbf00ecf445ff41ae6d9c03313a0e184a3e329e2ae7a3ef067e8b35e3c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.9
|
Release files / spcancestry-0.1.0-py3-none-any.whl
| Download URL | spcancestry-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
899a68fe15441d2b4d5b3f12cc8d90f9f0f42a50d843bb259a825b56804f9e6a
|
|
BLAKE2b-256 checksum How to use checksums |
001f4cf81868043061ea9b06448165ba52e9acb3c3c91b769ad1348c79835714
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.9
|
Security for spcancestry 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.