Skip to content

Fileio

FileIO(parent_molecule_object)

A class for saving and loading molecular data into a pymolecule.Molecule object

Initializes the pymolecule.io class.

PARAMETER DESCRIPTION
parent_molecule_object

The pymolecule.Molecule object associated with this class.

parent_molecule = parent_molecule_object instance-attribute

load_pdb_into(filename, bonds_by_distance=True, serial_reindex=True, resseq_reindex=False)

Loads the molecular data contained in a pdb file into the current pymolecule.Molecule object.

PARAMETER DESCRIPTION
filename

A string, the filename of the pdb file.

bonds_by_distance

An optional boolean, whether or not to determine atomic bonds based on atom proximity. True by default.

DEFAULT: True

serial_reindex

An optional boolean, whether or not to reindex the pdb serial field. True by default.

DEFAULT: True

resseq_reindex

An optional boolean, whether or not to reindex the pdb resseq field. False by default.

DEFAULT: False

load_pdb_into_using_file_object(file_obj, bonds_by_distance=True, serial_reindex=True, resseq_reindex=False)

Loads molecular data from a python file object (pdb formatted) into the current pymolecule.Molecule object. Note that most users will want to use the load_pdb_into() function instead, which is identical except that it accepts a filename string instead of a python file object.

PARAMETER DESCRIPTION
file_obj

A python file object, containing pdb-formatted data.

bonds_by_distance

An optional boolean, whether or not to determine atomic bonds based on atom proximity. True by default.

DEFAULT: True

serial_reindex

An optional boolean, whether or not to reindex the pdb serial field. True by default.

DEFAULT: True

resseq_reindex

An optional boolean, whether or not to reindex the pdb resseq field. False by default.

DEFAULT: False

load_pym_into(filename)

Loads the molecular data contained in a pym file into the current pymolecule.Molecule object.

PARAMETER DESCRIPTION
filename

A string, the filename of the pym file.

resseq_reindex()

Reindexes the resseq field of the atoms in the molecule, starting with 1

save_pdb(filename='', serial_reindex=True, resseq_reindex=False, return_text=False)

Saves the molecular data contained in a pymolecule.Molecule object to a pdb file.

PARAMETER DESCRIPTION
filename

An string, the filename to use for saving.

DEFAULT: ''

serial_reindex

An optional boolean, whether or not to reindex the pdb serial field. True by default.

DEFAULT: True

resseq_reindex

An optional boolean, whether or not to reindex the pdb resseq field. False by default.

DEFAULT: False

return_text

An optional boolean, whether or not to return text instead of writing to a file. If True, the filename variable is ignored.

DEFAULT: False

RETURNS DESCRIPTION

If return_text is True, a PDB-formatted string. Otherwise, returns nothing.

save_pym(filename, save_bonds=False, save_filename=False, save_remarks=False, save_hierarchy=False, save_coordinates_undo_point=False)

Saves the molecular data contained in a pymolecule.Molecule object to a pym file.

PARAMETER DESCRIPTION
filename

An string, the filename to use for saving. (Note that this is actually a directory, not a file.)

save_bonds

An optional boolean, whether or not to save information about atomic bonds. False by default.

DEFAULT: False

save_filename

An optional boolean, whether or not to save the original (pdb) filename. False by default.

DEFAULT: False

save_remarks

An optional boolean, whether or not to save remarks associated with the molecule. False by default.

DEFAULT: False

save_hierarchy

An optional boolean, whether or not to save information about spheres the bound (encompass) the whole molecule, the chains, and the residues. False by default.

DEFAULT: False

save_coordinates_undo_point

An optional boolean, whether or not to save the last coordinate undo point. False by default.

DEFAULT: False

serial_reindex()

Reindexes the serial field of the atoms in the molecule, starting with 1