Base classes for Atom and AtomCollection formats.
Subclasses extend or override attributes and methods as necessary.
Bases: object
Base class for an atom description.
Parameters : | record : string {ATOM, HETATM}
natom : int
atom : string
res : string
chain : string
nres : int
x : float
y : float
z : float
charge : float
|
---|
list of weak references to the object (if defined)
Add a list of atom numbers (natom) that connect with this Atom
Parameters : | connections : list
|
---|
Find angle between three atoms
Parameters : | atm1 : Atom
atm2 : Atom
atm3 : Atom
|
---|---|
Returns : | angle : float
|
Find cross product of two Atom coordinates.
Parameters : | atm1 : Atom
atm2 : Atom
|
---|---|
Returns : | cross product : float
|
Calculate dihedral angle
Parameters : | atm1 : Atom
atm2 : Atom
atm3 : Atom
atm4 : Atom
|
---|---|
Returns : | dihdral angle : float
|
Distance between two atoms.
Parameters : | atm1 : Atom
atm2 : Atom
|
---|---|
Returns : | dist : float
|
Compute the distance between two Atoms
Find dot product of two Atoms.
Parameters : | atm1 : Atom
atm2 : Atom
|
---|---|
Returns : | dot product : float
|
Normalize Atom coordinates
Parameters : | atom : Atom
|
---|---|
Returns : | coords : ndarray (1 x 3)
|
Bases: object
Base class for an Atom collection.
Parameters : | atoms : list (optional, default is None)
|
---|---|
Returns : | result : AtomCollection |
Returns the common atoms between self and other
Parameters : | other : AtomCollection |
---|---|
Returns : | result : AtomCollection
|
Examples
>>> a = AtomCollection(atoms_1)
>>> b = AtomCollection(atoms_2)
>>> common_atoms = a & b
Returns True if all atoms in other are in this collection
Parameters : | other : AtomCollection |
---|---|
Returns : | result : boolean |
Compares two AtomCollections for equality.
Parameters : | other : AtomCollection |
---|---|
Returns : | result : boolean |
Get Atom for a given index
Parameters : | index : int
|
---|---|
Returns : | atom : Atom
|
Iterate through the atoms in this collection
The number of atoms in this collection.
Returns the intersection of atoms in self and other
Parameters : | other : AtomCollection |
---|---|
Returns : | result : AtomCollection
|
Examples
>>> a = AtomCollection(atoms_1)
>>> b = AtomCollection(atoms_2)
>>> all_atoms = a | b
list of weak references to the object (if defined)
Returns atoms in self that are not in other and the atoms in other not in self.
Parameters : | other : AtomCollection |
---|---|
Returns : | result : AtomCollection
|
Examples
>>> all_atoms = AtomCollection(atoms)
>>> protons = all_atoms.select(atom__startswith='H')
>>> removed_hydrogens = all_atoms ^ protons
Align this object to another and return a new object with the aligned coordinates.
Parameters : | other : AtomCollection
|
---|---|
Returns : | results : AtomCollection
|
See also
Return the RMSD of the aligned structures of this and another object. Both objects must have the same number of atoms.
Parameters : | other : AtomCollection
|
---|---|
Returns : | rmsd : float
|
See also
Assign new value(s) to an Atom attribute
Parameters : | attr: Atom attribute : value : int, string, float, list, tuple
|
---|
Return a new object containing all backbone atoms
Returns : | result : AtomCollection
|
---|
Align using the cealign algorithm from pymol.
Parameters : | other : AtomCollection
alphas : Boolean, optional (default=True)
|
---|---|
Returns : | result : AtomCollection
|
See also
Return a list of the chains in this object.
Returns : | chains : lists
|
---|
Create new AtomCollection where specified atoms are excluded
Parameters : | kwargs :
|
---|---|
Returns : | results : AtomCollection
|
See also
Return dict of residue records grouped by ‘nres_chain’ keys
Return a new object containing HETATM records.
Returns : | result : AtomCollection
|
---|
Create new object with new coordinates
Parameters : | matrix : numpy N x 3 matrix
|
---|---|
Returns : | result : AtomCollection
|
Orient the protein to be centered at the origin with the principle axes aligned properly.
Returns : | result : AtomCollection
|
---|
Return a new object containing ATOM records.
Returns : | results : AtomCollection
|
---|
Creates Ramachandran plot for the protein atoms in this collection.
Remove protons from collection.
Renumber atoms.
Parameters : | start : int, optional (default=1)
|
---|
Renumber residues beginning with start.
Parameters : | start : int, optional (default=1)
|
---|
Return a list of residue numbers.
Returns a list of residues.
Return the root-mean-square deviation (RMSD) between this and another object.
\(\mathrm{RMSD} = \sqrt{\frac{1}{N}\sum_{i = 1}^{N}||v_i - w_i||^2}\)
Parameters : | other : AtomCollection
|
---|---|
Returns : | rmsd : float
|
See also
Select atoms based on logical criteria
Parameters : | kwargs : various
|
---|---|
Returns : | selection : AtomCollection
|
See also
Examples
>>> prot = AtomCollection(atoms)
>>> chain_a = prot.select(chain__eq='A')
>>> other_chains = prot.select(chain__ne='A')
>>> residues_1_to_250 = prot.select(nres__le=250)
>>> hydrogens = prot.select(atom__startswith='H')
>>> res356_A = prot.select(chain='A', nres=356) # default is 'eq'
>>> pos_res = prot.select(res__isin={'LYS', 'ARG'})
>>> # Select neutral residues
>>> charged = set(['LYS', 'ARG', 'ASP', 'GLU'])
>>> neutral_res = prot.select(res__isnotin=charged)
>>> # select creates new object. Allows chaining:
>>> selection = prot.select(nres__gt=200, nres__lt=245).sidechains()
Returns one-letter code sequence of collection. Missing residues are filled in with -‘s
Returns : | sequence : string
|
---|
Return a new object containing all sidechain atoms.
Returns : | result : AtomCollection
|
---|
Get atoms in this instance within some distance of atoms in other instance.
Parameters : | distance : float
other : AtomCollection
|
---|---|
Returns : | result : AtomCollection
|
Bases: protutils.atom.Atom
Parse, store, and manipulate RECORD line data from a BGF file.
Add connection data
Parse a RECORD line from a BGF file.
Parameters : | line : string
|
---|---|
Returns : | result : BGFAtom
|
Write BGF ATOM/HETATM line and CONECT info.
Returns : | result : tuple
|
---|
Bases: protutils.atom.AtomCollection
Store and manipulate BGF files.
Initialize a BGFFile object.
Creates a blank BGF object by default.
Parameters : | biogrf : str, optional (default=‘332’)
descrp : str, optional
ff : str, optional (default=’DREIDING’)
atoms : list, optional
|
---|---|
Returns : | BF : BGFFile |
Create a new BGFFile object from a file.
Parses BGF file header and RECORD lines.
Returns : | BF : BGFFile
|
---|
Create PDBFile object.
Returns : | result : PDBFile |
---|
Write object to file
Parameters : | filename : path
|
---|
Write object contents as a PDB file.
Bases: protutils.atom.Atom
PDB file class
Parse a PDB RECORD line.
Parameters : | line : string
|
---|---|
Returns : | result : PDBAtom |
Write object data as formated RECORD and CONECT strings
Returns : | line : tuple
|
---|
Bases: protutils.atom.AtomCollection
Fetch pdb from RCSB Protein Data Bank.
Parameters : | pdb_code : str
|
---|---|
Returns : | PF : PDBFile
|
Fetch ligand from Ligand Expo
Parameters : | cci : string
|
---|---|
Returns : | PF : PDFFile
|
Initialize from file
Parameters : | filename : path
|
---|---|
Returns : | result : PDBFile |
Creates Ramachandran plot of phi and psi backbone angles.
Write object to PDB file
Parameters : | filename : path
|
---|
Bases: protutils.residue.Residue
Instantiate new residue object from sorted atom list
Parameters : | atoms : list
|
---|---|
Returns : | result : PDBResidue |
Returns key for ‘next’ residue
Returns key for ‘previous’ residue
Bases: protutils.residue.Residues
Bases: protutils.atom.Atom
Parse PQR atom format
PQR files are whitespace delimited
Bases: protutils.atom.AtomCollection
Convert PQR to PDB
Returns : | result : PDBFile
|
---|
Write object to a PQR file with PDB-style formatting.
Uses PQRFile.to_pdb() to convert to pdb object before writing data to file.
See also
Write object to a PQR file with PDB-style formatting.
Bases: object
Container for a residue
Return Atom object with selected name
list of weak references to the object (if defined)
Returns key for ‘next’ residue
Returns key for ‘previous’ residue
Bases: object
Instantiates new Residues object.
Parameters : | atoms : list
|
---|
list of weak references to the object (if defined)
Get \(\phi\) angle for indicated residue
Parameters : | residue : string
|
---|---|
Returns : | result : float
|
See also
Get \(\psi\) angle for indicated residue
Parameters : | residue : string
|
---|---|
Returns : | result : float
|
See also
Plot \(\psi\) versus \(\phi\) angles for all residues.