Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Member Functions
Bio.PDB.Atom.Atom Class Reference

List of all members.

Public Member Functions

def __init__
def __repr__
def __sub__
def set_serial_number
def set_bfactor
def set_coord
def set_altloc
def set_occupancy
def set_sigatm
def set_siguij
def set_anisou
def flag_disorder
def is_disordered
def set_parent
def detach_parent
def get_sigatm
def get_siguij
def get_anisou
def get_parent
def get_serial_number
def get_name
def get_id
def get_full_id
def get_coord
def get_bfactor
def get_occupancy
def get_fullname
def get_altloc
def get_level
def transform
def get_vector
def copy

Public Attributes

 level
 parent
 name
 fullname
 coord
 bfactor
 occupancy
 altloc
 full_id
 id
 disordered_flag
 anisou_array
 siguij_array
 sigatm_array
 serial_number
 xtra
 element
 mass

Private Member Functions

def _assign_element
def _assign_atom_mass

Detailed Description

Definition at line 17 of file Atom.py.


Constructor & Destructor Documentation

def Bio.PDB.Atom.Atom.__init__ (   self,
  name,
  coord,
  bfactor,
  occupancy,
  altloc,
  fullname,
  serial_number,
  element = None 
)
Atom object.

The Atom object stores atom name (both with and without spaces), 
coordinates, B factor, occupancy, alternative location specifier
and (optionally) anisotropic B factor and standard deviations of 
B factor and positions.
  
@param name: atom name (eg. "CA"). Note that spaces are normally stripped.
@type name: string

@param coord: atomic coordinates (x,y,z)
@type coord: Numeric array (Float0, size 3)

@param bfactor: isotropic B factor
@type bfactor: number 

@param occupancy: occupancy (0.0-1.0)
@type occupancy: number

@param altloc: alternative location specifier for disordered atoms
@type altloc: string

@param fullname: full atom name, including spaces, e.g. " CA ". Normally
these spaces are stripped from the atom name. 
@type fullname: string

@param element: atom element, e.g. "C" for Carbon, "HG" for mercury,
@type fullname: uppercase string (or None if unknown)

Definition at line 19 of file Atom.py.

00019 
00020                  element=None):
00021         """
00022         Atom object.
00023 
00024         The Atom object stores atom name (both with and without spaces), 
00025         coordinates, B factor, occupancy, alternative location specifier
00026         and (optionally) anisotropic B factor and standard deviations of 
00027         B factor and positions.
00028   
00029         @param name: atom name (eg. "CA"). Note that spaces are normally stripped.
00030         @type name: string
00031 
00032         @param coord: atomic coordinates (x,y,z)
00033         @type coord: Numeric array (Float0, size 3)
00034 
00035         @param bfactor: isotropic B factor
00036         @type bfactor: number 
00037 
00038         @param occupancy: occupancy (0.0-1.0)
00039         @type occupancy: number
00040 
00041         @param altloc: alternative location specifier for disordered atoms
00042         @type altloc: string
00043 
00044         @param fullname: full atom name, including spaces, e.g. " CA ". Normally
00045         these spaces are stripped from the atom name. 
00046         @type fullname: string
00047 
00048         @param element: atom element, e.g. "C" for Carbon, "HG" for mercury,
00049         @type fullname: uppercase string (or None if unknown)
00050      
00051         """
00052         self.level="A"
00053         # Reference to the residue 
00054         self.parent=None
00055         # the atomic data
00056         self.name=name      # eg. CA, spaces are removed from atom name
00057         self.fullname=fullname  # e.g. " CA ", spaces included
00058         self.coord=coord
00059         self.bfactor=bfactor
00060         self.occupancy=occupancy
00061         self.altloc=altloc
00062         self.full_id=None   # (structure id, model id, chain id, residue id, atom id)
00063         self.id=name        # id of atom is the atom name (e.g. "CA")
00064         self.disordered_flag=0
00065         self.anisou_array=None
00066         self.siguij_array=None
00067         self.sigatm_array=None
00068         self.serial_number=serial_number
00069         # Dictionary that keeps addictional properties
00070         self.xtra={}
00071         assert not element or element == element.upper(), element
00072         self.element = self._assign_element(element)
00073         self.mass = self._assign_atom_mass()
        

