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.
- nuri.fmt.to_pdb(mol: Molecule, conf: int | None = None) str
Convert a molecule to PDB string.
- Parameters:
mol – The molecule to convert.
conf – The conformation to convert. If not specified, writes all conformations. Ignored if the molecule has no conformations.
- Raises:
IndexError – If the molecule has any conformations and conf is out of range.
ValueError – If the conversion fails.
Note
Unlike most other formats, PDB does not support writing multiple different molecules in a single file. Simply concatenating the results of this function will not produce a valid PDB file.