nuri.fmt
- class nuri.fmt.MoleculeReader
- __iter__(self: MoleculeReader) MoleculeReader
Returns itself.
- __next__(self: MoleculeReader) Molecule
Returns the next molecule.
- 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
- 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.Model
-
- property atoms
- property chains
- property major_conf
- property props
- property residues
- 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.