Member Function Documentation

Definition at line 113 of file Atom.py.

00113 
00114     def __repr__(self):
00115         "Print Atom object as <Atom atom_name>."
00116         return "<Atom %s>" % self.get_id()

Here is the call graph for this function:

def Bio.PDB.Atom.Atom.__sub__ (   self,
  other 
)
Calculate distance between two atoms.

Example:
    >>> distance=atom1-atom2

@param other: the other atom
@type other: L{Atom}

Definition at line 117 of file Atom.py.

00117 
00118     def __sub__(self, other):
00119         """
00120         Calculate distance between two atoms.
00121         
00122         Example:
00123             >>> distance=atom1-atom2
00124 
00125         @param other: the other atom
00126         @type other: L{Atom}
00127         """
00128         diff=self.coord-other.coord
00129         return numpy.sqrt(numpy.dot(diff,diff))

def Bio.PDB.Atom.Atom._assign_atom_mass (   self) [private]

Definition at line 103 of file Atom.py.

00103 
00104     def _assign_atom_mass(self):
00105         # Needed for Bio/Struct/Geometry.py C.O.M. function
00106         if self.element:
00107             return IUPACData.atom_weights[self.element.capitalize()]
00108         else:
00109             return float('NaN')
00110 

def Bio.PDB.Atom.Atom._assign_element (   self,
  element 
) [private]
Tries to guess element from atom name if not recognised.

Definition at line 74 of file Atom.py.

00074 
00075     def _assign_element(self, element):
00076         """Tries to guess element from atom name if not recognised."""
00077         if not element or element.capitalize() not in IUPACData.atom_weights:
00078             # Inorganic elements have their name shifted left by one position 
00079             #  (is a convention in PDB, but not part of the standard).
00080             # isdigit() check on last two characters to avoid mis-assignment of 
00081             # hydrogens atoms (GLN HE21 for example)
00082 
00083             if self.fullname[0] != " " and not self.fullname[2:].isdigit():
00084                 putative_element = self.name.strip()
00085             else:
00086                 # Hs may have digit in [0]
00087                 if self.name[0].isdigit():
00088                     putative_element = self.name[1]
00089                 else:
00090                     putative_element = self.name[0]
00091             
00092             if putative_element.capitalize() in IUPACData.atom_weights:
00093                 msg = "Used element %r for Atom (name=%s) with given element %r" \
00094                       % (putative_element, self.name, element)
00095                 element = putative_element
00096             else:
00097                 msg = "Could not assign element %r for Atom (name=%s) with given element %r" \
00098                       % (putative_element, self.name, element)
00099                 element = ""
00100             warnings.warn(msg, PDBConstructionWarning)
00101                 
00102         return element
        
def Bio.PDB.Atom.Atom.copy (   self)
Create a copy of the Atom.
Parent information is lost.

Definition at line 289 of file Atom.py.

00289 
00290     def copy(self):
00291         """
00292         Create a copy of the Atom.
00293         Parent information is lost.
00294         """
00295         # Do a shallow copy then explicitly copy what needs to be deeper.
00296         shallow = copy.copy(self)
00297         shallow.detach_parent()
00298         shallow.set_coord(copy.copy(self.get_coord()))
00299         shallow.xtra = self.xtra.copy()
00300         return shallow
00301 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 200 of file Atom.py.

00200 
00201     def detach_parent(self):
00202         "Remove reference to parent."
00203         self.parent=None

Set the disordered flag to 1.

The disordered flag indicates whether the atom is disordered or not.

Definition at line 181 of file Atom.py.

00181 
00182     def flag_disorder(self):
00183         """Set the disordered flag to 1.
00184 
00185         The disordered flag indicates whether the atom is disordered or not.
00186         """
00187         self.disordered_flag=1

Definition at line 255 of file Atom.py.

00255 
00256     def get_altloc(self):
00257         "Return alternative location specifier."
00258         return self.altloc

Definition at line 212 of file Atom.py.

00212 
00213     def get_anisou(self):
00214         "Return anisotropic B factor."
00215         return self.anisou_array

