mmcif: mmCIF input/output

mmcif: mmCIF format support

Read mmCIF files.

class MMCIFTable(table_name, tags=None, data=None)

Bases: object

Present a table interface for a mmCIF category

extend(table)

Extend mmCIF table

Parameters:

table : MMCIFTable to add on to current table

If a column with a given tag exists, then that column is extended.

Otherwise, a new column is added to the table.

field_has(field_name, value)

Return if given field has the given value

fields(field_names, *, allow_missing_fields=False, missing_value='')

Return subset of rows of the table for the given fields

Parameters:

field_names : a sequence of the field names

allow_missing_fields : optional boolean (default False)

missing_value : optional missing_value object (default ‘’)

A list of tuples is return where each tuple’s items are the values

corresponding to the given field names in the given order. If

missing fields are allowed, then the corresponding items are the

missing_value object.

has_field(field_name)

Return if given field name is in the table

mapping(key_names, value_names, foreach_names=None)

Return a dictionary for subset of the table

Parameters:

key_names : a field name or list of field names

value_names : a field name or list of field names

foreach_names : optional field name or list of field names

If foreach_names is not given, then the resulting dictionary is whose

keys are the values of the key field(s) and the values are the values

of the value field(s). If foreach_names is given, then the result is

a dicttionary of dictionaries, with the nested dictionaries as above,

and the outer dictionary’s keys are the values of the foreach fields.

num_rows()

Return number of rows in table

print(file=None)

Print contents of table to given file

citations(model, only=None)

Return APA-style HTML citations for model

Parameters:

model : instance of a AtomicStructure

The model.

get_mmcif_tables(filename, table_names)

Extract mmCIF tables from a file

Parameters:

filename : str

The name of the file.

table_names : list of str

A list of mmCIF category names.

get_mmcif_tables_from_metadata(model, table_names)

Extract mmCIF tables from previously read metadata

Parameters:

model : instance of a AtomicStructure

The model.

table_names : list of str

A list of mmCIF category names.

quote(s)

Return CIF quoted value