Cluster immunopeptidomics peptides by HLA/MHC binding motif, with an interactive HTML report
Project description
MHC-TP
Cluster immunopeptidomics peptides by their HLA/MHC binding motif and get a ranked table plus a standalone interactive HTML report.
mhc-tp takes a GibbsCluster output folder, correlates each cluster's
position-specific scoring matrix against a reference of HLA/MHC class I + II
binding motifs (human & mouse), and writes the best allele match per cluster.
For users
Requirements: Python 3.9–3.11.
1. Install
Clone the repo and install it (editable, so git pull updates the tool):
git clone https://github.com/PurcellLab/MHC-TP.git
cd MHC-TP
pip install -e .
Prefer a one-liner without cloning?
pip install git+https://github.com/PurcellLab/MHC-TP.gitA virtual environment (python -m venv .venv && source .venv/bin/activate) is recommended.
2. Download the reference data (once)
The reference motifs are fetched from the GitHub release, not bundled:
mhc-tp fetch -s human # or: mouse | all
3. Run a search
mhc-tp search <gibbscluster_output_dir> -s human -o results/
<gibbscluster_output_dir> is a GibbsCluster run folder (it must contain a
matrices/ subdirectory).
Outputs land in results/clust_result/:
| file | what it is |
|---|---|
correlations.csv |
every cluster→allele match above the threshold (hla = display name, formatted = raw key, correlation = PCC) |
mhc-tp-result.html |
standalone report — open it in any browser |
Common options
| flag | meaning | default |
|---|---|---|
-s, --species |
human or mouse |
human |
-r, --reference |
path to a <species>.parquet (otherwise the fetched one is used) |
auto |
-t, --threshold |
minimum Pearson correlation to report | 0.70 |
-o, --output |
output directory | output |
--threads |
max CPU threads (also $MHC_TP_THREADS) |
4 |
--no-html |
write only the CSV | off |
-l, --log |
also save the coloured session log | off |
Run mhc-tp search --help for the full list.
For contributors / developers
The project uses pixi for a reproducible dev environment
(Python 3.11) and a src/ layout packaged with hatchling.
git clone https://github.com/PurcellLab/MHC-TP.git
cd MHC-TP
pixi install # create the dev env from pixi.lock
pixi run dev-install # editable-install the package into the env (run once)
pixi run test # pytest
pixi run lint # ruff
pixi run fmt # black
Always run via pixi run … — a bare python may pick up a different
interpreter without the pinned dependencies.
Rebuilding the reference data (dev only)
End users never do this. The per-species parquets are built once from the
NetMHCpan / NetMHCIIpan packs and uploaded to the release. Embedding the
Seq2Logo reference logos (--with-logos) needs a separate Python 2.7 env and
is slow — run it on a cluster:
mhc-tp build-ref <species> <classI_pack> <classII_pack> <out.parquet> \
--with-logos --workers 16
# Seq2Logo itself runs in its own env: pixi run -e seq2logo ...
Layout
src/mhc_tp/
cli.py entry point (mhc-tp)
engine/ numba correlation search
refdata/ reference parquet read/write, fetch, schema
report/ HTML report rendering (data, logos, templates)
db/ DEV-ONLY reference-pack ingestion
tui/ Rich console banner, logging, results table
tests/ pytest suite
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mhc_tp-2.0.1.tar.gz.
File metadata
- Download URL: mhc_tp-2.0.1.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
026f9c978357e76eb626f43e1658ccd0e62db4a4cf020bd14b81493bd7a86881
|
|
| MD5 |
13987f72b5f82b1a9e7215020f514aee
|
|
| BLAKE2b-256 |
4e5f6928023e9b0c0b1d08a32cc66e3219f51c890c52e2a23e65e27f68c0ba15
|
File details
Details for the file mhc_tp-2.0.1-py3-none-any.whl.
File metadata
- Download URL: mhc_tp-2.0.1-py3-none-any.whl
- Upload date:
- Size: 42.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57e401d39e6f14cc5b431e8a19a8228dd7abd70c0a37e05e5e7982f188c959f4
|
|
| MD5 |
4612caa6be75bfe82e976f111c935754
|
|
| BLAKE2b-256 |
a090ee5ed6e2df6904bf0802b27637727019c65fcbcba767c317791e18a6b078
|