Definition at line 243 of file Atom.py.

00243 
00244     def get_bfactor(self):
00245         "Return B factor."
00246         return self.bfactor

Definition at line 239 of file Atom.py.

00239 
00240     def get_coord(self):
00241         "Return atomic coordinates."
00242         return self.coord

Here is the caller graph for this function:

Return the full id of the atom.

The full id of an atom is the tuple 
(structure id, model id, chain id, residue id, atom name, altloc).

Definition at line 231 of file Atom.py.

00231 
00232     def get_full_id(self):
00233         """Return the full id of the atom.
00234 
00235         The full id of an atom is the tuple 
00236         (structure id, model id, chain id, residue id, atom name, altloc).
00237         """
00238         return self.parent.get_full_id()+((self.name, self.altloc),)
    

Definition at line 251 of file Atom.py.

00251 
00252     def get_fullname(self):
00253         "Return the atom name, including leading and trailing spaces."
00254         return self.fullname

def Bio.PDB.Atom.Atom.get_id (   self)

Definition at line 227 of file Atom.py.

00227 
00228     def get_id(self):
00229         "Return the id of the atom (which is its atom name)."
00230         return self.id

Here is the caller graph for this function:

Definition at line 259 of file Atom.py.

00259 
00260     def get_level(self):
00261         return self.level

Definition at line 223 of file Atom.py.

00223 
00224     def get_name(self):
00225         "Return atom name."
00226         return self.name

Definition at line 247 of file Atom.py.

00247 
00248     def get_occupancy(self):
00249         "Return occupancy."
00250         return self.occupancy

Definition at line 216 of file Atom.py.

00216 
00217     def get_parent(self):
00218         "Return parent residue."
00219         return self.parent

Here is the caller graph for this function:

Definition at line 220 of file Atom.py.

00220 
00221     def get_serial_number(self):
00222         return self.serial_number

Definition at line 204 of file Atom.py.

00204 
00205     def get_sigatm(self):
00206         "Return standard deviation of atomic parameters."
00207         return self.sigatm_array

Definition at line 208 of file Atom.py.

00208 
00209     def get_siguij(self):
00210         "Return standard deviations of anisotropic temperature factors."
00211         return self.siguij_array

Return coordinates as Vector.

@return: coordinates as 3D vector
@rtype: Vector

Definition at line 279 of file Atom.py.

00279 
00280     def get_vector(self):
00281         """
00282         Return coordinates as Vector.
00283 
00284         @return: coordinates as 3D vector
00285         @rtype: Vector
00286         """
00287         x,y,z=self.coord
00288         return Vector(x,y,z)

Definition at line 188 of file Atom.py.

00188 
00189     def is_disordered(self):
00190         "Return the disordered flag (1 if disordered, 0 otherwise)."
00191         return self.disordered_flag 

def Bio.PDB.Atom.Atom.set_altloc (   self,
  altloc 
)

Definition at line 141 of file Atom.py.

00141 
00142     def set_altloc(self, altloc):
00143         self.altloc=altloc

def Bio.PDB.Atom.Atom.set_anisou (   self,
  anisou_array 
)
Set anisotropic B factor.

@param anisou_array: anisotropic B factor.
@type anisou_array: Numeric array (length 6)

Definition at line 169 of file Atom.py.

00169 
00170     def set_anisou(self, anisou_array):
00171         """
00172         Set anisotropic B factor.
00173 
00174         @param anisou_array: anisotropic B factor.
00175         @type anisou_array: Numeric array (length 6)
00176         """
00177         self.anisou_array=anisou_array
00178 

def Bio.PDB.Atom.Atom.set_bfactor (   self,
  bfactor 
)

Definition at line 135 of file Atom.py.

00135 
00136     def set_bfactor(self, bfactor):
00137         self.bfactor=bfactor

def Bio.PDB.Atom.Atom.set_coord (   self,
  coord 
)

Definition at line 138 of file Atom.py.

00138 
00139     def set_coord(self, coord):
00140         self.coord=coord

def Bio.PDB.Atom.Atom.set_occupancy (   self,
  occupancy 
)

Definition at line 144 of file Atom.py.

