biotite.structure.io.mmtf.get_structure

biotite.structure.io.mmtf.get_structure(file, model=None, insertion_code=[], altloc=[], extra_fields=[], include_bonds=False)

Get an AtomArray or AtomArrayStack from the MMTF file.

Parameters
fileMMTFFile

The file object.

modelint, optional

If this parameter is given, the function will return an AtomArray from the atoms corresponding to the given model ID. If this parameter is omitted, an AtomArrayStack containing all models will be returned, even if the structure contains only one model.

insertion_codelist of tuple, optional

In case the structure contains insertion codes, those can be specified here: Each tuple consists of an integer, specifying the residue ID, and a letter, specifying the insertion code. By default no insertions are used.

altloclist of tuple, optional

In case the structure contains altloc entries, those can be specified here: Each tuple consists of an integer, specifying the residue ID, and a letter, specifying the altloc ID. By default the location with the altloc ID “A” is used.

extra_fieldslist of str, optional

The strings in the list are optional annotation categories that should be stored in the output array or stack. There are 4 optional annotation identifiers: ‘atom_id’, ‘b_factor’, ‘occupancy’ and ‘charge’.

include_bondsbool

If set to true, an BondList will be created for the resulting AtomArray containing the bond information from the file. (Default: False)

Returns
arrayAtomArray or AtomArrayStack

The return type depends on the model parameter.

Examples

>>> import os.path
>>> file = MMTFFile()
>>> file.read(os.path.join(path_to_structures, "1l2y.mmtf"))
>>> array = get_structure(file, model=1)
>>> print(array.array_length())
304
>>> stack = get_structure(file)
>>> print(stack.stack_depth(), stack.array_length())
38 304