Structure.to_file#

Structure.to_file(filename)[source]#

Writes the Structure instance to disk.

Parameters:
filenamestr

The name of the file to be created. Supported extensions are

.pdb

Creates a PDB file

.cif

Creates an mmCIF file

.gro

Creates an Gromos87 file

Raises
——
NotImplementedError

If the extension is not supported.

Examples

>>> from importlib_resources import files
>>> from tme import Structure
>>> from tme.matching_utils import generate_tempfile_name
>>> fname = str(files("tests.data").joinpath("Structures/5khe.cif"))
>>> oname = generate_tempfile_name()
>>> structure = Structure.from_file(filename=fname)
>>> structure.to_file(f"{oname}.cif") # Writes an mmCIF file to disk
>>> structure.to_file(f"{oname}.pdb") # Writes a PDB file to disk