Search Shortcut cmd + k | ctrl + k

Read and write protein structure mmcif files using SQL

Maintainer(s): sverhoeven

Installing and Loading

INSTALL mmcif FROM community;
LOAD mmcif;

Example

-- single table
SELECT count(*) FROM mmcif_scan('https://files.rcsb.org/download/1AMB.cif.gz', 'atom_site');
-- 438

-- All tables in file
ATTACH 'https://files.rcsb.org/download/1AMB.cif.gz' AS mmcifdb (TYPE mmcif);
USE mmcifdb;

SELECT count(*) FROM information_schema.tables WHERE table_catalog = 'mmcifdb';
-- 43

SELECT count(*) FROM atom_site;
-- 438

-- Positions of Zinc atoms
SELECT Cartn_x, Cartn_y, Cartn_z FROM atom_site WHERE type_symbol = 'ZN';

-- Write mode
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;   -- writes the mutated tables back to the attached file

Added Functions

function_name function_type description comment examples
mmcif_columns table List the categories and columns in an mmCIF file, with their dictionary documentation links and inferred types. NULL [SELECT * FROM mmcif_columns('https://files.rcsb.org/download/1AMB.cif.gz'); – 342 rows]
mmcif_relationships table List the parent/child key relationships between the categories in an mmCIF file, each side as a (table, column) pair. NULL [SELECT * FROM mmcif_relationships('https://files.rcsb.org/download/1AMB.cif.gz'); – 86 rows]
mmcif_scan table Scan one mmCIF category as a table, reading its rows directly from a .cif or .cif.gz file. NULL [SELECT * FROM mmcif_scan('https://files.rcsb.org/download/1AMB.cif.gz', 'atom_site'); – 438 rows]
mmcif_tables table List the categories in an mmCIF file with their dictionary documentation links and column counts. NULL [SELECT * FROM mmcif_tables('https://files.rcsb.org/download/1AMB.cif.gz');]

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

This extension does not add any settings.