00144 
00145     def set_occupancy(self, occupancy):
00146         self.occupancy=occupancy

def Bio.PDB.Atom.Atom.set_parent (   self,
  parent 
)
Set the parent residue.

Arguments:
o parent - Residue object

Definition at line 192 of file Atom.py.

00192 
00193     def set_parent(self, parent):
00194         """Set the parent residue.
00195 
00196         Arguments:
00197         o parent - Residue object
00198         """
00199         self.parent=parent
    
def Bio.PDB.Atom.Atom.set_serial_number (   self,
  n 
)

Definition at line 132 of file Atom.py.

00132 
00133     def set_serial_number(self, n):
00134         self.serial_number=n

def Bio.PDB.Atom.Atom.set_sigatm (   self,
  sigatm_array 
)
Set standard deviation of atomic parameters.

The standard deviation of atomic parameters consists
of 3 positional, 1 B factor and 1 occupancy standard 
deviation.

@param sigatm_array: standard deviations of atomic parameters.
@type sigatm_array: Numeric array (length 5)

Definition at line 147 of file Atom.py.

00147 
00148     def set_sigatm(self, sigatm_array):
00149         """
00150         Set standard deviation of atomic parameters.
00151 
00152         The standard deviation of atomic parameters consists
00153         of 3 positional, 1 B factor and 1 occupancy standard 
00154         deviation.
00155 
00156         @param sigatm_array: standard deviations of atomic parameters.
00157         @type sigatm_array: Numeric array (length 5)
00158         """
00159         self.sigatm_array=sigatm_array

def Bio.PDB.Atom.Atom.set_siguij (   self,
  siguij_array 
)
Set standard deviations of anisotropic temperature factors.

@param siguij_array: standard deviations of anisotropic temperature factors.
@type siguij_array: Numeric array (length 6)

Definition at line 160 of file Atom.py.

00160 
00161     def set_siguij(self, siguij_array):
00162         """
00163         Set standard deviations of anisotropic temperature factors.
00164 
00165         @param siguij_array: standard deviations of anisotropic temperature factors.
00166         @type siguij_array: Numeric array (length 6)
00167         """
00168         self.siguij_array=siguij_array

def Bio.PDB.Atom.Atom.transform (   self,
  rot,
  tran 
)
Apply rotation and translation to the atomic coordinates.

Example:
>>> rotation=rotmat(pi, Vector(1,0,0))
>>> translation=array((0,0,1), 'f')
>>> atom.transform(rotation, translation)

@param rot: A right multiplying rotation matrix
@type rot: 3x3 Numeric array

@param tran: the translation vector
@type tran: size 3 Numeric array

Definition at line 262 of file Atom.py.

00262 
00263     def transform(self, rot, tran):
00264         """
00265         Apply rotation and translation to the atomic coordinates.
00266 
00267         Example:
00268                 >>> rotation=rotmat(pi, Vector(1,0,0))
00269                 >>> translation=array((0,0,1), 'f')
00270                 >>> atom.transform(rotation, translation)
00271 
00272         @param rot: A right multiplying rotation matrix
00273         @type rot: 3x3 Numeric array
00274 
00275         @param tran: the translation vector
00276         @type tran: size 3 Numeric array
00277         """
00278         self.coord=numpy.dot(self.coord, rot)+tran
        

Member Data Documentation

Definition at line 60 of file Atom.py.

Definition at line 64 of file Atom.py.

Definition at line 58 of file Atom.py.

Definition at line 57 of file Atom.py.

Definition at line 63 of file Atom.py.

Definition at line 71 of file Atom.py.

Definition at line 61 of file Atom.py.

Definition at line 56 of file Atom.py.

Definition at line 62 of file Atom.py.

Definition at line 51 of file Atom.py.

Definition at line 72 of file Atom.py.

Definition at line 55 of file Atom.py.

Definition at line 59 of file Atom.py.

Definition at line 53 of file Atom.py.

Definition at line 67 of file Atom.py.

Definition at line 66 of file Atom.py.

Definition at line 65 of file Atom.py.

Definition at line 69 of file Atom.py.


The documentation for this class was generated from the following file: