Skip to main content

CI PyPI Python versions Docs

mhcseqs

Self-contained pipeline for downloading, curating, and extracting binding grooves from MHC (Major Histocompatibility Complex) protein sequences. Given an allele name it returns the full protein sequence together with an explicit structural decomposition: signal peptide, groove domains, Ig-fold support domain, and tail.

In the openvax stack it is the sequence layer beside mhcgnomes, which it uses for allele parsing, species provenance and gene classification. No alignment tools, BLAST, or structure databases are required.

Install

pip install mhcseqs

Requires Python 3.11 or later. Runtime dependencies are mhcgnomes >= 3.100.0, pandas 3, datacache, biotite, and argcomplete.

Quick start

Install the prebuilt release catalog in seconds (or run mhcseqs.build() to rebuild from upstream IMGT/HLA and IPD-MHC FASTAs), then look alleles up:

import mhcseqs

mhcseqs.install_catalog()  # fast prebuilt release download; or mhcseqs.build()

r = mhcseqs.lookup("HLA-A*02:01")
print(r.allele, r.species_category, r.mhc_class, r.chain)
print("mature starts at", r.mature_start)
print("groove1", r.groove1)
print("architecture", r.domain_architecture)

# Fast cached O(1) catalog index for batch lookup, filtering, and pan-class alignment
catalog = mhcseqs.load_catalog()
hits = catalog.lookup_many(["HLA-A*02:01", "FLA-E*003:01", "B3F369"])
feats = catalog.pan_class_features("HLA-DRB1*01:01")  # auto-pairs with DRA*01:01
HomoSapiens-A*02:01 human I alpha
mature starts at 24
groove1 GSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRFDSDAASQRMEPRAPWIEQEGPEYWDGETRKVKAHSQTHRVDLGTLRGYYNQSEA
architecture signal_peptide>g_alpha1>g_alpha2>c1_alpha3>tail_linker>transmembrane>cytoplasmic_tail

lookup also takes IEDB-style mutations (mhcseqs.lookup("HLA-A*02:01", mutations=["K66A", "D77S"])), and load_sequences_dataframe() / load_sequences_dict() load the whole build at once. See the Python API guide.

Command line

mhcseqs data install catalog       # download prebuilt release CSVs (fast)
mhcseqs build                      # or build CSVs locally from IMGT/IPD FASTAs
mhcseqs lookup "HLA-A*02:01"       # print one allele's record
mhcseqs data list                  # cached downloads and built CSVs
mhcseqs data install mhc-proteins  # versioned UniProt record dataset

mhcseqs <command> --help lists every option; the command-line guide shows the output of each.

To enable shell tab completion across all OpenVax tools once:

activate-global-python-argcomplete

Or enable it for mhcseqs alone in the current shell:

eval "$(register-python-argcomplete mhcseqs)"

Documentation

Full documentation: pirl-unc.github.io/mhcseqs.

  • Command line: build, lookup, and the data subcommands
  • Python API: AlleleRecord fields, AlleleCatalog, Class II pair & pan-class helpers, allele and species utilities, module reference
  • Structural decomposition: the domain grammar, how the alignment-free parser scores a decomposition, groove status codes, literature basis
  • Pan-class IMGT alignment: unified 202-slot MHC-I / MHC-II IMGT coordinates, 46-slot NetMHCpan/NetMHCIIpan pocket union, insertion counts, and joint predictor design
  • Datasets and columns: what a build contains, column meanings, and the versioned mhc-proteins record layer

Development

git clone https://github.com/pirl-unc/mhcseqs.git
cd mhcseqs
./develop.sh          # uv pip install -e ".[dev]"
./test.sh             # pytest
./lint.sh             # ruff check and ruff format --check

To work on the documentation site:

pip install -e ".[docs]"
mkdocs serve
mkdocs build --strict

License

The mhcseqs code is licensed under Apache 2.0. The independently distributed UniProt-derived mhc-proteins data is licensed under CC BY 4.0 with attribution to the UniProt Consortium.

Metadata

Release files for mhcseqs 2.35.0

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

Source distribution (sdist)

Source distribution for mhcseqs 2.35.0
File Size Uploaded Provenance Actions
mhcseqs-2.35.0.tar.gz 1.6 MB Without provenance Details for mhcseqs-2.35.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mhcseqs 2.35.0
File Interpreter ABI Platform Actions
mhcseqs-2.35.0-py3-none-any.whl Python 3 none any Details for mhcseqs-2.35.0-py3-none-any.whl

Total release size: 3.1 MB

Release files / mhcseqs-2.35.0.tar.gz

Download URL mhcseqs-2.35.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
c534e4f28828c8b4faa5c388cac4fa4f00a75cc3ca8805858091b35d2e49af3b
BLAKE2b-256 checksum
How to use checksums
0aa563e00af9dd3129220b40804498e13369e0fadd557523645694a7cfc45cac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release files / mhcseqs-2.35.0-py3-none-any.whl

Download URL mhcseqs-2.35.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2ea4e46e87bf0f85b26892184eb16e50303630ee952acc1087d6b6012547cacd
BLAKE2b-256 checksum
How to use checksums
ec544d866ed019b2b90b0839207768a5d1f92c665912d847d005a0b0d1cc3d3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Security for mhcseqs 2.35.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.

Release history Release notifications | RSS feed

This release

2.35.0 This release

2 release files No provenance

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