Skip to main content

MHC-I anchor position predictor using allele-specific PWMs

Project description

AnchorMiner — MHC-I Anchor Position Predictor

Anchor residues are amino acids within a peptide that form direct contacts with the MHC-I binding groove. They serve a structural docking function rather than defining T cell recognition, making their identification useful for immunogenicity modeling, epitope masking, and feature engineering in machine learning pipelines.

AnchorMiner identifies canonical and non-canonical anchor positions for a given peptide and MHC-I allele using allele-specific Position Weight Matrices (PWMs) built from NetMHCpan-4.2 predictions on a 600,000-peptide background sampled from the human SwissProt proteome.

For a detailed description of the method and usage examples, see notebooks/Demo.ipynb.


Requirements

See requirements.txt. Install with:

pip install -r requirements.txt

Quick Start

from src.predict_anchors import predict_anchors

# Without visualization
result = predict_anchors('KILDGVFAV', 'HLA-A02:01', viz=False)

# With visualization — generates KL plot and sequence logo
result = predict_anchors('KILDGVFAV', 'HLA-A02:01', viz=True)

# Access results
print(result['coords'])   # anchor position indices (0-indexed)
print(result['verbose'])  # per-position details

Output: dict with keys:

  • coords — list of anchor position indices (0-indexed)
  • verbose — list of dicts per anchor position with KL divergence, canonical/non-canonical classification, biochemical cluster, cumulative cluster frequency, and current amino acid
  • KL — KL divergence plot (only if viz=True)
  • logo — sequence logo with anchor positions highlighted in red (canonical) or blue (non-canonical) (only if viz=True)

Repository Structure

AnchorMiner/
├── src/
│   ├── AnchorMiner.py          # Core class
│   ├── predict_anchors.py      # Wrapper function
│   └── standartize_hlas.py     # HLA normalization utility
├── datasets/
│   ├── PWM/                    # Precomputed PWM matrices (.npy)
│   ├── PPM/                    # Precomputed PPM matrices (.npy)
│   ├── KL/                     # Precomputed KL divergence vectors (.npy)
│   └── AnchorMiner_supported_alleles.csv
├── notebooks/
│   ├── Demo.ipynb              # Tutorial and usage examples
│   ├── Testing.ipynb           # Sanity checks and structural validation
│   └── AnchorMiner_DevelopmentNotebook.ipynb
├── requirements.txt
└── README.md

Supported Alleles and Peptide Lengths

146 MHC-I alleles covering 92% of worldwide population. Peptide lengths 9–12. Visit datasets/Anchor_Miner_supportedalleles.csv to get a dataframe of allowed HLAs and lengths.


Notes

  • Homo sapiens HLA allele format: HLA-X##:## e.g. HLA-A02:01. Use src/standartize_hlas.normalize_allele() to normalize non-standard inputs. Only MHCI alleles are currently supported
  • Mus Musculus MHC format: H:2:Kd.

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

anchorminer-0.1.1.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

anchorminer-0.1.1-py3-none-any.whl (2.3 MB view details)

Uploaded Python 3

File details

Details for the file anchorminer-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for anchorminer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2a2f2db7f7f4f13581027ddf8b991c742f0e1e3c9b9572084dcba40a5d35fc70
MD5 66ce6469bdad476aee25d4faf079d4c5
BLAKE2b-256 40889f94b99da28f9e1b1f83db0ce825c9d78145f1625d739c51e1776f784f73

See more details on using hashes here.

File details

Details for the file anchorminer-0.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for anchorminer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e661592e24219472eca0adcc4a9fdc766941f026837e71f2324978f6f594870
MD5 64eb02d95288fd23028b97ff696c16e3
BLAKE2b-256 29ed902b80c603f54a9c4994d146a1139fb0b4e8eba124620bf204c17f2d69b7

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