MaskNGly
Predict N-glycosylation sites with a mask-and-probe strategy from ESM-2 embeddings.
From sequence to glycosylation propensity
MaskNGly probes contextual coupling within protein language model embeddings to identify potential N-glycosylation sites. No supervised glycosylation training or labeled glycosylation dataset is required: the method reads signals from pretrained ESM-2 embeddings for cross-species, omics-scale analysis.
- Training-free readout
- Independent of labeled glycosylation data
- Omics-scale
- Cross-species

Find candidate sites
Enter a UniProt accession to retrieve its protein sequence, or paste a sequence directly. MaskNGly scans for N-X-S/T sequons, where X is any residue except proline and N is the candidate attachment site.
Each candidate is recorded by its residue position and local sequence context. When a matching AlphaFold model is available, these positions are mapped onto the structure for exploration.
Mask and score
Mask N at i and S/T at j = i + 2 separately. Measure the ESM-2 embedding change relative to the unmasked protein at the partner residue as Cij = ‖Ej(mask i) − Ej‖2.
Min–max normalize each response across the full sequence to obtain Cij and Cji. The GP score averages these two directional couplings: GP = (Cij + Cji)/2. This paired readout measures how strongly the two sequon residues depend on one another in their sequence context.
Predict and explore
Apply the 0.5 operating threshold: scores ≥ 0.5 are positive and scores < 0.5 are negative. Select a candidate to inspect its GP score, surrounding sequence, and position in the protein structure.
Rotate the model or show its surface to explore structural context. UniProt experimental evidence and publication links distinguish predicted candidates from sites supported by published experiments.
Across species, at omics scale
Explore all 48 species
Immunoglobulin gamma-1 heavy chain
Download
Download each dataset as a ZIP archive containing its CSV files.
Run MaskNGly locally
MaskNGly measures ESM-2 embedding changes after masking individual residues and scores N-X-S/T candidate sites.
Setup
If uv is not installed, run curl -LsSf https://astral.sh/uv/install.sh | sh on macOS/Linux; see the installation guide for other platforms.
Requires Python 3.11 or 3.12. The esm2_t33_650M_UR50D weights are downloaded on first use. Use --device cuda when CUDA is available.
uv sync --extra inference --extra plot --extra evaluationUsage
The example contains the 193-residue human erythropoietin precursor (UniProt P01588, sequence version 1). Candidate sites are detected at positions 51, 65, and 110 using full precursor numbering.
uv run maskngly --input examples/P01588.fasta --output outputs/scores.csvEach run computes influence matrices and writes site scores to the CSV. Add --save-npy to retain the matrices and --save-png to export a profile for each candidate site:
uv run maskngly --input examples/P01588.fasta --output outputs/scores.csv --save-npy --save-pngWith this output path, matrices are saved under outputs/scores/matrices/ and profiles under outputs/scores/profiles/. Profile axes use 1-based protein positions. --radius controls the profile window (default: 50 residues).
FASTA headers may specify candidate N positions as Sites: 51,65,110; otherwise N-X-S/T sites are detected automatically. Sequences over 1,022 residues use a model-sized window around each candidate site. CSV columns include the protein ID, position, motif, score, prediction, and window start.
Scores use the S/T-mask response at N, min–max normalized across the full row, and predict positive above --threshold 0.5. --mode paired averages both directional responses. Scores measure embedding influence. --batch-size defaults to 8; --device defaults to cpu.
Add --labels labels.csv to write fixed-threshold and Youden-threshold metrics to outputs/scores_evaluation.csv. Labels use protein_id,position,label with both binary classes present. Validate tuned thresholds on a separate dataset.
Run uv run maskngly --help for all options and uv build to build distribution archives.
Source repository: NJUBiophysics/maskngly on GitHub ↗