Skip to main content
Ctrl K

duckdb-mmcif

Read/write protein structure mmCIF files using SQL with DuckDB

1
contributor
Get started
301 commitsLast commit ≈ 3 days ago0 stars0 forks

Description

Query mmCIF (PDBx) structural-biology files with SQL, right inside DuckDB.

ATTACH a .cif file and every mmCIF category shows up as a normal DuckDB table — with column types inferred from the PDBx/mmCIF dictionary. No ETL, no schema design, no Python parsing loop: just SQL over macromolecular structure data.

LOAD 'mmcif.duckdb_extension';

-- Read only
ATTACH 'https://files.rcsb.org/download/1AMB.cif.gz' AS mmcifdb (TYPE mmcif);

SELECT count(*) FROM mmcifdb.atom_site;

-- Write
ATTACH '1amb_updated.cif' AS wdb (TYPE mmcif, READ_WRITE TRUE);
USE wdb;

BEGIN;
INSERT INTO atom_site (label_atom_id, Cartn_x, type_symbol) VALUES ('O1', 3.5, 'O');
UPDATE atom_site SET type_symbol='ZZ' WHERE label_atom_id='O1';
DELETE FROM atom_site WHERE label_atom_id='O1';
COMMIT;   -- updates 1amb_updated.cif file
Keywords
Programming languages
  • C++ 84%
  • Python 11%
  • Shell 3%
  • CMake 2%
License
</>Source code

Participating organisations

Netherlands eScience Center

Contributors

Related projects

Protein Detective

A software for AI-driven identification of unknown proteins in cryo-EM density maps

Updated 9 months ago
In progress

Related software

pdb2sql

PD

Fast and versatile Python package that leverages SQL queries to parse, manipulate and process biomolecular structure files. The structure files should be in the PDB format and are available on www.rcsb.org.

Updated 50 months ago
9 2