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

Mapping from name to Category objects

linked_items

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.

class ihm.dictionary.Category[source]

Representation of a single category in a Dictionary.

description

Human-readable text

keywords

Mapping from name to Keyword objects

mandatory

True iff this category is required in a compliant mmCIF file

name

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.

property case_sensitive

True iff this type is case sensitive

class ihm.dictionary.Keyword[source]

Representation of a single keyword in a Category.

enumeration

Set of acceptable values, or None

item_type

ItemType for this keyword, or None

mandatory

True iff this keyword is required in a compliant mmCIF file

name

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().