Data Modelsο
This module defines the core data models that represent mmCIF file structures. SLOTHβs data hierarchy mirrors the mmCIF format:
MMCIFDataContainerβ top-level container (one or more data blocks)DataBlockβ a named data block (e.g.,data_1ABC)Categoryβ a category within a block (e.g.,_atom_site)Rowβ a single record in a categoryItemβ a column/field in a category
Enumerationsο
Abstract Base Classesο
Top-level Containerο
- class sloth.mmcif.models.MMCIFDataContainer[source]ο
Bases:
DataContainerA class to represent an mmCIF data container.
- __init__(data_blocks=None, source_format=DataSourceFormat.MMCIF, plugin_factory=None, auto_create=True)[source]ο
- Parameters:
source_format (DataSourceFormat)
plugin_factory (PluginFactory | None)
auto_create (bool)
- property plugin_factory: PluginFactory | Noneο
- property blocks: LazyKeyListο
Provides O(1) lazy list of data block names (prefixed names for consistency).
- property data: DataBlockCollectionο
Provides access to data blocks with both list and dict interfaces.
Data Blockο
- class sloth.mmcif.models.DataBlock[source]ο
Bases:
DataContainerA class to represent a data block in an mmCIF file.
- property plugin_factory: PluginFactory | Noneο
- property categories: LazyKeyListο
Get names of contained categories (prefixed names for external API) - O(1) lazy.
- property data: CategoryCollectionο
Provides read-only access to the category objects.
Categoryο
- class sloth.mmcif.models.Category[source]ο
Bases:
DataContainerA class to represent a category in a data block.
- __init__(name, plugin_factory=None)[source]ο
- Parameters:
name (str)
plugin_factory (PluginFactory | None)
- property plugin_factory: PluginFactory | Noneο
- property items: LazyKeyListο
Get names of contained items - O(1) lazy list.
- property data: LazyItemDictο
Provides O(1) lazy read-only access to the data (loads items on-demand).
- property rows: LazyRowListο
Returns all rows in this category as a lazy list (O(1) creation, cached for performance).
Rowο
Itemο
Lazy Loading Internalsο
These classes provide efficient lazy-loading wrappers over gemmi data structures. They are used internally and typically not instantiated directly.
- class sloth.mmcif.models.LazyGemmiColumn[source]ο
Bases:
listLazy wrapper for gemmi loop columns - data extracted only when accessed. Behaves like a list but loads data from gemmi on first access.
- class sloth.mmcif.models.LazyRowList[source]ο
Bases:
objectA list-like object that creates Row objects only when accessed.
- class sloth.mmcif.models.LazyItemDict[source]ο
Bases:
objectA dict-like object that only loads Item values when accessed, providing O(1) creation.