Home | Trees | Indices | Help |
|
---|
|
Store and manipulate coordinates and atom infos stemming from a PDB file. Coordinates are stored in the Numeric array 'xyz'; the additional atom infos from the PDB are stored in the list of dictionaries 'atoms'. Methods are provided to remove items from both atoms and xyz simultaniously, to restore the PDB file, to get masks for certain atom types/names/residues, to iterate over residues, sort atoms etc.
Atom- or residue-related values can be put into 'profile' arrays. See setAtomProfile() and setResProfile(). Any reordering or removal of atoms is also applied to the profiles so that they should always match the current atom/residue order.
The object remembers its source (a PDB file or a PDBModel in memory or a pickled PDBModel on disc) and keeps track of whether atoms, xyz, or (which) profiles have been changed with respect to the source. The slim() method is called before pickling a PDBModel. It sets to None the atoms and/or xyz array or any profiles if they have not been changed since beeing read from a source on disc. The change status of xyz and atoms is reported by isChanged() (with respect to the direct source) and isChangedFromDisc() (with respect to the source of the source... just in case). You can trick this mechanism by setting atomsChanged or xyzChanged back to 0 if you want to make only temporary changes that are lost after a call to slim().
Additional infos about the model can be put into a dictionary 'info'.To Do:
|
|||
|
__init__(self,
source=None,
pdbCode=None,
noxyz=0,
skipRes=None) PDBModel() creates an empty Model to which coordinates (field xyz) and PDB infos (field atoms) have still to be added. |
||
| version(self) | ||
|
__getstate__(self) called before pickling the object. |
||
|
__setstate__(self,
state) called for unpickling the object. |
||
| __len__(self) | ||
|
__defaults(self) backwards compatibility to earlier pickled models |
||
|
update(self,
skipRes=None,
lookHarder=0,
force=0) Read coordinates, atoms, fileName, etc. |
||
list of int
|
__pdbTer(self,
rmOld=0) Returns list of atom indices that are followed by a TER record (marked with 'after_ter' flag of the next atom by __collectAll). |
||
array
|
setXyz(self,
xyz) Replace coordinates. |
||
list of dict
|
setAtoms(self,
atoms) Replace atoms list of dictionaries. |
||
| setSource(self, source) | ||
array
|
getXyz(self,
mask=None) Get coordinates, fetch from source PDB or pickled PDBModel, if necessary. |
||
list of dic
|
getAtoms(self,
mask=None) Get atom dictionaries, fetch from source PDB or pickled PDBModel, if necessary. |
||
|
setResProfile(self,
name,
prof,
mask=None,
default=None,
asarray=1,
comment=None,
**moreInfo) Add/override residue-based profile. |
||
|
setAtomProfile(self,
name,
prof,
mask=None,
default=None,
asarray=1,
comment=None,
**moreInfo) Add/override atom-based profile. |
||
array
|
resProfile(self,
name,
default=None) Use: |
||
array
|
atomProfile(self,
name,
default=None) Use: |
||
|
profile(self,
name,
default=None,
lookHarder=0) Use: |
||
|
profileInfo(self,
name,
lookHarder=0) Use: |
||
|
setProfileInfo(self,
name,
**args) {'bin':'whatif'}) |
||
int
|
removeProfile(self,
*names) Remove residue or atom profile(s) |
||
(1||0, 1||0)
|
isChanged(self) Tell if xyz or atoms have been changed compared to source file or source object (which can be still in memory). |
||
(1||0, 1||0)
|
isChangedFromDisc(self) Tell whether xyz and atoms can currently be reconstructed from a source on disc. |
||
int
|
profileChangedFromDisc(self,
pname) Check if profile has changed compared to source. |
||
|
__slimProfiles(self) Remove profiles, that haven't been changed from a direct or indirect source on disc AUTOMATICALLY CALLED BEFORE PICKLING |
||
|
slim(self) Remove xyz array and list of atoms if they haven't been changed and could hence be loaded from the source file (only if there is a source file...). |
||
str or PDBModel or None
|
validSource(self) Check for a valid source on disk. |
||
str
|
sourceFile(self) Name of pickled source or PDB file. |
||
|
disconnect(self) Disconnect this model from its source (if any). |
||
str
|
getPdbCode(self) Return pdb code of model. |
||
|
setPdbCode(self,
code) Set model pdb code. |
||
str
|
sequence(self,
mask=None,
xtable=molUtils.xxDic) Amino acid sequence in one letter code. |
||
list of atom dictionaries
|
xplor2amber(self,
change=1,
aatm=1) Rename atoms so that tleap from Amber can read the PDB. |
||
|
writePdb(self,
fname,
ter=1,
amber=0,
original=0,
left=0,
wrap=0,
headlines=None,
taillines=None) Save model as PDB file. |
||
list of strings
|
returnPdb(self,
out=None,
ter=1,
headlines=None,
taillines=None) Restore PDB file from (possibly transformed) coordinates and pdb line dictionaries in self.atoms. |
||
|
saveAs(self,
path) Pickle this PDBModel to a file, set the 'source' field to this file name and mark atoms, xyz, and profiles as unchanged. |
||
array or list
|
maskF(self,
atomFunction,
numpy=1) Create list whith result of atomFunction( atom ) for each atom. |
||
array
|
maskCA(self,
force=0) Short cut for mask of all CA atoms. |
||
array
|
maskBB(self,
force=0) Short cut for mask of all backbone atoms. |
||
array
|
maskHeavy(self,
force=0) Short cut for mask of all heavy atoms. |
||
array
|
maskH(self) Short cut for mask of hydrogens. |
||
array
|
maskCB(self) Short cut for mask of all CB and CA of GLY. |
||
array
|
maskH2O(self) Short cut for mask of all atoms in residues named TIP3, HOH and WAT |
||
array
|
maskSolvent(self) Short cut for mask of all atoms in residues named TIP3, HOH, WAT, Na+, Cl- |
||
array
|
maskHetatm(self) Short cut for mask of all HETATM |
||
array
|
maskProtein(self,
standard=0) Short cut for mask containing all atoms of amino acids. |
||
Numeric array
|
indices(self,
what) Get atom indices conforming condition |
||
Numeric array
|
mask(self,
what,
numpy=1) Get atom mask. |
||
array of int
|
atom2resMask(self,
atomMask) Mask (0) residues for which all atoms are masked (0) in atomMask. |
||
list of int
|
atom2resIndices(self,
indices) Get list of indices of residue for which any atom is in indices. |
||
array of int
|
res2atomMask(self,
resMask) convert residue mask to atom mask. |
||
list of int
|
res2atomIndices(self,
indices) Convert residue indices to atom indices. |
||
list or array
|
res2atomProfile(self,
p) Get an atom profile where each atom has the value its residue has in the residue profile. |
||
list of int
|
atom2chainIndices(self,
indices,
breaks=0) Convert atom indices to chain indices. |
||
list of int
|
chain2atomIndices(self,
indices,
breaks=0) Convert chain indices into atom indices. |
||
array
|
profile2mask(self,
profName,
cutoff_min=None,
cutoff_max=None) profile2mask( str_profname, [cutoff_min, cutoff_max=None]) |
||
array
|
profile2atomMask(self,
profName,
cutoff_min=None,
cutoff_max=None) profile2atomMask( str_profname, [cutoff_min, cutoff_max=None]) Same as profile2mask, but converts residue mask to atom mask. |
||
list of int
|
__takeAtomIndices(self,
oldI,
takeI) Translate atom positions so that they point to the same atoms after a call to N.take() (if they are kept at all). |
||
| __takeResIndices(self, oldI, takeI) | ||
|
concat(self,
*models) Concatenate atoms, coordinates and profiles. |
||
PDBModel
|
take(self,
i,
deepcopy=0) All fields of the result model are shallow copies of this model's fields. |
||
|
keep(self,
i) Replace atoms,coordinates,profiles of this(!) model with sub-set. |
||
PDBModel
|
clone(self,
deepcopy=0) Clone PDBModel. |
||
PDBModel
|
compress(self,
mask,
deepcopy=0) Compress PDBmodel using mask. |
||
array
|
remove(self,
what) Convenience access to the 3 different remove methods. |
||
PDBModel
|
takeChains(self,
chainLst,
deepcopy=0,
breaks=0,
maxDist=None) Get copy of this model with only the given chains. |
||
|
addChainFromSegid(self,
verbose=1) Takes the last letter of the segment ID and adds it as chain ID. |
||
|
addChainId(self,
first_id=None,
keep_old=0,
breaks=0) Assign consecutive chain identifiers A - Z to all atoms. |
||
|
renumberResidues(self,
mask=None,
start=1,
addChainId=1) Make all residue numbers consecutive and remove any insertion code letters. |
||
int
|
lenAtoms(self) Number of atoms in model. |
||
int
|
lenResidues(self) Number of resudies in model. |
||
int
|
lenChains(self,
breaks=0,
maxDist=None) Number of chains in model. |
||
list of dictionaries
|
resList(self,
mask=None) Return list of lists of atom dictionaries per residue, which allows to iterate over residues and atoms of residues. |
||
list of PDBModels
|
resModels(self) Creates a PDBModel per residue in PDBModel. |
||
list of int
|
resMapOriginal(self,
mask=None) Generate list to map from any atom to its ORIGINAL(!) PDB residue number. |
||
list of int
|
__calcResMap(self,
mask=None) Create a map of residue residue for atoms in model. |
||
list of int
|
resMap(self,
mask=None,
force=0,
cache=1) Get list to map from any atom to a continuous residue numbering (starting with 0). |
||
list of int
|
resIndex(self,
mask=None,
force=0,
cache=1) Get the position of the each residue's first atom. |
||
list of int
|
resEndIndex(self,
mask=None) Get the position of the each residue's last atom. |
||
list of int
|
chainMap(self,
breaks=0,
maxDist=None) Get chain index of each atom. |
||
list of int
|
chainIndex(self,
breaks=0,
maxDist=None) Get indices of first atom of each chain. |
||
list of int
|
chainBreaks(self,
breaks_only=1,
maxDist=None) Identify discontinuities in the molecule's backbone. |
||
|
removeRes(self,
resname) Remove all atoms with a certain residue name. |
||
float
|
rms(self,
other,
mask=None,
mask_fit=None,
fit=1,
n_it=1) Rmsd between two PDBModels. |
||
array, array
|
transformation(self,
refModel,
mask=None,
n_it=1,
z=2,
eps_rmsd=0.5,
eps_stdv=0.05,
profname='rms_outlier') Get the transformation matrix which least-square fits this model onto the other model. |
||
PDBModel
|
transform(self,
*rt) Transform coordinates of PDBModel. |
||
PDBModel
|
fit(self,
refModel,
mask=None,
n_it=1,
z=2,
eps_rmsd=0.5,
eps_stdv=0.05,
profname='rms_outlier') Least-square fit this model onto refMode |
||
PDBModel
|
magicFit(self,
refModel,
mask=None) Superimpose this model onto a ref. |
||
PDBModel
|
centered(self,
mask=None) Get model with centered coordinates. |
||
(float, float, float)
|
center(self,
mask=None) Geometric centar of model. |
||
(float, float, float)
|
centerOfMass(self) Center of mass of PDBModel. |
||
array of floats
|
masses(self) Collect the molecular weight of all atoms in PDBModel. |
||
float
|
mass(self) Molecular weight of PDBModel. |
||
array of float
|
residusMaximus(self,
atomValues,
mask=None) Take list of value per atom, return list where all atoms of any residue are set to the highest value of any atom in that residue. |
||
list of int
|
argsort(self,
cmpfunc=None) Prepare sorting atoms within residues according to comparison function. |
||
PDBModel
|
sort(self,
sortArg=None,
deepcopy=0) Apply a given sort list to the atoms of this model. |
||
list of int
|
unsort(self,
sortList) Undo a previous sorting on the model itself (no copy). |
||
list of str
|
atomNames(self,
start=None,
stop=None) Return a list of atom names from start to stop RESIDUE index |
||
1|0
|
__testDict_and(self,
dic,
condition) Test if all key-value pairs of condition are matched in dic |
||
1|0
|
__testDict_or(self,
dic,
condition) Test if any key-value pairs of condition are matched in dic |
||
list of int
|
filterIndex(self,
mode=0,
**kw) Get atom positions that match a combination of key=values. |
||
PDBModel
|
filter(self,
mode=0,
**kw) Extract atoms that match a combination of key=values. |
||
list if int
|
equals(self,
ref,
start=None,
stop=None) Compares the residue and atom sequence in the given range. |
||
(array, array)
|
equalAtoms(self,
ref) Apply to SORTED models without HETATOMS. |
||
([int], [int])
|
compareAtoms(self,
ref) Get list of atom indices for this and reference model that converts both into 2 models with identical residue and atom content. |
||
float
|
__chainFraction(self,
chain,
ref) Look how well a given chain matches a continuous stretch of residues in ref. |
||
([int], [int])
|
compareChains(self,
ref,
breaks=0,
fractLimit=0.2) Get list of corresponding chain indices for this and reference model. |
|
|
|
called before pickling the object. |
called for unpickling the object. |
|
backwards compatibility to earlier pickled models |
Read coordinates, atoms, fileName, etc. from PDB or pickled PDBModel - but only if they are currently empty. The atomsChanged and xyzChanged flags are not changed.
|
|
Replace coordinates.
|
Replace atoms list of dictionaries. self.__terAtoms is re-created from the 'after_ter' records in atoms
|
|
Get coordinates, fetch from source PDB or pickled PDBModel, if necessary.
|
Get atom dictionaries, fetch from source PDB or pickled PDBModel, if necessary. See also __collectAll() .
|
Add/override residue-based profile.
|
Add/override atom-based profile.
|
Use: resProfile( profile_name ) -> array 1 x N_res with residue values
|
Use: atomProfile( profile_name ) -> array 1 x N_atoms with atom values
|
Use: profile( name, lookHarder=0) -> atom or residue profile
|
Use: profileInfo( name ) -> dict with infos about profile
|
{'bin':'whatif'})
|
Remove residue or atom profile(s) Use:removeProfile( str_name [,name2, name3] ) -> 1|0,
|
Tell if xyz or atoms have been changed compared to source file or source object (which can be still in memory).
|
Tell whether xyz and atoms can currently be reconstructed from a source on disc. Same as isChanged() unless source is another not yet saved PDBModel instance that made changes relative to its own source ...
|
Check if profile has changed compared to source.
|
Remove profiles, that haven't been changed from a direct or indirect source on disc AUTOMATICALLY CALLED BEFORE PICKLING |
Remove xyz array and list of atoms if they haven't been changed and could hence be loaded from the source file (only if there is a source file...). Remove any unchanged profiles. AUTOMATICALLY CALLED BEFORE PICKLING |
Check for a valid source on disk.
|
Name of pickled source or PDB file.
|
Disconnect this model from its source (if any).
|
Return pdb code of model.
|
Set model pdb code.
|
Amino acid sequence in one letter code.
|
Rename atoms so that tleap from Amber can read the PDB. If HIS residues contain atoms named HE2 or/and HD2, the residue name is changed to HIE or HID or HIP, respectively. Disulfide bonds are not yet identified - CYS -> CYX renaming must be done manually (see AmberParmBuilder for an example). Internally amber uses H atom names ala HD21 while standard pdb files use 1HD2. By default, ambpdb produces 'standard' pdb atom names but it gives the less ambiguous amber names with switch -aatm.
|
Save model as PDB file.
|
Restore PDB file from (possibly transformed) coordinates and pdb line dictionaries in self.atoms. This is an older version of writePdb that returns a list of PDB lines instead of writing to a file.
|
Pickle this PDBModel to a file, set the 'source' field to this file name and mark atoms, xyz, and profiles as unchanged. Normal pickling of the object will only dump those data that can not be reconstructed from the source of this model (if any). saveAs creates a 'new source' without further dependencies.
|
Create list whith result of atomFunction( atom ) for each atom.
|
Short cut for mask of all CA atoms.
|
Short cut for mask of all backbone atoms.
|
Short cut for mask of all heavy atoms. ('element' <> H)
|
Short cut for mask of hydrogens. ('element' == H)
|
Short cut for mask of all CB and CA of GLY.
|
Short cut for mask of all atoms in residues named TIP3, HOH and WAT
|
Short cut for mask of all atoms in residues named TIP3, HOH, WAT, Na+, Cl-
|
Short cut for mask of all HETATM
|
Short cut for mask containing all atoms of amino acids.
|
Get atom indices conforming condition
|
Get atom mask.
|
Mask (0) residues for which all atoms are masked (0) in atomMask.
|
Get list of indices of residue for which any atom is in indices.
|
convert residue mask to atom mask.
|
Convert residue indices to atom indices.
|
Get an atom profile where each atom has the value its residue has in the residue profile.
|
Convert atom indices to chain indices. Each chain is only returned once.
|
Convert chain indices into atom indices.
|
profile2mask( str_profname, [cutoff_min, cutoff_max=None])
|
profile2atomMask( str_profname, [cutoff_min, cutoff_max=None]) Same as profile2mask, but converts residue mask to atom mask.
|
Translate atom positions so that they point to the same atoms after a call to N.take() (if they are kept at all).
|
|
Concatenate atoms, coordinates and profiles. source and fileName are lost, so are profiles that are not available in all models. model0.concat( model1 [, model2, ..]) -> single PDBModel.
|
All fields of the result model are shallow copies of this model's fields. I.e. removing or reordering of atoms does not affect the original model but changes to entries in the atoms dictionaries would also change the atom dictionaries of this model. take( atomIndices, [deepcopy=0] ) -> PDBModel / sub-class.
|
Replace atoms,coordinates,profiles of this(!) model with sub-set. (in-place version of N.take() )
|
Clone PDBModel.
|
Compress PDBmodel using mask. compress( mask, [deepcopy=0] ) -> PDBModel
|
Convenience access to the 3 different remove methods. The mask used to remove atoms is returned. This mask can be used to apply the same change to another array of same dimension as the old(!) xyz and atoms.
|
Get copy of this model with only the given chains.
|
Takes the last letter of the segment ID and adds it as chain ID. |
Assign consecutive chain identifiers A - Z to all atoms.
|
Make all residue numbers consecutive and remove any insertion code letters. Note that a backward jump in residue numbering is interpreted as end of chain by chainMap() and chainIndex(). Chain borders might hence get lost if there is no change in chain label or segid.
|
Number of atoms in model.
|
Number of resudies in model.
|
Number of chains in model.
|
Return list of lists of atom dictionaries per residue, which allows to iterate over residues and atoms of residues.
|
Creates a PDBModel per residue in PDBModel.
|
Generate list to map from any atom to its ORIGINAL(!) PDB residue number.
|
Create a map of residue residue for atoms in model.
|
Get list to map from any atom to a continuous residue numbering (starting with 0). A new residue is assumed to start whenever the 'residue_number' or the 'residue_name' record changes between 2 atoms. The mask is applied BEFORE looking for residue borders, i.e. it can change the residue numbering. See resList() for an example of how to use the residue map.
|
Get the position of the each residue's first atom. The result is by default cached. That's not really necessary - The calculation is fast.
|
Get the position of the each residue's last atom.
|
Get chain index of each atom. A new chain is started between 2 atoms if the chain_id or segment_id changes, the residue numbering jumps back or a TER record was found.
|
Get indices of first atom of each chain.
|
Identify discontinuities in the molecule's backbone.
|
Remove all atoms with a certain residue name.
|
Rmsd between two PDBModels.
|
Get the transformation matrix which least-square fits this model onto the other model.
|
Transform coordinates of PDBModel.
|
Least-square fit this model onto refMode
|
Superimpose this model onto a ref. model with similar atom content. magicFit( refModel [, mask ] ) -> PDBModel (or subclass )
|
Get model with centered coordinates.
|
Geometric centar of model.
|
Center of mass of PDBModel.
|
Collect the molecular weight of all atoms in PDBModel.
|
Molecular weight of PDBModel.
|
Take list of value per atom, return list where all atoms of any residue are set to the highest value of any atom in that residue. (after applying mask)
|
Prepare sorting atoms within residues according to comparison function.
|
Apply a given sort list to the atoms of this model.
|
Undo a previous sorting on the model itself (no copy).
|
Return a list of atom names from start to stop RESIDUE index
|
Test if all key-value pairs of condition are matched in dic
|
Test if any key-value pairs of condition are matched in dic
|
Get atom positions that match a combination of key=values. E.g. filter( chain_id='A', name=['CA','CB'] ) -> index
|
Extract atoms that match a combination of key=values. E.g. filter( chain_id='A', name=['CA','CB'] ) -> PDBModel
|
Compares the residue and atom sequence in the given range. Coordinates are not checked, profiles are not checked.
|
Apply to SORTED models without HETATOMS. Coordinates are not checked.
|
Get list of atom indices for this and reference model that converts both into 2 models with identical residue and atom content. E.g.>>> m2 = m1.sort() ## m2 has now different atom order >>> i2, i1 = m2.compareAtoms( m1 ) >>> m1 = m1.take( i1 ); m2 = m2.take( i2 ) >>> m1.atomNames() == m2.atomNames() ## m2 has again same atom order
|
Look how well a given chain matches a continuous stretch of residues in ref.
|
Get list of corresponding chain indices for this and reference model. Use takeChains() to create two models with identical chain content and order from the result of this function.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0alpha3 on Fri Dec 22 20:11:45 2006 | http://epydoc.sourceforge.net |