Python library for the PSI-MOD protein modification ontology
Project description
psimodpy
Python library for parsing and querying the PSI-MOD protein modification ontology.
- Zero dependencies
- Bundled PSI-MOD data (2,116 entries) — works offline out of the box
- Typed, immutable data models (
py.typed/ PEP 561)
Installation
pip install psimodpy
Or with uv:
uv add psimodpy
Requires Python 3.12+. No third-party dependencies.
Quick Start
import psimodpy
# Load the bundled PSI-MOD database
db = psimodpy.load()
# Lookup by ID
entry = db[46] # O-phospho-L-serine
print(entry.name) # "O-phospho-L-serine"
print(entry.diff_mono) # 79.966331
print(entry.origin) # AminoAcid.SER
# Lookup by name (case-insensitive)
entry = db.get_by_name("O-phospho-L-serine")
# Also accepts MOD:NNNNN format
entry = db.get_by_id("MOD:00046")
# Search across names, definitions, and synonyms
results = db.search("phospho")
# Find all modifications for an amino acid
ser_mods = db.get_by_origin("S")
# Filter entries
slim = db.filter(slim_only=True, include_obsolete=False)
# Formula parsing
print(entry.dict_diff_formula) # {'C': 0, 'H': 0, 'N': 0, 'O': 3, 'P': 1}
print(entry.proforma_diff_formula) # 'O3P'
API Overview
Loading
| Function | Description |
|---|---|
psimodpy.load() |
Load the bundled PSI-MOD database. |
psimodpy.load_from(path) |
Load from a custom OBO file. |
psimodpy.parse_obo(path) |
Parse an OBO file into a database. |
psimodpy.download_obo() |
Download the latest OBO file from GitHub. |
PsiModDatabase
| Method | Description |
|---|---|
db[id] |
Lookup by ID (int or "MOD:00046"), raises KeyError. |
db.get_by_id(id) |
Lookup by ID, returns None if missing. |
db.get_by_name(name) |
Case-insensitive name lookup. |
db.search(query) |
Full-text search in names, definitions, synonyms. |
db.get_by_origin(aa) |
Find entries by amino acid origin. |
db.get_parents(entry) |
Direct parent entries (is_a hierarchy). |
db.get_children(entry) |
Direct child entries. |
db.get_related(entry, type) |
Follow relationship edges (derives_from, contains, etc.). |
db.filter(...) |
Filter by obsolete/slim status. |
PsiModEntry
Each entry provides: id, name, definition, synonyms, is_a, relationships,
origin, diff_mono, diff_avg, diff_formula, mass_mono, mass_avg, formula,
term_spec, source, formal_charge, xref_unimod, xref_uniprot_ptm, xref_gnome,
xref_remap, in_slim_subset, is_obsolete.
Computed properties: dict_diff_formula, dict_formula, proforma_diff_formula.
Data Types
AminoAcid— single-letter amino acid codesCrosslink— multi-residue or MOD-referenced originsSynonym/SynonymType— typed synonymsRelationship/RelationshipType— directed relationshipsTermSpec— positional specificitySource— modification origin
Development
just install # install dependencies with uv
just lint # ruff check
just format # ruff format
just ty # ty type check
just test # pytest
just check # lint + type check + test
Related Projects
| Package | Description |
|---|---|
| unimodpy | Parse and query the UNIMOD mass spectrometry modifications database |
| uniprotptmpy | Parse and query the UniProt PTM controlled vocabulary |
License
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 psimodpy-0.1.0.tar.gz.
File metadata
- Download URL: psimodpy-0.1.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25940b659f8cb902aa503d4025c3773044e2474b2f5908a103e35c9725dc2794
|
|
| MD5 |
c071dcb0b900dc41e39a37a6304aecf5
|
|
| BLAKE2b-256 |
e0e778693347fc7beb6d8fa2ace2d23ba2fb953eb15412458200a5aa57eac907
|
Provenance
The following attestation bundles were made for psimodpy-0.1.0.tar.gz:
Publisher:
release.yml on tacular-omics/psimodpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psimodpy-0.1.0.tar.gz -
Subject digest:
25940b659f8cb902aa503d4025c3773044e2474b2f5908a103e35c9725dc2794 - Sigstore transparency entry: 1189509135
- Sigstore integration time:
-
Permalink:
tacular-omics/psimodpy@add36627b81ae5cf327291da050662327b9777f4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tacular-omics
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@add36627b81ae5cf327291da050662327b9777f4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file psimodpy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: psimodpy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95073f5903c28d3fb93e2dfdd9db07cddefb793a7c170571803b711687eeb243
|
|
| MD5 |
ccd02d57a67aecd42daea8a06f697ce7
|
|
| BLAKE2b-256 |
760c32fe28a937b40c4e3b294422151a8b064c361adbe55f78eefa025df984e3
|
Provenance
The following attestation bundles were made for psimodpy-0.1.0-py3-none-any.whl:
Publisher:
release.yml on tacular-omics/psimodpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psimodpy-0.1.0-py3-none-any.whl -
Subject digest:
95073f5903c28d3fb93e2dfdd9db07cddefb793a7c170571803b711687eeb243 - Sigstore transparency entry: 1189509136
- Sigstore integration time:
-
Permalink:
tacular-omics/psimodpy@add36627b81ae5cf327291da050662327b9777f4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tacular-omics
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@add36627b81ae5cf327291da050662327b9777f4 -
Trigger Event:
release
-
Statement type: