Package Scientific :: Package IO :: Module PDB :: Class Structure

[frames] | no frames]

# Class Structure

A high-level representation of the contents of a PDB file

The components of a structure can be accessed in several ways ('s' is an instance of this class):

- 's.residues' is a list of all PDB residues, in the order in which they occurred in the file.
- 's.peptide_chains' is a list of PeptideChain objects, containing all peptide chains in the file in their original order.
- 's.nucleotide_chains' is a list of NucleotideChain objects, containing all nucleotide chains in the file in their original order.
- 's.molecules' is a list of all PDB residues that are neither amino acid residues nor nucleotide residues, in their original order.
- 's.objects' is a list of all high-level objects (peptide chains, nucleotide chains, and molecules) in their original order.
- 's.to_fractional' is the transformation from real-space coordinates to fractional coordinates, as read from the SCALEn records.
- 's.from_fractional' is the transformation from fractional coordinates to real-space coordinates, the inverse of s.to_fractional.
- 's.ncs_transformations' is a list of transformations that describe non-crystallographic symmetries, as read from the MTRIXn records.
- if a CRYST1 record exists, 's.a', 's.b', 's.c', 's.alpha', 's.beta', 's.gamma' are the parameters of the unit cell and 's.space_group' is a string indicating the space group. If no CRYST1 record exists, all those values are None. Furthermore, 's.cs_transformations' is a list of transformations that describe crystallographic symmetries. If no CRYST1 record exists, the list is empty.

An iteration over a Structure instance by a for-loop is equivalent to an iteration over the residue list.

Nested Classes
| molecule_constructor Molecule in a PDB file
| nucleotide_chain_constructor Nucleotide chain in a PDB file
| peptide_chain_constructor Peptide chain in a PDB file

Instance Methods

__getitem__(self, item) |

__init__(self, file_or_filename, model=0, alternate_code=`'``A``'`) |

__len__(self) |

__repr__(self) |

addMolecule(self, molecule) |

deleteHydrogens(self) Remove all hydrogen atoms |

deleteResidue(self, residue) |

extractData(self, data) |

findSpaceGroupTransformations(self) |

joinNucleotideChains(self, first, second) Join two nucleotide chains into a single one. |

joinPeptideChains(self, first, second) Join two peptide chains into a single one. |

newChain(self, residue, chain_data) |

newResidue(self, residue_data) |

parseFile(self, file) |

renumberAtoms(self) Renumber all atoms sequentially starting with 1 |

splitNucleotideChain(self, number, position) Split a nucleotide chain into two chains |

splitPeptideChain(self, number, position) Split a peptide chain into two chains |

writeToFile(self, file) Write everything to a file |

Method Details

### __init__(self, file_or_filename, model=0, alternate_code=`'``A``'`)
(Constructor)

Parameters:
  - `file_or_filename` (`str` or `file`) - the name of the PDB file, or a file object. Compressed files and URLs are accepted, as for class PDBFile.
  - `model` (`int`) - the number of the model to read from a multiple-model file. Only one model can be treated at a time.
  - `alternate_code` (single-letter `str`) - the version of the positions to be read from a file with alternate positions.

### joinNucleotideChains(self, first, second)

Join two nucleotide chains into a single one. The new chain occupies the position of the first chain, the second one is removed from the nucleotide chain list.

Parameters:
  - `first` (`int`) - the number of the first chain
  - `second` (`int`) - the number of the second chain

### joinPeptideChains(self, first, second)

Join two peptide chains into a single one. The new chain occupies the position of the first chain, the second one is removed from the peptide chain list.

Parameters:
  - `first` (`int`) - the number of the first chain
  - `second` (`int`) - the number of the second chain

### splitNucleotideChain(self, number, position)

Split a nucleotide chain into two chains

The two chain fragments remain adjacent in the nucleotide chain list, i.e. the numbers of all following chains increase by one.

Parameters:
  - `number` (`int`) - the number of the nucleotide chain to be split
  - `position` (`int`) - the residue index at which the chain is split.

### splitPeptideChain(self, number, position)

Split a peptide chain into two chains

The two chain fragments remain adjacent in the peptide chain list, i.e. the numbers of all following chains increase by one.

Parameters:
  - `number` (`int`) - the number of the peptide chain to be split
  - `position` (`int`) - the residue index at which the chain is split.

### writeToFile(self, file)

Write everything to a file

Parameters:
  - `file` (PDBFile or `str`) - a PDB file object or a filename