biotite.structure.io.pdbx.set_structure

biotite.structure.io.pdbx.set_structure(pdbx_file, array, data_block=None)[source]

Set the atom_site category with atom information from an AtomArray or AtomArrayStack.

This will save the coordinates, the mandatory annotation categories and the optional annotation categories atom_id, b_factor, occupancy and charge. If the atom array (stack) contains the annotation 'atom_id', these values will be used for atom numbering instead of continuous numbering. Furthermore, inter-residue bonds will be written into the struct_conn category.

Parameters
pdbx_fileCIFFile or CIFBlock or BinaryCIFFile or BinaryCIFBlock

The file object.

arrayAtomArray or AtomArrayStack

The structure to be written. If a stack is given, each array in the stack will be in a separate model.

data_blockstr, optional

The name of the data block. Default is the first (and most times only) data block of the file. If the data block object is passed directly to pdbx_file, this parameter is ignored. If the file is empty, a new data will be created.

Notes

In some cases, the written inter-residue bonds cannot be read again due to ambiguity to which atoms the bond refers. This is the case, when two equal residues in the same chain have the same (or a masked) res_id.

Examples

>>> import os.path
>>> file = CIFFile()
>>> set_structure(file, atom_array)
>>> file.write(os.path.join(path_to_directory, "structure.cif"))