
Ic           @   s_   d  d l  Z  d  d l m Z d  d l m Z d Z d d	 d     YZ d e f d     YZ d S(
   iN(   t   DisorderedEntityWrapper(   t   Vectors&   Atom class, used in Structure objects.t   Atomc           B   s  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  RS(   c         C   s   d |  _  d |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d |  _	 | |  _
 d |  _ d |  _ d |  _ d |  _ | |  _ i  |  _ d S(   s  
        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
        t   Ai    N(   t   levelt   Nonet   parentt   namet   fullnamet   coordt   bfactort	   occupancyt   altloct   full_idt   idt   disordered_flagt   anisou_arrayt   siguij_arrayt   sigatm_arrayt   serial_numbert   xtra(   t   selfR   R	   R
   R   R   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   __init__   s     															c         C   s   d |  j    S(   s&   Print Atom object as <Atom atom_name>.s	   <Atom %s>(   t   get_id(   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   __repr__B   s    c         C   s)   |  j  | j  } t j t j | |   S(   s   
        Calculate distance between two atoms.
        
        Example:
            >>> distance=atom1-atom2

        @param other: the other atom
        @type other: L{Atom}
        (   R	   t   numpyt   sqrtt   dot(   R   t   othert   diff(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   __sub__F   s    
c         C   s   | |  _  d  S(   N(   R   (   R   t   n(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   set_serial_numberU   s    c         C   s   | |  _  d  S(   N(   R
   (   R   R
   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   set_bfactorX   s    c         C   s   | |  _  d  S(   N(   R	   (   R   R	   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt	   set_coord[   s    c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   set_altloc^   s    c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   set_occupancya   s    c         C   s   | |  _  d S(   sJ  
        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)
        N(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   set_sigatmd   s    c         C   s   | |  _  d S(   s   
        Set standard deviations of anisotropic temperature factors.

        @param siguij_array: standard deviations of anisotropic temperature factors.
        @type siguij_array: Numeric array (length 6)
        N(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   set_siguijq   s    c         C   s   | |  _  d S(   s   
        Set anisotropic B factor.

        @param anisou_array: anisotropic B factor.
        @type anisou_array: Numeric array (length 6)
        N(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   set_anisouz   s    c         C   s   d |  _  d S(   st   Set the disordered flag to 1.

        The disordered flag indicates whether the atom is disordered or not.
        i   N(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   flag_disorder   s    c         C   s   |  j  S(   s:   Return the disordered flag (1 if disordered, 0 otherwise).(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   is_disordered   s    c         C   s   | |  _  d S(   sV   Set the parent residue.

        Arguments:
        o parent - Residue object
        N(   R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   set_parent   s    c         C   s   d |  _ d S(   s   Remove reference to parent.N(   R   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   detach_parent   s    c         C   s   |  j  S(   s/   Return standard deviation of atomic parameters.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   get_sigatm   s    c         C   s   |  j  S(   s>   Return standard deviations of anisotropic temperature factors.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   get_siguij   s    c         C   s   |  j  S(   s   Return anisotropic B factor.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   get_anisou   s    c         C   s   |  j  S(   s   Return parent residue.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   get_parent   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   get_serial_number   s    c         C   s   |  j  S(   s   Return atom name.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   get_name   s    c         C   s   |  j  S(   s3   Return the id of the atom (which is its atom name).(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyR      s    c         C   s    |  j  j   |  j |  j f f S(   s   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).
        (   R   t   get_full_idR   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyR2      s    c         C   s   |  j  S(   s   Return atomic coordinates.(   R	   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt	   get_coord   s    c         C   s   |  j  S(   s   Return B factor.(   R
   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   get_bfactor   s    c         C   s   |  j  S(   s   Return occupancy.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   get_occupancy   s    c         C   s   |  j  S(   s<   Return the atom name, including leading and trailing spaces.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   get_fullname   s    c         C   s   |  j  S(   s&   Return alternative location specifier.(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   get_altloc   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt	   get_level   s    c         C   s    t  j |  j |  | |  _ d S(   s  
        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
        N(   R   R   R	   (   R   t   rott   tran(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt	   transform   s    c         C   s"   |  j  \ } } } t | | |  S(   sq   
        Return coordinates as Vector.

        @return: coordinates as 3D vector
        @rtype: Vector
        (   R	   R   (   R   t   xt   yt   z(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt
   get_vector   s    (!   t   __name__t
   __module__R   R   R   R    R!   R"   R#   R$   R%   R&   R'   R(   R)   R*   R+   R,   R-   R.   R/   R0   R1   R   R2   R3   R4   R5   R6   R7   R8   R;   R?   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyR      s>   	2																														t   DisorderedAtomc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s  
    This class contains all Atom objects that represent the same disordered
    atom. One of these atoms is "selected" and all method calls not caught
    by DisorderedAtom are forwarded to the selected Atom object. In that way, a
    DisorderedAtom behaves exactly like a normal Atom. By default, the selected 
    Atom object represents the Atom object with the highest occupancy, but a 
    different Atom object can be selected by using the disordered_select(altloc) 
    method. 
    c         C   s   d |  _  t j |  |  d S(   s=   
        Arguments:
        o id - string, atom name
        iN(   t   last_occupancyR    R   (   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyR      s    	c         C   s   d |  j    S(   Ns   <Disordered Atom %s>(   R   (   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyR     s    c         C   sq   | j    |  j   } | j |  | j   } | j   } | |  | <| |  j k rm | |  _ |  j |  n  d S(   s   Add a disordered atom.N(   R(   R/   R*   R7   R5   RC   t   disordered_select(   R   t   atomt   residueR   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   disordered_add
  s    

	(   R@   RA   t   __doc__R   R   RG   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyRB      s   		
	(    (   R   t   EntityR    R   RH   R   RB   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/PDB/Atom.pyt   <module>   s
   