Skip to main content

HLAfreq

HLAfreq allows you to download and combine HLA allele frequencies from multiple datasets, e.g. combine data from several studies within a country or combine countries. Useful for studying regional diversity in immune genes and, when paired with epitope prediction, estimating a population's ability to mount an immune response to specific epitopes.

Automated download of allele frequency data download from allele frequencies.net.

Details

Estimates are combined by modelling allele frequency as a Dirichlet distribution which defines the probability of drawing each allele. When combining studies their estimates are weighted as 2x sample size by default. Sample size is doubled as each person in the study contributes two alleles. Alternative weightings can be used for example population size when averaging across countries.

When selecting a panel of HLA alleles to represent a population, allele frequency is not the only thing to consider. Depending on the purpose of the panel, you should include a range of loci and supertypes (groups alleles sharing binding specificies).

Install

pip install HLAfreq

Minimal example

Download HLA data using makeURL() and getAFdata(). All arguments that can be specified in the webpage form are available, see help(HLAfreq.makeURL) for details (press q to exit).

import HLAfreq
base_url = HLAfreq.makeURL("Uganda", locus="A")
aftab = HLAfreq.getAFdata(base_url)

After downloading the data, it must be filtered so that all studies sum to allele frequency 1 (within tolerence). Then we must ensure that all studies report alleles at the same resolution. Finaly we can combine frequency estimates.

aftab = HLAfreq.only_complete(aftab)
aftab = HLAfreq.decrease_resolution(aftab, 2)
caf = HLAfreq.combineAF(aftab)

Detailed examples

For more detailed walkthroughs see HLAfreq/examples.

Docs

For help on specific functions view the docstring, help(function_name). Full documentation API at HLAfreq/docs created with pdoc3 in pdf mode.

Citation

In prep.

Metadata

Release files for hlafreq 0.0.2

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

Source distribution (sdist)

Source distribution for hlafreq 0.0.2
File Size Uploaded Provenance
HLAfreq-0.0.2.tar.gz 20.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hlafreq 0.0.2
File Interpreter ABI Platform
HLAfreq-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 40.2 kB

Release files / HLAfreq-0.0.2.tar.gz

Download URL HLAfreq-0.0.2.tar.gz
Size 20.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e43d70a876a6a245ecc2d6117947c5e1f6bce5824738a4d86dfecbe6c53e07f7
BLAKE2b-256 checksum
How to use checksums
c5673d0bbb249d09af6f58e78ab08f42c1f8058e85c3a69aabf61273efd8646c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / HLAfreq-0.0.2-py3-none-any.whl

Download URL HLAfreq-0.0.2-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ad59afd48306059d25d65b1731b2e2582e98805ac5da4867583043f950f98aa
BLAKE2b-256 checksum
How to use checksums
c4d3c7cd6565749f494e7c7b01d61f23fbd9950e8fadf4b90806bc4f04abbea4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for hlafreq 0.0.2

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.

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