# mmcif-tools > 54 small command-line tools that select, delete, edit, convert and inspect mmCIF (PDBx/mmCIF) files, chained with Unix pipes, in the style of pdb-tools. Python 3.9 or newer, standard library only: `python -m pip install mmcif-tools`. Version 0.4.1. Each tool is a command, `mmcif_`, that reads one mmCIF file (or standard input) and writes to standard output. `mmcif-tools` lists the tools, `mmcif_ --help` prints the usage of one, and `mmcif-tools skill` prints instructions for AI agents. Every edit keeps the other tables of the file (sequences, entities, links, assemblies) in step with the atoms. This file holds the documentation of mmcif-tools, as on https://matteo-cagiada.github.io/mmcif-tools/docs/, in one plain-text file. # mmcif-tools [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23966235.svg)](https://doi.org/10.5281/zenodo.23966235) ### [matteo-cagiada.github.io/mmcif-tools](https://matteo-cagiada.github.io/mmcif-tools/) Run the tools [in your browser](https://matteo-cagiada.github.io/mmcif-tools/app/), with nothing to install, or read the [documentation](https://matteo-cagiada.github.io/mmcif-tools/docs/). mmcif-tools is an independent project whose style and much of its tool set are inspired by [pdb-tools](https://www.bonvinlab.org/pdb-tools/) (Rodrigues JPGLM, Teixeira JMC, Trellet M and Bonvin AMJJ, *F1000Research* 2018, 7:1961). mmcif-tools ports and expands the pdb-tools functionality to the mmCIF (PDBx/mmCIF) format. As pdb-tools, it is a set of small, single-purpose command-line tools that read and write mmCIF files and chain together with Unix pipes: select, delete, edit, convert and inspect structures without leaving the shell. The package needs only the Python standard library (Python 3.9 or newer). ```bash mmcif_fetch 1brs | mmcif_selchain -A,D | mmcif_delentity -non-polymer,water | mmcif_reres -1 > clean.cif ``` **CURRENT VERSION: Version 0.4.1, pre-release: 54 available tools** ## Tools mmcif-tools reads the mmCIF text format, as written by the PDB (wwPDB, RCSB, PDBe), the AlphaFold DB (ModelCIF), structure prediction and modelling programs and viewers, plain or gzip-compressed. BinaryCIF is currently not supported. The full `--help` text of every tool is in the [tool reference](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/). | Group | Tool | What it does | |---|---|---| | Fetch / convert | `mmcif_fetch` | Download an entry from the RCSB (or `-biounit`), or an AlphaFold DB model (`AF-P69905-F1`) | | | `mmcif_topdb` / `mmcif_frompdb` | Convert to / from the PDB format (`mmcif_frompdb` assigns label identifiers) | | Select / delete | `mmcif_selchain` / `mmcif_delchain` | Keep / remove chains (`-A,B`) | | | `mmcif_selres` / `mmcif_delres` | Keep / remove residues by number (`-1:10,20:30`, `-::5`) | | | `mmcif_selresname` / `mmcif_delresname` | Keep / remove residues by name (`-HOH`) | | | `mmcif_selatom` | Keep atoms by name (`-CA,C,N,O`) | | | `mmcif_selelem` / `mmcif_delelem` | Keep / remove atoms by element (`-C,N`, `-H`) | | | `mmcif_selentity` / `mmcif_delentity` | Keep / remove entities by number or type (`-polymer`, `-non-polymer,water`) | | | `mmcif_selhetatm` / `mmcif_delhetatm` | Keep / remove HETATM records (ligands, ions, waters, and modified residues) | | | `mmcif_selaltloc` | Keep one alternate location (highest occupancy, or `-A`) | | | `mmcif_selmodel` | Keep models (`-1,3`) | | | `mmcif_head` | Keep the first N atoms (`-100`) | | | `mmcif_delmeta` | Delete the metadata that prediction and simulation programs do not read; keep the rest (entry, method, entities, chains, ...) in step with the atoms (`-all`: atoms only) | | | `mmcif_keepcoord` | Keep only the coordinates (`_atom_site`, `_struct_conn`), as `pdb_keepcoord` | | | `mmcif_intersect` | Keep the atoms of the first file found in all the others | | Edit | `mmcif_chain` / `mmcif_rplchain` | Set all chains (`-C`) / rename one chain (`-A:B`) | | | `mmcif_reres` / `mmcif_shiftres` | Renumber residues from a number / shift them by a number | | | `mmcif_fixinsert` (`mmcif_delinsertion`) | Remove insertion codes, shifting the numbering | | | `mmcif_reatom` | Renumber atom ids | | | `mmcif_rplresname` | Rename a residue type (`-HIP:HIS`) | | | `mmcif_uniqname` | Rename ligand atoms C1, C2, O1, … | | | `mmcif_element` | Assign elements from atom names (`-all` to redo all) | | | `mmcif_b` / `mmcif_occ` | Set B-factors / occupancies | | Identifiers | `mmcif_label2auth` | Copy label chains and residue numbers onto the author ones (`-chain`, `-res`) | | | `mmcif_auth2label` | Copy author chains onto the label chains of polymers | | Models, files, assemblies | `mmcif_splitchain` / `mmcif_splitmodel` | Write one file per chain / model | | | `mmcif_mkensemble` / `mmcif_chkensemble` | Build a multi-model file / check its models match | | | `mmcif_merge` | Merge the atoms of several files into one | | | `mmcif_assembly` | Build a biological assembly from the file's symmetry operations (`-1`) | | Categories / blocks | `mmcif_cat` | Print one category as a table (TSV): `-_atom_site.id,Cartn_x` | | | `mmcif_delcat` / `mmcif_keepcat` | Remove / keep whole categories (`-_struct_conf`, `'-_pdbx_validate*'`) | | | `mmcif_rebuildmeta` | Add the core tables a file lacks (entities, chains, sequences, residue types), built from the atoms | | | `mmcif_blocks` | List the data blocks, or extract some (`-ATP`) | | Inspect / format | `mmcif_info` | Title, method, resolution, organisms, entities, assemblies | | | `mmcif_wc` | Counts: models, chains, residues, atoms, … | | | `mmcif_tofasta` | Sequence in FASTA format; one record per chain with `-multi,seqres` | | | `mmcif_gap` | Report chain breaks | | | `mmcif_sort` | Sort atoms by chain and residue | | | `mmcif_tidy` | Rewrite in a uniform, aligned layout | | | `mmcif_validate` | Check syntax, coordinates and consistency | # Installation ```bash python -m pip install mmcif-tools ``` There are no runtime dependencies. For tab completion of the `mmcif_*` commands, open a new terminal after installing (or run `rehash` in an open zsh terminal). `mmcif-tools` then lists the tools, with one line each, and `mmcif_ --help` prints a tool's usage and examples. The extra tools below are in the repository, not in the package. To install from the repository instead, `python tools/smoke_test.py` then checks the installation: every command runs, and a few pipelines give the expected results. ```bash git clone https://github.com/matteo-cagiada/mmcif-tools.git cd mmcif-tools python -m pip install . python tools/smoke_test.py ``` ## Running the tests The unit tests are in `tests/` and, like the tools, need only the standard library. They check the exact output of each tool on small files written for specific cases (`tests/data/`), the error messages and the exit status, and they test the code of the clone they are in, installed or not. From the root of the repository: ```bash python -m unittest discover -s tests ``` Two sets of tests are skipped unless you add what they need. The tests on 12 real entries (about 10 MB, from the RCSB and the AlphaFold DB; see `tests/real_set.txt`) need the entries, which `tests/fetch_real.py` downloads into `tests/real/`. The comparison with pdb-tools needs pdb-tools (`python -m pip install pdb-tools`): it converts each structure (the small files, and the real entries once downloaded) to the PDB format, runs each ported tool on both formats with the same command line, and compares the atoms. ```bash python tests/fetch_real.py python -m pip install pdb-tools python -m unittest discover -s tests ``` ## Extra tools `tools/` holds scripts that are not part of mmcif-tools and are not installed with it. - **`tools/check_with_gemmi.py`** checks CIF files with [gemmi](https://github.com/project-gemmi/gemmi), an independent CIF reader: the syntax, and optionally a dictionary such as the PDBx/mmCIF one (`--dict`). It runs the gemmi program, which you install yourself (e.g. `pip install gemmi-program`); give its path with `--gemmi` if it is not on the PATH: ```bash python tools/check_with_gemmi.py --gemmi /path/to/gemmi out.cif mmcif_selchain -A 1abc.cif | python tools/check_with_gemmi.py --dict mmcif_pdbx_v50.dic - ``` - **`tools/make_docs.py`** writes the [tool reference](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/) and the other pages of the [documentation](https://matteo-cagiada.github.io/mmcif-tools/docs/). - **`tools/smoke_test.py`** checks an installation (see [Installation](https://matteo-cagiada.github.io/mmcif-tools/docs/installation/)). # Usage examples and tips ## Command examples ```bash # A clean protein for docking or simulations: one conformer, no ligands or waters, an aligned layout mmcif_fetch 4hhb | mmcif_selaltloc | mmcif_delentity -non-polymer,water | mmcif_tidy > 4hhb_protein.cif # Chain A with its heme, numbered from 1, as a PDB file for programs that need one mmcif_fetch 4hhb | mmcif_selchain -A | mmcif_delentity -water | mmcif_reres -1 | mmcif_topdb > 4hhb_A.pdb # The biological assembly, built from the symmetry operations in the file (chains A, A-2, A-3, A-4) mmcif_fetch 1stp | mmcif_assembly > 1stp_tetramer.cif # What an entry holds: method, resolution, organisms, entities, assemblies (and the pLDDT of AlphaFold models) mmcif_fetch 4hhb | mmcif_info mmcif_fetch AF-P69905-F1 | mmcif_info # The sequences, one FASTA record per chain (the deposited sequences: no ligands or waters) mmcif_tofasta -multi,seqres 4hhb.cif > 4hhb.fasta # A model written by another program (atoms only): add its entities, chains, sequences and residue types mmcif_rebuildmeta model.cif > model_described.cif # A table of atoms for awk, R or pandas (tab-separated, one header line) mmcif_cat -_atom_site.auth_asym_id,auth_seq_id,label_comp_id,B_iso_or_equiv 4hhb.cif > atoms.tsv # Residues numbered along the deposited sequence, and one author chain per molecule mmcif_label2auth 4hhb.cif > 4hhb_by_sequence.cif # Delete only some categories: here the PDB's validation reports and secondary structure mmcif_delcat '-_pdbx_validate*,_struct_conf,_struct_sheet_range' 4hhb.cif > 4hhb_lean.cif ``` ## Tips - Each tool takes at most one option (starting with `-`) and one file, and reads stdin when no file is given, so tools chain with pipes. Negative numbers need a double dash (`mmcif_shiftres --5`). - `--help` prints a tool's usage (not `-h`, which is a real option of some tools, e.g. `mmcif_wc -h`). - Errors go to stderr as `ERROR!! ...`. The exit status is 0 on success; 1 when the input cannot be processed (a CIF error, or a refusal such as `mmcif_topdb` on a structure the PDB format cannot hold) or a check fails (`mmcif_validate`, `mmcif_chkensemble`); and 2 for a mistake on the command line (an invalid option, a missing file), followed by the usage. - **Reports as JSON.** With `--json`, `mmcif_info`, `mmcif_wc`, `mmcif_validate`, `mmcif_gap`, `mmcif_chkensemble` and `mmcif_blocks` print their report as one JSON object, for scripts and programs (the keys are in each tool's `--help`): `mmcif_info --json 4hhb.cif`. - Rows a tool does not change are written back byte-for-byte. In changed rows, only the edited values are rewritten, and the other columns keep their alignment. - To remove ligands and waters, select by entity (`mmcif_delentity -non-polymer,water`) rather than by HETATM record: `mmcif_delhetatm` also removes modified residues inside chains (selenomethionine, modified nucleotides). - **For one FASTA record per chain, use `mmcif_tofasta -multi,seqres`.** By default `mmcif_tofasta` writes, as `pdb_tofasta`, a single record for the whole file, read from the atoms with ligands and waters as `X` (`>4HHB|ABCD`). `-multi` alone starts a record each time the chain changes in the file, so the ligands and waters listed after the polymers give records of their own (12 for 4HHB). `-seqres` reads the deposited sequences of the polymers instead, with the residues that have no atoms. For the residues with atoms only: `mmcif_selentity -polymer 4hhb.cif | mmcif_tofasta -multi`. - Quote options that contain `*`, so that the shell does not expand them: `'-_pdbx_validate*'`. - Input files can be gzip-compressed (`.cif.gz`); outputs are plain text, so pipe them to `gzip` to compress. - After editing, `mmcif_validate` checks the syntax, the coordinates and the links between tables, and warns when the file does not describe its molecules (entities, chains, sequences, residue types), as files written by other programs often do; `mmcif_rebuildmeta` adds those tables, built from the atoms. ### Files for prediction and MD programs - **AlphaFold 3** templates must hold a single protein chain: select it with `mmcif_selchain` (ligands may stay). - **Boltz-2 and OpenFold3** name template chains by their label id (`_struct_asym.id`), not the author chain. To see which is which: `mmcif_cat -_atom_site.label_asym_id,auth_asym_id file.cif | sort -u`. - **Renumber the author numbers only** (the default of `mmcif_reres` and `mmcif_shiftres`). These programs place residues on the sequence by `label_seq_id`, which `--label` renumbering changes. - **Residues deleted inside a chain are still in the sequence**: prediction programs treat them as unresolved, and PDBFixer rebuilds them as missing residues. `mmcif_delmeta -all` drops the sequences as well. - **OpenMM takes `_cell` as the periodic box.** Cryo-EM and NMR entries often carry a placeholder cell of 1 Å; remove it with `mmcif_delcat -_cell,_symmetry`, or set the box when solvating. # Using mmcif-tools from Python The tools also run from Python, in the same process, and give the same results as on the command line, byte for byte: ```python import mmciftools # One tool, with the arguments of its command line: the output comes back as text text = mmciftools.run('selchain', '-A', '4hhb.cif') text = mmciftools.run('delentity', '-non-polymer,water', input=text) # Several tools in a row, the last writing to a file mmciftools.pipeline('selaltloc', 'delentity -non-polymer,water', 'reres -1', path='4hhb.cif', output='clean.cif') # Reports as dictionaries (the --json output of the tool) info = mmciftools.report('info', '4hhb.cif') print(info['blocks'][0]['resolution']) # 1.74 check = mmciftools.report('validate', 'clean.cif') print(check['valid'], check['warnings']) ``` - `run(tool, *args, input=None, output=None, cwd=None)` returns the output as text, or writes it to `output`. The tool reads the file named in `args`, or else `input`: text, or bytes (gzip-compressed or not). Tools are named with or without `mmcif_`. - `pipeline(*steps, path=None, input=None, output=None)` runs steps such as `'selchain -A'` (or `['selchain', '-A']`) one after the other, each reading the output of the one before. - `report(tool, *args, input=None)` runs `mmcif_info`, `mmcif_wc`, `mmcif_validate`, `mmcif_gap`, `mmcif_chkensemble` or `mmcif_blocks` with `--json` and returns the report as a dictionary. - `call(...)` takes the arguments of `run()` and returns a `Result` (`status`, `stdout`, `stderr`) whatever the exit status; `tools()` lists the tools. - A failure raises `mmciftools.ToolError`, with the tool's `message` and exit `status`. What a tool prints as a warning comes as a `mmciftools.ToolWarning` (see Python's `warnings` module). The split tools write their files in `cwd`, the current directory by default. - The calls redirect the standard streams of the process, so they run one at a time (a lock keeps threads from overlapping). To run tools in parallel, run the commands in subprocesses. # Things to know about mmCIF mmCIF (PDBx/mmCIF) is the format of the PDB archive: the wwPDB made it the standard in 2014, and structures too large for the PDB format (more than 99,999 atoms or 62 chains) exist only as mmCIF. Two of its differences from PDB files surprise most people: every atom has two sets of chain and residue identifiers, and the atoms are one table among dozens. The examples below use 4HHB (`mmcif_fetch 4hhb > 4hhb.cif`). ## mmCIF and PDB files The first atom of 4HHB in a PDB file, where each value has fixed columns: ```text ATOM 1 N VAL A 1 19.323 29.727 42.781 1.00 49.05 N ``` And in the mmCIF file, where the values are separated by spaces and named by the header lines above the rows: ```text loop_ _atom_site.group_PDB _atom_site.id _atom_site.type_symbol _atom_site.label_atom_id _atom_site.label_alt_id _atom_site.label_comp_id _atom_site.label_asym_id _atom_site.label_entity_id _atom_site.label_seq_id _atom_site.pdbx_PDB_ins_code _atom_site.Cartn_x _atom_site.Cartn_y _atom_site.Cartn_z _atom_site.occupancy _atom_site.B_iso_or_equiv _atom_site.pdbx_formal_charge _atom_site.auth_seq_id _atom_site.auth_comp_id _atom_site.auth_asym_id _atom_site.auth_atom_id _atom_site.pdbx_PDB_model_num ATOM 1 N N . VAL A 1 1 ? 19.323 29.727 42.781 1.00 49.05 ? 1 VAL A N 1 ``` The *n*-th value of a row belongs to the *n*-th header line: `VAL` is the `label_comp_id`, the `A` after it the `label_asym_id` (the chain), then `1` the `label_entity_id` and `1` the `label_seq_id` (the residue number). `.` means "does not apply" and `?` "unknown". Files can have other columns, in another order, so programs (and these tools) find a column by its name, never by its position. The atoms are one table (a *category*) among many: 4HHB has 72, from `_entry` and `_cell` to the entities, the sequences, the secondary structure and the validation reports. A table with a single row is written as name–value pairs (`_entry.id 4HHB`) instead of a `loop_`. ## Two sets of identifiers: auth and label Every atom names its chain and residue twice: - **author identifiers** (`auth_asym_id`, `auth_seq_id`, near the end of the row) are the chains and numbers chosen by the authors. Papers, PDB files and most viewers (PyMOL and ChimeraX by default) use them. - **label identifiers** (`label_asym_id`, `label_seq_id`, near the start of the row) are the PDB's own: one chain per molecule, and residues numbered 1, 2, 3, ... along the sequence. Ligands and waters have no sequence, so their `label_seq_id` is `.`. Structure prediction programs (AlphaFold, Boltz, ...) use the label numbers to place residues on the sequence. The heme of the first chain of 4HHB is in chain `E`, with no residue number, by its label identifiers, and residue 142 of chain `A` by its author identifiers (as in the PDB file, `HEM A 142`): ```text HETATM 4385 C CHA . HEM E 3 . ? 18.675 18.641 20.464 1.00 16.31 ? 142 HEM A CHA 1 ``` `mmcif_cat` prints columns by name, so it shows both chains of every molecule: ```bash mmcif_cat -_atom_site.label_asym_id,auth_asym_id,label_entity_id 4hhb.cif | uniq ``` ```text label_asym_id auth_asym_id label_entity_id A A 1 B B 2 C C 1 D D 2 E A 3 F B 4 G B 3 H C 3 I D 4 J D 3 K A 5 L B 5 M C 5 N D 5 ``` 14 label chains, one per molecule (four proteins, four hemes, two phosphates and the waters of each chain), in 4 author chains, `A` to `D`, each holding a protein with its ligands and waters. The tools use the author identifiers by default. Pass `--label` to use the label ones, or set `MMCIFTOOLS_SCHEME=label` for every tool. **An edit changes one set only.** Residue and atom names are the same in both, so `mmcif_rplresname` and `mmcif_uniqname` change both name columns. ## After renumbering: what changed `mmcif_reres -101` numbers the residues from 101. The first atom of chain A, before and after: ```text ATOM 1 N N . VAL A 1 1 ? 19.323 29.727 42.781 1.00 49.05 ? 1 VAL A N 1 ATOM 1 N N . VAL A 1 1 ? 19.323 29.727 42.781 1.00 49.05 ? 101 VAL A N 1 ``` The `1` near the start of the row is the `label_seq_id`, and it stays 1: the new number is the `auth_seq_id`, near the end. That is what you want: viewers show residue 101, and prediction programs still find it at position 1 of the sequence. To see both numbers side by side: ```bash mmcif_selchain -A 4hhb.cif | mmcif_reres -101 | mmcif_cat -_atom_site.label_seq_id,auth_seq_id,label_comp_id | uniq | head -5 ``` ```text label_seq_id auth_seq_id label_comp_id 1 101 VAL 2 102 LEU 3 103 SER 4 104 PRO ``` The other tables follow (see [Metadata follows the edits](https://matteo-cagiada.github.io/mmcif-tools/docs/mmcif/#metadata-follows-the-edits)): the bond between the heme's iron and its histidine in `_struct_conn` now names `HIS 187` and `HEM 242` in its author columns. `mmcif_reres -101 --label` would renumber the `label_seq_id` instead, and warns that this breaks the link between the atoms and the sequence. ## Reading your output - **Find a column by its header line:** the *n*-th `_atom_site.` line names the *n*-th value of each atom row. - **Print the columns you need** with `mmcif_cat`, as a table with one header line (for `less`, awk, R or pandas): `mmcif_cat -_atom_site.auth_asym_id,auth_seq_id,label_comp_id,label_atom_id out.cif`. - **Summaries:** `mmcif_wc` counts models, chains, residues and atoms; `mmcif_info` shows the entry's metadata; `mmcif_validate` checks the syntax, the coordinates and the links between tables. - **Compare with the input:** the tools write the rows they do not change byte-for-byte, and in changed rows only the edited values, so `diff 4hhb.cif out.cif` shows exactly what changed. - **Look at it:** PyMOL, ChimeraX and Mol* open mmCIF files directly. ## Metadata follows the edits Besides the atoms, a PDB entry has dozens of tables that name chains, residues or atoms: the sequence schemes, the secondary structure, the binding sites, the validation reports, the assemblies, and more. Every tool keeps them in step with its edits. After `mmcif_reres -101`, the table that places each residue on the sequence has the new numbers: ```bash mmcif_selchain -A 4hhb.cif | mmcif_reres -101 | mmcif_cat -_pdbx_poly_seq_scheme.seq_id,mon_id,pdb_seq_num,auth_seq_num | head -3 ``` ```text seq_id mon_id pdb_seq_num auth_seq_num 1 VAL 101 101 2 LEU 102 102 ``` - **Renaming** a chain, a residue number, a residue or an atom renames it in every table, and a renamed residue keeps its definition (`_chem_comp`) under the new name. After `mmcif_reres`, residues without atoms (unobserved ones) get `?`: their old number may now be another residue's. - **Removing** atoms removes the rows that name them. A residue, a chain or a molecule goes from every table when none of its atoms is left, the sequences included; a helix or strand that loses its ends is shortened (after `mmcif_delres -1:5`, the first helix of 4HHB starts at residue 6); the lists of chains (assemblies, the chains of each molecule) and the counts follow. Rows of removed models (`mmcif_selmodel`) and conformers (`mmcif_selaltloc`) go too. Residues that had no atoms in the first place stay. - **Checking:** `mmcif_validate` warns about rows out of step with the atoms, e.g. in a file edited by another program, and about atoms that the core tables (`_entity`, `_struct_asym`, `_entity_poly_seq`, `_pdbx_poly_seq_scheme`, `_chem_comp`) do not describe, or those tables missing; `mmcif_rebuildmeta` adds the missing ones from the atoms. `mmcif_assembly`, `mmcif_merge` and `mmcif_mkensemble` make new chains; the metadata keeps describing the chains of the first file. In a file with several data blocks, only the first block's tables follow (the rows of `_atom_site_anisotrop` follow their atoms in every block). Prediction and simulation programs read few of these tables: [`mmcif_delmeta`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delmeta) deletes the others. ## Entities Every molecule belongs to an entity: polymer, non-polymer, branched (glycans) or water. ```bash mmcif_cat -_entity.id,type,pdbx_description 4hhb.cif ``` ```text id type pdbx_description 1 polymer Hemoglobin subunit alpha 2 polymer Hemoglobin subunit beta 3 non-polymer PROTOPORPHYRIN IX CONTAINING FE 4 non-polymer PHOSPHATE ION 5 water water ``` `mmcif_selentity` / `mmcif_delentity` select by entity, which keeps modified residues (HETATM records inside a chain, such as MSE or the modified nucleotides of a tRNA) with their chain; `mmcif_delhetatm` removes them. ## No fixed columns Chain identifiers can be longer than one character, and there are no limits on atom or residue numbers. `mmcif_topdb` refuses structures that do not fit the PDB format. # mmcif-tools: tool reference Version 0.4.1, 54 tools. Generated from the tools' `--help` texts by `python tools/make_docs.py`; do not edit by hand. | Group | Tools | |---|---| | Fetch / convert | [`mmcif_fetch`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_fetch), [`mmcif_topdb`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_topdb), [`mmcif_frompdb`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_frompdb) | | Select / delete | [`mmcif_selchain`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selchain), [`mmcif_delchain`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delchain), [`mmcif_selres`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selres), [`mmcif_delres`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delres), [`mmcif_selresname`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selresname), [`mmcif_delresname`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delresname), [`mmcif_selatom`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selatom), [`mmcif_selelem`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selelem), [`mmcif_delelem`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delelem), [`mmcif_selhetatm`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selhetatm), [`mmcif_delhetatm`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delhetatm), [`mmcif_selentity`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selentity), [`mmcif_delentity`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delentity), [`mmcif_selaltloc`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selaltloc), [`mmcif_selmodel`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_selmodel), [`mmcif_head`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_head), [`mmcif_delmeta`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delmeta), [`mmcif_keepcoord`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_keepcoord), [`mmcif_intersect`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_intersect) | | Edit | [`mmcif_chain`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_chain), [`mmcif_rplchain`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_rplchain), [`mmcif_reres`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_reres), [`mmcif_shiftres`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_shiftres), [`mmcif_fixinsert`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_fixinsert), [`mmcif_delinsertion`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delinsertion), [`mmcif_reatom`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_reatom), [`mmcif_rplresname`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_rplresname), [`mmcif_uniqname`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_uniqname), [`mmcif_element`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_element), [`mmcif_b`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_b), [`mmcif_occ`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_occ) | | Identifiers | [`mmcif_label2auth`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_label2auth), [`mmcif_auth2label`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_auth2label) | | Models, files and assemblies | [`mmcif_splitchain`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_splitchain), [`mmcif_splitmodel`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_splitmodel), [`mmcif_mkensemble`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_mkensemble), [`mmcif_chkensemble`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_chkensemble), [`mmcif_merge`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_merge), [`mmcif_assembly`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_assembly) | | Categories and data blocks | [`mmcif_cat`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_cat), [`mmcif_delcat`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_delcat), [`mmcif_keepcat`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_keepcat), [`mmcif_rebuildmeta`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_rebuildmeta), [`mmcif_blocks`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_blocks) | | Inspect / format | [`mmcif_info`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_info), [`mmcif_wc`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_wc), [`mmcif_tofasta`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_tofasta), [`mmcif_gap`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_gap), [`mmcif_sort`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_sort), [`mmcif_tidy`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_tidy), [`mmcif_validate`](https://matteo-cagiada.github.io/mmcif-tools/docs/tools/#mmcif_validate) | ## Fetch / convert ### mmcif_fetch Downloads a structure in mmCIF format and writes it to standard output. ```text Downloads a structure in mmCIF format and writes it to standard output. PDB entries (4-character codes, or extended ids such as pdb_00001abc) come from the RCSB; -biounit downloads the first biological assembly instead of the deposited coordinates. AlphaFold DB models (AF-, e.g. AF-P69905-F1) are looked up through the AlphaFold DB API, so the latest model version is used. Usage: mmcif_fetch [-biounit] Example: mmcif_fetch 1brs > 1brs.cif # deposited coordinates, all 6 chains mmcif_fetch -biounit 1brs > 1brs.cif # first biological assembly, 2 chains mmcif_fetch AF-P69905-F1 > hba.cif # AlphaFold DB model This program is part of the mmcif-tools suite. ``` ### mmcif_topdb Converts the coordinates of an mmCIF file to the PDB format. ```text Converts the coordinates of an mmCIF file to the PDB format. As pdb_fromcif, writes the ATOM/HETATM records of _atom_site (with MODEL / ENDMDL records when there are several models) and END; other categories, and data blocks after the first, are not converted. Chains, residue numbers and names are auth identifiers, falling back to label ones when a file lacks them (with --label, label ones are used). Atom serials restart at 1 in each model. Unlike pdb_fromcif, a TER record follows the last residue of each polymer (atoms with a label_seq_id, or ATOM records in files without one) and takes a serial number, as the PDB format specifies. Will not convert a structure that does not fit the PDB format: chains of more than one character, more than 99,999 atoms in a model, residue numbers outside -999..9999, residue names longer than 3 characters or atom names longer than 4; nothing is written then. Unlike pdb_fromcif, residue names and elements are right-justified and MODEL numbers placed as the PDB format specifies, formal charges are written as 1-, 2+, ..., and missing occupancies / B-factors are written as 1.00 / 0.00. Usage: mmcif_topdb Example: mmcif_topdb 1abc.cif > 1abc.pdb This program is part of the mmcif-tools suite. ``` ### mmcif_frompdb Converts a PDB file to mmCIF format. ```text Converts a PDB file to mmCIF format. Converts the coordinates (ATOM/HETATM records, models) into _atom_site, plus _entry and, from CRYST1, _cell and _symmetry. Author identifiers (auth_*) are those of the PDB file. Unlike pdb_tocif, which copies them into the label_* columns, label identifiers are assigned as in PDB entries: label_asym_id one per polymer chain, one per ligand, and one for the waters of each chain (A, B, ..., Z, AA, BA, ...) label_entity_id polymer chains with the same sequence share an entity; each ligand type and water are entities of their own label_seq_id 1, 2, ... along each polymer chain; '.' elsewhere A TER record ends a polymer: the residues of a chain up to a TER record are one polymer, and the next TER record of the same chain ends another. So a file whose chains are blank or repeated, such as MD output with one TER record per molecule, gets one label_asym_id per molecule. In chains without TER records, the polymer runs from the first to the last ATOM record (so modified residues inside a chain belong to it). Atoms with a blank chain get their label_asym_id as their author chain, or the next free name when another chain of the file already has it (this replaces pdb_chainbows | pdb_tocif). For chains without missing residues this gives the label identifiers of the PDB entry; but label_seq_id only counts the residues present in the file (SEQRES is not used), so it differs from the entry after missing residues, and PDB entries order ligand instances and group glycans (branched entities) by their own conventions. Missing elements are assigned as by mmcif_element. Atom ids run from 1 over the whole file; models keep their MODEL numbers. ANISOU, CONECT and the other PDB records are not converted. Usage: mmcif_frompdb Example: mmcif_frompdb 1abc.pdb > 1abc.cif This program is part of the mmcif-tools suite. ``` ## Select / delete ### mmcif_selchain Extracts one or more chains from an mmCIF file. ```text Extracts one or more chains from an mmCIF file. Chains are matched on auth_asym_id (the chain shown by viewers), or on label_asym_id with --label. Chain identifiers are case-sensitive and may be longer than one character. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_selchain -[,...] [--label] Example: mmcif_selchain -C 1abc.cif # selects chain C mmcif_selchain -A,C 1abc.cif # selects chains A and C This program is part of the mmcif-tools suite. ``` ### mmcif_delchain Deletes all atoms of one or more chains from an mmCIF file. ```text Deletes all atoms of one or more chains from an mmCIF file. Chains are matched on auth_asym_id (the chain shown by viewers), or on label_asym_id with --label. Chain identifiers are case-sensitive (unlike pdb_delchain, which upper-cases them) and may be longer than one character. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_delchain -[,...] [--label] Example: mmcif_delchain -A 1abc.cif # removes chain A mmcif_delchain -A,B 1abc.cif # removes chains A and B This program is part of the mmcif-tools suite. ``` ### mmcif_selres Selects residues by their number, piecewise or in a range. ```text Selects residues by their number, piecewise or in a range. The range option has three components: start, end, and step. Start and end are optional and if omitted the range will start at the first residue or end at the last, respectively. As in pdb_selres, residues are matched by number only (in every chain and model, with or without insertion code), and the step counts residue occurrences in file order. Residue numbers are auth_seq_id, or label_seq_id with --label. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_selres -[resid]:[resid]:[step] [--label] Example: mmcif_selres -1,2,4,6 1abc.cif # extracts residues 1, 2, 4 and 6 mmcif_selres -1:10 1abc.cif # extracts residues 1 to 10 mmcif_selres -1:10,20:30 1abc.cif # extracts residues 1 to 10 and 20 to 30 mmcif_selres -1: 1abc.cif # extracts residues 1 to END mmcif_selres -:5 1abc.cif # extracts residues from START to 5 mmcif_selres -::5 1abc.cif # extracts every 5th residue mmcif_selres -1:10:5 1abc.cif # extracts every 5th residue from 1 to 10 mmcif_selres --5:5 1abc.cif # extracts residues -5 to 5 This program is part of the mmcif-tools suite. ``` ### mmcif_delres Deletes a range of residues from an mmCIF file. ```text Deletes a range of residues from an mmCIF file. The range option has three components: start, end, and step. Start and end are optional and if omitted the range will start at the first residue or end at the last, respectively. As in pdb_delres, the start and end values are residue numbers (matched in every chain and model), while the step counts residue occurrences in file order, regardless of their number. Unlike pdb_delres, a range may start and end at the same residue (-5:5). Residue numbers are auth_seq_id, or label_seq_id with --label. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_delres -[resid]:[resid]:[step] [--label] Example: mmcif_delres -1:10 1abc.cif # deletes residues 1 to 10 mmcif_delres -1: 1abc.cif # deletes residues 1 to END mmcif_delres -:5 1abc.cif # deletes residues from START to 5 mmcif_delres -::5 1abc.cif # deletes every 5th residue mmcif_delres -1:10:5 1abc.cif # deletes every 5th residue from 1 to 10 This program is part of the mmcif-tools suite. ``` ### mmcif_selresname Selects all residues matching the given name(s) in an mmCIF file. ```text Selects all residues matching the given name(s) in an mmCIF file. Residue names are matched on auth_comp_id (label_comp_id with --label); the names given are upper-cased, as in pdb_selresname. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_selresname -[,...] Example: mmcif_selresname -ALA 1abc.cif # keeps only alanines mmcif_selresname -ASP,GLU 1abc.cif # keeps (-) charged residues This program is part of the mmcif-tools suite. ``` ### mmcif_delresname Removes all residues matching the given name(s) in an mmCIF file. ```text Removes all residues matching the given name(s) in an mmCIF file. Residue names are matched on auth_comp_id (label_comp_id with --label); the names given are upper-cased, as in pdb_delresname. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_delresname -[,...] Example: mmcif_delresname -ALA 1abc.cif # removes only alanines mmcif_delresname -HOH 1abc.cif # removes waters mmcif_delresname -ASP,GLU 1abc.cif # removes (-) charged residues This program is part of the mmcif-tools suite. ``` ### mmcif_selatom Selects all atoms matching the given name(s) in an mmCIF file. ```text Selects all atoms matching the given name(s) in an mmCIF file. Atom names are matched on auth_atom_id (label_atom_id with --label); the names given are upper-cased, as in pdb_selatom. mmCIF atom names carry no padding, so -CA keeps alpha carbons and calcium ions alike, as pdb_selatom does. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_selatom -[,...] Example: mmcif_selatom -CA 1abc.cif # keeps only alpha-carbon atoms mmcif_selatom -CA,C,N,O 1abc.cif # keeps only backbone atoms This program is part of the mmcif-tools suite. ``` ### mmcif_selelem Selects all atoms of the given element(s) in an mmCIF file. ```text Selects all atoms of the given element(s) in an mmCIF file. Elements are read from _atom_site.type_symbol and compared ignoring case (pdb_selelem only matches upper-case elements). Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_selelem -[,...] Example: mmcif_selelem -H 1abc.cif # selects all hydrogens mmcif_selelem -N 1abc.cif # selects all nitrogens mmcif_selelem -H,N 1abc.cif # selects all hydrogens and nitrogens This program is part of the mmcif-tools suite. ``` ### mmcif_delelem Deletes all atoms of the given element(s) from an mmCIF file. ```text Deletes all atoms of the given element(s) from an mmCIF file. Elements are read from _atom_site.type_symbol and compared ignoring case (pdb_delelem only matches upper-case elements). Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_delelem -[,...] Example: mmcif_delelem -H 1abc.cif # deletes all hydrogens mmcif_delelem -H,D 1abc.cif # deletes hydrogens and deuteriums This program is part of the mmcif-tools suite. ``` ### mmcif_selhetatm Selects all HETATM records (ligands, ions, waters, ...) in an mmCIF file. ```text Selects all HETATM records (ligands, ions, waters, ...) in an mmCIF file. Atoms are selected on _atom_site.group_PDB. Unlike pdb_selhetatm, which drops every other record, the rest of the file (metadata categories) is kept; rows of the other tables that name removed atoms, residues or chains are removed (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...). Usage: mmcif_selhetatm Example: mmcif_selhetatm 1abc.cif This program is part of the mmcif-tools suite. ``` ### mmcif_delhetatm Removes all HETATM records (ligands, ions, waters, ...) from an mmCIF file. ```text Removes all HETATM records (ligands, ions, waters, ...) from an mmCIF file. Atoms are selected on _atom_site.group_PDB. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_delhetatm Example: mmcif_delhetatm 1abc.cif This program is part of the mmcif-tools suite. ``` ### mmcif_selentity Selects atoms by entity: by entity number (label_entity_id) or by type. ```text Selects atoms by entity: by entity number (label_entity_id) or by type. In mmCIF every molecule belongs to an entity (_entity), whose type is one of: polymer protein and nucleic-acid chains non-polymer ligands and ions branched oligosaccharides (glycans) macrolide macrolides water water Unlike mmcif_selhetatm, this keeps modified residues with their chain: they are HETATM records inside a polymer (MSE in proteins, PSU and 2MG in tRNA, ...). Numbers and types can be mixed (-polymer,5); types are case- insensitive. Files without an _entity category (some non-PDB files) are classified from their atoms: atoms with a label_seq_id are polymer, HOH, WAT and DOD are water, and the rest non-polymer. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_selentity -[,...] Example: mmcif_selentity -polymer 1abc.cif # chains only, with modified residues mmcif_selentity -polymer,branched 1abc.cif # chains and glycans mmcif_selentity -1,3 1abc.cif # entities 1 and 3 This program is part of the mmcif-tools suite. ``` ### mmcif_delentity Deletes atoms by entity: by entity number (label_entity_id) or by type. ```text Deletes atoms by entity: by entity number (label_entity_id) or by type. Entity types are polymer, non-polymer (ligands and ions), branched (glycans), macrolide and water; see mmcif_selentity. Unlike mmcif_delhetatm, this never cuts modified residues (HETATM records inside a polymer) out of their chain: -non-polymer,water removes the ligands, ions and waters and nothing else. Rows of the other tables that name removed atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...), and ranges such as helices are shortened. Usage: mmcif_delentity -[,...] Example: mmcif_delentity -water 1abc.cif mmcif_delentity -non-polymer,water 1abc.cif # keeps chains and glycans mmcif_delentity -2 1abc.cif # removes entity 2 This program is part of the mmcif-tools suite. ``` ### mmcif_selaltloc Selects alternate locations (_atom_site.label_alt_id) for the entire file. ```text Selects alternate locations (_atom_site.label_alt_id) for the entire file. By default, for each residue the alternate location with the highest occupancy is kept and the others are removed. With an option (e.g. -A), location A is kept wherever a residue has it; atoms that have other locations but no A (e.g. only B and C) are kept as they are. Kept atoms lose their altloc label ('.'); occupancies are not changed. The choice is made per residue, so a residue modelled as two different residue types (e.g. SER/THR) is never mixed. Atoms keep their order, and rows of _atom_site_anisotrop of removed atoms are removed too. Rows of the other tables that name a removed conformer (links in _struct_conn, validation reports, ...) are removed, and those that name a kept one lose their altloc label, as the atom does. The other tables also follow as with mmcif_selatom: rows naming atoms or residues that are gone are removed. A file without a label_alt_id column has no alternate locations and is written unchanged. Usage: mmcif_selaltloc [-] Example: mmcif_selaltloc 1abc.cif # picks locations with highest occupancy mmcif_selaltloc -A 1abc.cif # picks alternate locations labelled 'A' This program is part of the mmcif-tools suite. ``` ### mmcif_selmodel Extracts one or more models from an mmCIF file. ```text Extracts one or more models from an mmCIF file. Models are read from _atom_site.pdbx_PDB_model_num. As in pdb_selmodel, a file with a single model (or without model numbers) is returned whole, whatever model is asked for. Rows of the other tables that name removed models, atoms, residues or chains are removed too (_atom_site_anisotrop, _struct_conn, the validation reports of each model, ...), and ranges such as helices are shortened. Usage: mmcif_selmodel -[,...] Example: mmcif_selmodel -1 1abc.cif # selects model 1 mmcif_selmodel -1,3 1abc.cif # selects models 1 and 3 This program is part of the mmcif-tools suite. ``` ### mmcif_head Keeps the first N atoms (_atom_site rows) of an mmCIF file. ```text Keeps the first N atoms (_atom_site rows) of an mmCIF file. Atoms are counted over the whole file, across models and data blocks. Unlike pdb_head, which outputs nothing but the first N ATOM/HETATM lines, the rest of the file (metadata categories) is kept, so the output is still a complete mmCIF file; rows of the other tables that name removed atoms, residues or chains are removed (_atom_site_anisotrop, _struct_conn, _pdbx_poly_seq_scheme, ...). Usage: mmcif_head - Example: mmcif_head -100 1abc.cif # first 100 atoms of the file This program is part of the mmcif-tools suite. ``` ### mmcif_delmeta Deletes the metadata that structure prediction and simulation programs do not read, keeping the coordinates and what those programs need. ```text Deletes the metadata that structure prediction and simulation programs do not read, keeping the coordinates and what those programs need. PDB entries carry dozens of categories besides the atoms: validation reports, secondary structure, sites, assemblies, experimental details, ... The other mmcif-tools keep the ones that name chains, residues or atoms in step with their edits, but some programs stop at categories they do not expect, and files edited by other programs may not be in step. This tool keeps: _atom_site the atoms _atom_site_anisotrop their anisotropic B-factors _struct_conn, the links (disulfides, metal sites, ...) _struct_conn_type and their types _entry the entry id _cell, _symmetry the unit cell and space group _exptl, _refine, _reflns, the method and resolution (with the EM _em_3d_reconstruction tables it refers to: _em_image_processing, _em_image_recording, _em_imaging, _em_specimen, _em_experiment) _pdbx_audit_revision_history the release and revision dates _entity, _entity_poly, the molecules, their sequences, and the _entity_poly_seq, ligands _pdbx_entity_nonpoly _struct_asym the chains (label_asym_id) of each molecule _pdbx_poly_seq_scheme the residues of each chain along its sequence _pdbx_nonpoly_scheme the chains and numbers of the ligands _pdbx_struct_mod_residue the modified residues _chem_comp, _chem_comp_atom, the chemical components, their atoms and _chem_comp_bond, _atom_type bonds, and the elements _ma_model_list, _ma_data, in models (ModelCIF: AlphaFold DB, _ma_target_entity, ModelArchive), the models and the target _ma_target_entity_instance molecules and chains, which the model numbers of the atoms and the chains of _struct_asym point to and deletes every other category. These are what structure prediction programs (AlphaFold, ColabFold, OpenFold3, Boltz, Chai-1, Protenix, BioEmu) and MD preparation programs (OpenMM, PDBFixer) read from a file. The columns of these tables that point to a deleted one (the TLS group, NCS domain and footnote of each atom, the citation of the EM tables, the software of _reflns, the assembly of a model) are deleted as well, so that what the file points to is in the file. The kept tables are brought in step with the atoms: rows of chains and entities with no atoms left are removed, and so are the atom and bond lists of components whose atoms were renamed. Modified residues are looked up in the atoms by their label identifiers and get the current author numbers (rows of residues no longer there are removed). _entity.pdbx_number_of_molecules and _entity_poly.pdbx_strand_id are recomputed, and _pdbx_poly_seq_scheme is rebuilt from the sequences and the atoms (it is added when missing; residues without atoms get no author number). So run it last in a pipeline, after the edits. Tables that cannot be checked (no atoms, no label identifiers) are kept as they are. With -all, only the atoms, anisotropic B-factors and links are kept (mmcif_keepcoord also drops the anisotropic B-factors, as pdb_keepcoord drops ANISOU records). Usage: mmcif_delmeta [-all] Example: mmcif_delmeta 1abc.cif > 1abc_clean.cif mmcif_selchain -A 1abc.cif | mmcif_delentity -water | mmcif_delmeta > 1abc_A.cif mmcif_delmeta -all 1abc.cif > atoms_only.cif This program is part of the mmcif-tools suite. ``` ### mmcif_keepcoord Removes all non-coordinate categories from an mmCIF file. ```text Removes all non-coordinate categories from an mmCIF file. Keeps the data_ line, _atom_site and _struct_conn (the mmCIF counterparts of the ATOM/HETATM and CONECT records that pdb_keepcoord keeps); every other category is removed, _atom_site_anisotrop included (pdb_keepcoord drops ANISOU records too). To keep the metadata that programs read (entry, method, unit cell, entities, chains, sequences, chemical components), use mmcif_delmeta instead. Usage: mmcif_keepcoord Example: mmcif_keepcoord 1abc.cif This program is part of the mmcif-tools suite. ``` ### mmcif_intersect Keeps only the atoms of the first mmCIF file that are present in all the others. ```text Keeps only the atoms of the first mmCIF file that are present in all the others. As in pdb_intersect, atoms are judged equal if their name, altloc, residue name, residue number, insertion code and chain are the same (auth identifiers, or label ones with --label; models are not compared), and coordinates are taken from the first file. Unlike pdb_intersect, the output is the first file with the other atoms removed (metadata kept, in step with the atoms left, as with mmcif_selatom). Usage: mmcif_intersect [...] Example: mmcif_intersect 1xyz.cif 1abc.cif This program is part of the mmcif-tools suite. ``` ## Edit ### mmcif_chain Sets the chain identifier of all atoms in an mmCIF file. ```text Sets the chain identifier of all atoms in an mmCIF file. Changes auth_asym_id (label_asym_id with --label), in _atom_site and in the other tables that name chains (_struct_conn, _pdbx_poly_seq_scheme, _struct_conf, ...). mmCIF has no blank chain, so unlike pdb_chain an identifier must be given; it may be longer than one character. Usage: mmcif_chain - [--label] Example: mmcif_chain -C 1abc.cif This program is part of the mmcif-tools suite. ``` ### mmcif_rplchain Replaces one chain identifier by another in an mmCIF file. ```text Replaces one chain identifier by another in an mmCIF file. Changes auth_asym_id (label_asym_id with --label), in _atom_site and in the other tables that name chains (_struct_conn, _pdbx_poly_seq_scheme, _struct_conf, ...). Identifiers are case-sensitive and may be longer than one character; mmCIF has no blank chain, so both must be given. Usage: mmcif_rplchain -: [--label] Example: mmcif_rplchain -A:B 1abc.cif # replaces chain A by chain B This program is part of the mmcif-tools suite. ``` ### mmcif_reres Renumbers the residues of an mmCIF file starting from a given number (default 1). ```text Renumbers the residues of an mmCIF file starting from a given number (default 1). As in pdb_reres, numbering continues across chains and restarts in each model; a new residue starts whenever the residue name, chain, number or insertion code changes from one atom to the next (so 52 and 52A become two numbers), and insertion codes are kept. There is no upper limit. Changes auth_seq_id by default, in _atom_site and in the other tables that name residues (_struct_conn, _struct_conf, _pdbx_poly_seq_scheme, ...). There, residues without atoms (e.g. unobserved ones) get '?': their old number may now be another residue's. With --label it changes label_seq_id of polymer residues instead; that number links atoms to the sequence in _entity_poly_seq, so a warning is printed. Usage: mmcif_reres - [--label] Example: mmcif_reres -10 1abc.cif # renumbers from 10 mmcif_reres --1 1abc.cif # renumbers from -1 This program is part of the mmcif-tools suite. ``` ### mmcif_shiftres Shifts the residue numbers of an mmCIF file by a constant value. ```text Shifts the residue numbers of an mmCIF file by a constant value. Changes auth_seq_id by default, in _atom_site and in the other tables that name residues (_struct_conn, _pdbx_poly_seq_scheme, _struct_conf, ...); insertion codes are kept. With --label it shifts label_seq_id of polymer residues instead; that number links atoms to the sequence in _entity_poly_seq, so a warning is printed. There is no upper or lower limit. Usage: mmcif_shiftres - [--label] Example: mmcif_shiftres -10 1abc.cif # adds 10 to the original numbering mmcif_shiftres --5 1abc.cif # subtracts 5 from the original numbering This program is part of the mmcif-tools suite. ``` ### mmcif_fixinsert Deletes insertion codes (_atom_site.pdbx_PDB_ins_code) and shifts the residue numbering (auth_seq_id) to make room. ```text Deletes insertion codes (_atom_site.pdbx_PDB_ins_code) and shifts the residue numbering (auth_seq_id) to make room. As in pdb_fixinsert, the first residue carrying an insertion code just loses it, and every later residue whose number was already seen moves the numbering of the rest of the chain up by one: 51, 52A, 52B, 53 becomes 51, 52, 53, 54. With an option, only the listed residues lose their codes (the numbering still shifts for the rest of the chain). The shift restarts at each new chain instance (a change of chain or of label_asym_id, e.g. between a protein and its ligands or waters: where pdb_fixinsert meets a TER record) and in each model (pdb_fixinsert never restarts between models). Chains may have several characters and numbers may be negative: -A9,B12,AB-3. Insertion codes only exist with author identifiers, so --label is not accepted. The other tables that name residues (_struct_conn, _pdbx_poly_seq_scheme, _struct_conf, ...) are updated too. A file without a pdbx_PDB_ins_code column (e.g. an integrative model) has no insertion codes and is written unchanged. Usage: mmcif_fixinsert [-