PERCEPTRON-PTMKB v2

Tools

Integration

Access PTMKB programmatically: a token-protected REST API, a starter script and interactive API documentation.

1. Get a token

Create an account (no email needed) and PTMKB assigns you a personal API token, valid for 30 days. Send it in every request as Authorization: Bearer <token>. Each call counts against a daily allowance per user that resets at 00:00 UTC; calls above it get HTTP 429.

2. Tutorial script

A Python script with one function per endpoint and an interactive menu. Add your token (or set PTMKB_TOKEN) and run it.

3. Quick examples

Base URL: https://perceptronptmkb.lums.edu.pk/api/v2/ext

GET /ptmsmodification types in the database
GET /proteins/{acc}protein record
GET /proteins/{acc}/sitesmodification sites (optional ptm_type filter)
GET /ptm-tables/{ptm}/{aa}positional matrix, table=freq or log-e
GET /propensity/legacyLog Sum and Log-Log Product of a subsequence
GET /resid/{id}RESID database entry
GET /proteins/{acc}/propensity/profileSpatial propensity scores for every eligible residue, ptm=...

curl

curl -H "Authorization: Bearer $PTMKB_TOKEN" \
  "https://perceptronptmkb.lums.edu.pk/api/v2/ext/proteins/P04637/sites?ptm_type=Phosphorylation"

Python

import os, requests

BASE_URL = "https://perceptronptmkb.lums.edu.pk/api/v2/ext"
HEADERS = {"Authorization": f"Bearer {os.environ['PTMKB_TOKEN']}"}

# which modifications exist?
ptms = requests.get(f"{BASE_URL}/ptms", headers=HEADERS, timeout=30).json()

# Log Sum / Log-Log Product of a 21-residue window around a serine
r = requests.get(
    f"{BASE_URL}/propensity/legacy",
    params={"ptm": "Phosphorylation", "subsequence": "WKLLPENNVLSPLPSQAMDDW"},
    headers=HEADERS, timeout=30,
)
print(r.json())
Coming from PTMKB v1? The old endpoints still work at /ptmkb/api/* (get-ptm-details, get-protein-details, get-available-ptms, get-positional-frequency-matrix, calculate-propensity) with their v1 response shapes. They need a token and count against the same daily allowance. V1 tokens no longer work: reset yours on the profile page.

4. API reference

Interactive documentation of the token API. Use Try it out to send real requests; it counts against your allowance.