The ihm.dictionary Python module

Classes to read in and represent an mmCIF extension dictionary

class ihm.dictionary.Dictionary[source]

Representation of an mmCIF dictionary. See read() to create a Dictionary from a file.

Multiple Dictionaries can be added together to yield a Dictionary that includes all the data in the original Dictionaries.

See the validator example for an example of using this class.

categories = None

Mapping from name to Category objects

linked_items = None

Links between items; keys are children, values are parents e.g. linked_items['_ihm_starting_model_details.asym_id'] = '_struct_asym.id'

validate(fh, format='mmCIF')[source]

Validate the given file against this dictionary.

Parameters:
  • fh (file) – The file handle to read from.
  • format (str) – The format of the file. This can be ‘mmCIF’ (the default) for the (text-based) mmCIF format or ‘BCIF’ for BinaryCIF.
Raises:

ValidatorError if the file fails to validate.

Note

Only basic validation is performed. In particular, extra categories or keywords that are not present in the dictionary are ignored rather than treated as errors.

class ihm.dictionary.Category[source]

Representation of a single category in a Dictionary.

description = None

Human-readable text

keywords = None

Mapping from name to Keyword objects

mandatory = None

True iff this category is required in a compliant mmCIF file

name = None

Category name

class ihm.dictionary.ItemType(name, primitive_code, construct)[source]

Represent the type of a data item. This keeps the set of valid strings for values of a given Keyword. For example, integer values can only contain the digits 0-9 with an optional +/- prefix.

case_sensitive

True iff this type is case sensitive

class ihm.dictionary.Keyword[source]

Representation of a single keyword in a Category.

enumeration = None

Set of acceptable values, or None

item_type = None

ItemType for this keyword, or None

mandatory = None

True iff this keyword is required in a compliant mmCIF file

name = None

Keyword name

ihm.dictionary.read(fh)[source]

Read dictionary data from the mmCIF file handle fh.

Returns:The dictionary data.
Return type:Dictionary
exception ihm.dictionary.ValidatorError[source]

Exception raised if a file fails to validate. See Dictionary.validate().