home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Residue_PDB.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  4.2 KB  |  151 lines

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net>                |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Residue_PDB.php,v 1.4 2003/01/04 11:56:25 mj Exp $
  20. //
  21.  
  22. require_once "Science/Chemistry.php";
  23. require_once "Science/Chemistry/Atom_PDB.php";
  24. require_once "Science/Chemistry/Molecule.php";
  25.  
  26. /**
  27.  * Represents a PDB residue 
  28.  *
  29.  * @author  Jesus M. Castagnetto <jmcastagnetto@php.net>
  30.  * @version 1.0
  31.  * @access  public
  32.  * @package Science_Chemistry
  33.  */
  34. class Science_Chemistry_Residue_PDB extends Science_Chemistry_Molecule {
  35.  
  36.     /**
  37.      * PDB Residue sequence number
  38.      *
  39.      * @var     integer
  40.      * @access   private
  41.      */
  42.     var $seq_num;
  43.  
  44.     /**
  45.      * PDB Residue chain
  46.      *
  47.      * @var     string
  48.      * @access  private
  49.      */
  50.     var $chain;
  51.  
  52.     /**
  53.      * PDB Residue ID
  54.      * $id = "$name:$seq_num:$chain"
  55.      *
  56.      * @var     string
  57.      * @access  private
  58.      */
  59.     var $id;
  60.  
  61.     /**
  62.      * PDB ID for the protein that contains
  63.      * this residue
  64.      *
  65.      * @var     string
  66.      * @access  private
  67.      */
  68.     var $pdb;
  69.  
  70.     /**
  71.      * If the PDB residue object has been initialized
  72.      *
  73.      * @var     boolean
  74.      * @access  public
  75.      */
  76.     var $VALID = false;
  77.  
  78.  
  79.     /**
  80.      * Reference to the protein
  81.      * to which this residue belongs
  82.      *
  83.      * @var      object  Science_Chemistry_Macromolecule_PDB
  84.      * @access   public
  85.      */
  86.     var $macromol;
  87.     
  88.     /**
  89.      * Constructor for the class
  90.      *
  91.      * @param   string  $pdb    PDB if of the protein/nucleic acid/etc.
  92.      * @param   array   $atomrec_arr    Array of PDB atom record lines
  93.      * @param   object  Science_Chemistry_Macromolecule_PDB  $macromol   reference to the containing macromolecule
  94.      * @return  object  Science_Chemistry_Residue_PDB
  95.      * @access  public
  96.      */
  97.     function Science_Chemistry_Residue_PDB($pdb, $atomrec_arr, $macromol="") {
  98.         for ($i=0; $i < count($atomrec_arr); $i++)
  99.             $this->atoms[] = new Science_Chemistry_Atom_PDB(&$atomrec_arr[$i], &$this);
  100.         if (!empty($this->atoms)) {
  101.             $this->VALID = true;
  102.             $this->macromol =& $macromol;
  103.             $this->pdb =& $pdb;
  104.             $this->num_atoms = count($this->atoms);
  105.             $line =& $atomrec_arr[0];
  106.             $this->name = trim(substr($line,17,3));
  107.             $this->chain = trim(substr($line,21,1));
  108.             $this->seq_num = (int) trim(substr($line,22,4));
  109.             $this->id = $this->name.":".$this->seq_num.":".$this->chain;
  110.         } else {
  111.             return null;
  112.         }
  113.     }
  114.  
  115.  
  116.     /**
  117.      * Calculates geometrical parameters for the residue
  118.      * Backbone bond distances, angles and torsions
  119.      * Sidechain Chi angles
  120.      * TODO
  121.      *
  122.      * @return  boolean
  123.      * @access  public
  124.      */
  125.     /*
  126.     function calcGeomParams() {
  127.         // TODO
  128.         return true;
  129.     }
  130.     */
  131.  
  132.     /**
  133.      * Returns geometrical parameter for the residue
  134.      * One of: bonds, angles, torsions, or chis
  135.      * TODO
  136.      *
  137.      * @return  array
  138.      * @access  public
  139.      */
  140.     /*
  141.     function getGeomParams($param) {
  142.         // TODO
  143.         return array();
  144.     }
  145.     */
  146.  
  147. } // end of Science_Chemistry_Residue_PDB class
  148.  
  149. // vim: expandtab: ts=4: sw=4
  150. ?>
  151.