gemmi
library for structural biology
What it is and what it does
Gemmi is a C++ library designed for structural biology and crystallography, providing Python bindings to read, write, and manipulate macromolecular models, crystallographic reflections, electron density maps, and CIF/STAR files. It handles data from PDB, mmCIF, mmJSON, MTZ, and MRC/CCP4 formats, and includes support for crystallographic symmetries and refinement restraints. The library is developed by CCP4 and Global Phasing Ltd, two established providers of crystallography software.
The package is distributed as precompiled wheels for common platforms, reducing installation friction for most users. It has no runtime dependencies beyond Python itself, making it straightforward to integrate into existing workflows. The project is actively maintained, with recent commits and no known security vulnerabilities, making it a stable choice for structural biology applications.
Use it for:
- Parse and manipulate protein structures from PDB or mmCIF files in structural biology pipelines
- Extract and analyze crystallographic symmetry information for structure validation
- Read and process crystallographic reflection data (MTZ files) in refinement workflows
- Convert between structural file formats (PDB, mmCIF, mmJSON) in data preparation
- Access electron density maps and other volumetric data for visualization or analysis
- Build command-line tools for batch processing of macromolecular structures
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Gemmi is a C++ library with Python bindings for reading, writing, and manipulating macromolecular structural data (PDB, mmCIF, MTZ files) and crystallographic information, including symmetries, density maps, and refinement restraints.
Yes, if you work with macromolecular structures or crystallographic data. Gemmi is actively maintained, has no known vulnerabilities, and offers precompiled wheels for common platforms. The copyleft license (MPL-2.0 or LGPLv3) is standard in academic software but requires attention if you plan to redistribute derivative works. Medium install friction is typical for C++ bindings and not a barrier for most workflows.
Install
gemmi on PyPI
pip
pip install gemmiuv
uv add gemmipoetry
poetry add gemmiInstalling gemmi
Before you install
Medium install friction due to compiled C++ bindings, but wheels are provided for current Python versions across macOS, Linux, and Windows. Repository is active with recent commits and no known vulnerabilities.
License in practice
Licensed under MPL-2.0 (copyleft), or LGPLv3 at your option. Copyleft terms require derivative works to be distributed under compatible licenses; choose LGPLv3 if that constraint is problematic for your use case.
Quickstart
pip install gemmi
import gemmi
# Read a PDB file
doc = gemmi.read_pdb('structure.pdb')
model = doc[0]
for chain in model:
for residue in chain:
print(residue.name)
Requires Python >=3.9. Compiled wheels available for common platforms; source build requires a C++14 compiler.
Verify before relying
- Whether the library's command-line tools are accessible after pip install or require separate installation
- Performance characteristics for large structures or batch processing workflows
- Maturity level of the Fortran interface and WebAssembly bindings mentioned in the description
- Which specific Python versions are covered by the precompiled wheels beyond the friction evidence shown
Package facts
| License | MPL-2.0 (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 165 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,120,899/month — #4,337 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gemmi-0.7.5-cp310-cp310-macosx_10_14_x86_64.whl; gemmi-0.7.5-cp310-cp310-macosx_11_0_arm64.whl; gemmi-0.7.5-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; gemmi-0.7.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; gemmi-0.7.5-cp310-cp310-win_amd64.whl; gemmi-0.7.5-cp311-cp311-macosx_10_14_x86_64.whl; gemmi-0.7.5-cp311-cp311-macosx_11_0_arm64.whl; gemmi-0.7.5-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; gemmi-0.7.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; gemmi-0.7.5-cp311-cp311-musllinux_1_2_aarch64.whl; gemmi-0.7.5-cp311-cp311-musllinux_1_2_x86_64.whl; gemmi-0.7.5-cp311-cp311-win_amd64.whl; gemmi-0.7.5-cp312-cp312-macosx_10_14_x86_64.whl; gemmi-0.7.5-cp312-cp312-macosx_11_0_arm64.whl; gemmi-0.7.5-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; gemmi-0.7.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; gemmi-0.7.5-cp312-cp312-musllinux_1_2_aarch64.whl; gemmi-0.7.5-cp312-cp312-musllinux_1_2_x86_64.whl; gemmi-0.7.5-cp312-cp312-win_amd64.whl; gemmi-0.7.5-cp313-cp313-macosx_10_14_x86_64.whl
Keywords: structural bioinformatics, structural biology, crystallography, CIF, mmCIF, PDB, CCP4, MTZ
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
mmcifProvides native Python and C++ bindings to…
permissive · top 5,000 on PyPI
mmtf-pythonDecodes and encodes the macromolecular…
permissive · top 15,000 on PyPI
mmcif-pdbxProvides a pure Python interface to read,…
permissive · top 15,000 on PyPI
spglibspglib provides Python bindings to a C library…
permissive · top 5,000 on PyPI
ihmReads and writes mmCIF and BinaryCIF files…
permissive · top 15,000 on PyPI
modelcifReads and writes mmCIF and BinaryCIF files…
permissive · top 15,000 on PyPI
moyopyMoyopy is a Python binding for Moyo, a crystal…
permissive · top 15,000 on PyPI
python-libsbmlProvides Python bindings to read, write, and…
copyleft · top 15,000 on PyPI
pdbeccdutilsParse and process small molecule definitions…
permissive · top 15,000 on PyPI
mrcfilemrcfile reads and writes MRC2014 format files…
permissive · top 15,000 on PyPI