Pure Python Q-score implementation that reproduces MapQ (Pintilie et al., Nature Methods 2020) without requiring UCSF Chimera.
Validated against MapQ on 28 EMDB entries (1.84–4.2 Å resolution):
| Metric | Value |
|---|---|
| Mean difference | +0.0002 |
| Max | difference |
| Pearson r | 0.999997 |
| Entries within ±0.1% | 28/28 |
Full comparison: qscore-validation
pip install -e .# Command line
python -m qscore_mapq model.cif map.mrc --sigma 0.4 --verbose
# Python API
from qscore_mapq import compute_qscores, read_structure, read_map
coords, is_water, _, _ = read_structure("model.cif")
grid, origin, voxel_size = read_map("map.mrc")
result = compute_qscores(coords, grid, origin, voxel_size, is_water=is_water)
print(f"Q = {result.q_mean:.4f}")Matches MapQ exactly (verified against gregdp/mapq/qscores.py):
- Saff-Kuijlaars spiral for deterministic sphere sampling
- 0.9×R neighbor exclusion threshold
- Retry loop (50 attempts, +2 points each)
- All valid points from successful attempt kept
- Pearson correlation without epsilon stabilization
- All non-H, non-water atoms included
Pintilie et al. (2020). Measurement of atom resolvability in cryo-EM maps with Q-scores. Nature Methods, 17(3), 328–334.