boltz_data.cif#

Parsing and handling of mmCIF files.

Functions

get_structure_from_mmcif(mmcif, /)

Parse an mmCIF block into a StructureDefinition.

mmcif_from_structure(structure, /, *[, name])

Convert a StructureDefinition to an mmCIF block.

read_cif_from_file(path, /)

Read a CIF file containing multiple data blocks.

read_single_cif_from_file(path, /)

Read a CIF file containing a single data block.

write_cif(path, /, *, contents)

Write a CIF document or block to a file.

boltz_data.cif.get_structure_from_mmcif(mmcif, /)[source]#

Parse an mmCIF block into a StructureDefinition.

Extracts entities (proteins, DNA, RNA, branched polymers, ligands), chains, and bond information from the mmCIF format.

Parameters:

mmcif (Block) – The mmCIF block to parse.

Return type:

StructureDefinition

Returns:

A StructureDefinition containing all entities, chains, and bonds.

Raises:

ValueError – If no chains are found in the structure or if an unknown polymer type is encountered.

boltz_data.cif.mmcif_from_structure(structure, /, *, name='pred')[source]#

Convert a StructureDefinition to an mmCIF block.

Creates mmCIF categories for entities, polymers, non-polymers, branched polymers, and their corresponding chains and numbering schemes.

Parameters:
  • structure (StructureDefinition) – The structure definition to convert.

  • name (str) – Name for the mmCIF data block. Defaults to “pred”.

Return type:

Block

Returns:

An mmCIF block containing the structure information.

boltz_data.cif.read_cif_from_file(path, /)[source]#

Read a CIF file containing multiple data blocks.

Supports local files, URLs, and cloud storage paths via smart_open.

Parameters:

path (str | Path) – Path or URL to the CIF file.

Return type:

Document

Returns:

A CIF document containing all blocks from the file.

boltz_data.cif.read_single_cif_from_file(path, /)[source]#

Read a CIF file containing a single data block.

Supports local files, URLs, and cloud storage paths via smart_open.

Parameters:

path (str | Path) – Path or URL to the CIF file.

Return type:

Block

Returns:

The single CIF block from the file.

Raises:

ValueError – If the file contains multiple blocks.

boltz_data.cif.write_cif(path, /, *, contents)[source]#

Write a CIF document or block to a file.

Return type:

None

Parameters:
  • path (str | Path)

  • contents (Document | Block)