nuri.fmt

class nuri.fmt.MoleculeReader
__iter__(self: MoleculeReader) MoleculeReader

Returns itself.

__next__(self: MoleculeReader) Molecule

Returns the next molecule.

class nuri.fmt.CifBlock
property data
property is_global
property name
property save_frames
class nuri.fmt.CifFrame
prefix_search_first(self: CifFrame, prefix: str) CifTable | None

Search for the first table containing a column starting with the given prefix.

Parameters:

prefix – The prefix to search for.

Returns:

The first table containing the given prefix, or None if not found.

property name
class nuri.fmt.CifParser
class nuri.fmt.CifTable
keys(self: CifTable) list[str]
nuri.fmt.cif_ddl2_frame_as_dict(frame: CifFrame) dict[str, list[dict[str, str | None]]]

Convert a CIF frame to a dictionary of lists of dictionaries.

Parameters:

frame – The CIF frame to convert.

Returns:

A dictionary of lists of dictionaries, where the keys are the parent keys and the values are the rows of the table.

nuri.fmt.mmcif_load_frame(frame: CifFrame) list[Molecule]

Load a CIF frame as a list of molecules.

Parameters:

frame – The CIF frame to load.

Returns:

A list of molecules loaded from the frame.

nuri.fmt.read_cif(path: PathLike) CifParser

Create a parser object from a CIF file path.

Parameters:

path – The path to the CIF file.

Returns:

A parser object that can be used to iterate over the blocks in the file.

PDB Format Support

from nuri.fmt import pdb

PDB format-specific handlers and utilities.

class nuri.fmt.pdb.Atom
property element
property formal_charge
property hetero
property name
property res_id
property sites
class nuri.fmt.pdb.AtomSite
property altloc
property occupancy
property pos
property tempfactor
class nuri.fmt.pdb.Chain
property id
property res_idxs
class nuri.fmt.pdb.Model
as_dict(self: Model) dict

Convert the PDB model to a dictionary.

property atoms
property chains
property major_conf
property props
property residues
class nuri.fmt.pdb.Residue
property atom_idxs
property id
property name
class nuri.fmt.pdb.ResidueId
property chain_id
property ins_code
property res_seq
nuri.fmt.pdb.read_models(path: PathLike, skip_on_error: bool = False) list[Model]

Read PDB models from a file.

Parameters:
  • path – The path to the PDB file.

  • skip_on_error – Whether to skip a model if an error occurs, instead of raising an exception.

Raises:
  • OSError – If any file-related error occurs.

  • ValueError – If reading a model fails, unless skip_on_error is set.