Bio.PDB.PDBIO module

Output of PDB files.

class Bio.PDB.PDBIO.Select

Bases: object

Select everything for PDB output (for use as a base class).

Default selection (everything) during writing - can be used as base class to implement selective output. This selects which entities will be written out.

__repr__()

Represent the output as a string for debugging.

accept_model(model)

Overload this to reject models for output.

accept_chain(chain)

Overload this to reject chains for output.

accept_residue(residue)

Overload this to reject residues for output.

accept_atom(atom)

Overload this to reject atoms for output.

class Bio.PDB.PDBIO.StructureIO

Bases: object

Base class to derive structure file format writers from.

__init__()

Initialise.

set_structure(pdb_object)

Check what the user is providing and build a structure.

class Bio.PDB.PDBIO.PDBIO(use_model_flag=0, is_pqr=False)

Bases: StructureIO

Write a Structure object (or a subset of a Structure object) as a PDB or PQR file.

Examples

>>> from Bio.PDB import PDBParser
>>> from Bio.PDB.PDBIO import PDBIO
>>> parser = PDBParser()
>>> structure = parser.get_structure("1a8o", "PDB/1A8O.pdb")
>>> io=PDBIO()
>>> io.set_structure(structure)
>>> io.save("bio-pdb-pdbio-out.pdb")
>>> import os
>>> os.remove("bio-pdb-pdbio-out.pdb")  # tidy up
__init__(use_model_flag=0, is_pqr=False)

Create the PDBIO object.

Parameters:
  • use_model_flag (int) – if 1, force use of the MODEL record in output.

  • is_pqr (Boolean) – if True, build PQR file. Otherwise build PDB file.

save(file, select=_select, write_end=True, preserve_atom_numbering=False)

Save structure to a file.

Parameters:
  • file (string or filehandle) – output file

  • select (object) – selects which entities will be written.

Typically select is a subclass of L{Select}, it should have the following methods:

  • accept_model(model)

  • accept_chain(chain)

  • accept_residue(residue)

  • accept_atom(atom)

These methods should return 1 if the entity is to be written out, 0 otherwise.

Typically select is a subclass of L{Select}.