MMCIFHandler β Main Entry Pointο
The MMCIFHandler is the primary interface for reading, writing,
exporting, and importing mmCIF data.
from sloth import MMCIFHandler
handler = MMCIFHandler()
mmcif = handler.read("1abc.cif")
- class sloth.mmcif.handler.MMCIFHandler[source]ο
Bases:
objectA class to handle reading and writing mmCIF files with high-performance gemmi backend.
- read(filename, categories=None)[source]ο
Parse an mmCIF file and returns a data container using gemmiβs high-performance backend.
- Parameters:
- Returns:
The data container with lazy-loaded items.
- Return type:
- write(mmcif, filename=None)[source]ο
Writes a data container to a file using gemmiβs high-performance backend.
- Parameters:
mmcif (MMCIFDataContainer) β The data container to write.
filename (Optional[str]) β Optional filename to write to. If not provided, uses pre-set file object.
- Return type:
- Returns:
None
- export(mmcif, file_path=None, **kwargs)[source]ο
Export mmCIF data to JSON format.
- Parameters:
mmcif (MMCIFDataContainer) β The data container to export
file_path (Optional[str]) β Path to save the file (optional)
kwargs β Additional options (e.g., indent, quiet)
- Returns:
String representation if no file_path provided, otherwise None
- Return type:
Optional[str]