edPDB.cbook – Recipes for editing PDB files

The cook book contains short python functions that demonstrate how to implement basic PDB editing functionality. They do not do exhaustive error checking and might have to be altered for your purpose.

class edPDB.cbook.PDB(pdbname)

Class that represents a PDB file and allows extractions of interesting parts.

The structure itself is never changed. In order to extract sub-parts of a structure one selects these parts and writes them as new pdb file.

The advantage over a simple grep is that you will be able to read any odd pdb file and you will also able to do things like extract_protein() or extract_lipids().

Load structure from file pdbname.

extract_lipids(filename, lipid_resnames='POPC|POPG|POPE|DMPC|DPPE|DOPE', **kwargs)

Write a pdb file with the lipids extracted.

Note that resnames are also tried truncated to the first three characters, which means that POPE and POPG are identical and cannot be distinguished.

extract_protein(filename, **kwargs)
Write a pdb file with the protein (i.e. all amino acids) extracted.
extract_resnames(filename, resnames, **kwargs)
Write a pdb file with resnames extracted.
residues_by_resname(resnames, **kwargs)

Return a list of BioPDB residues that match resnames.

resnames can be a string or a list.

residues_by_selection(selection)

Return a list of BioPDB residues that are selected by selection.

selection must be BioPDB.PDB.PDBIO.Select instance (see for example edPDB.xpdb.ProteinSelect).

write(filename, **kwargs)

Write pdbfile which includes or excludes residues.

Arguments:
filename

output pdb filename

inclusions

list of residues to include

exclusions

list of residues to exclude

chain

relabel the selection with a new chain identifier

Residues must be BioPDB residues as returned by, for instance, residues_by_resname().

Note

Currently only either inclusions or exclusions can be supplied, not both.

edPDB.cbook.align_ligand(protein_struct, ligand_struct, ligand_resname, output='ligand_aligned.pdb')

Align a ligand to the same ligand in a protein, based on the heavy atoms.

This is useful when a new ligand was generated with hydrogens but the position in space changed.

Arguments:
protein_struct

protein + ligand pdb

ligand_struct

ligand pdb

ligand_resname

residue name of the ligand in the file protein_struct

ligand_aligned

output

Returns:

RMSD of the fit in Angstroem.

Warning

Assumes only heavy atoms in PDB (I think... check source!)

edPDB.cbook.remove_overlap_water(pdbname, output, ligand_resname, distance=3.0, water='SOL', **kwargs)

Remove water (SOL) molecules overlapping with ligand.

Arguments:
pdbname

pdb file that contains the ligand and the water

output

pdb output filename

ligand_resname

name of the ligand residue(s) in the pdb

distance

overlap is defined as a centre-centre distance of any solvent OW atom with any ligand atom of less than distance

Note

The residue and atom numbering will be fairly meaningless in the final PDB because it wraps at 100,000 or 10,000.

Also make sure that there are either consistent chain identifiers or none (blank) because otherwise the residue blocks migh become reordered. (This is due to the way the Bio.PDB.PDBIO writes files.)

Previous topic

edPDB – editing PDB files

Next topic

edPDB.xpdb – Extensions to Bio.PDB

This Page