jmcastagnetto Tue Apr 10 11:33:21 2001 EDT Modified files: /pear/Science Chemistry.php /pear/Science/Chemistry Atom.php Atom_PDB.php Coordinates.php Element.php Macromolecule.php Macromolecule_PDB.php Molecule.php Molecule_XYZ.php PDBFile.php PDBParser.php Periodic_Table.php Residue_PDB.php /pear/Science/Chemistry/test chi_crawler.php testChem.php testPDB.php xyz2cml.php Log: Renamning of classes from Chem_* to Science_Chemistry_*
Index: pear/Science/Chemistry.php diff -u pear/Science/Chemistry.php:1.1 pear/Science/Chemistry.php:1.2 --- pear/Science/Chemistry.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Chemistry.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Chemistry.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "PEAR.php"; @@ -24,7 +24,7 @@ /** * Package version constant */ -define (CHEM_VERSION, 1.0); +define (SCIENCE_CHEMISTRY_VERSION, 1.0); require_once "Science/Chemistry/Element.php"; require_once "Science/Chemistry/Periodic_Table.php"; Index: pear/Science/Chemistry/Atom.php diff -u pear/Science/Chemistry/Atom.php:1.1 pear/Science/Chemistry/Atom.php:1.2 --- pear/Science/Chemistry/Atom.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Atom.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Atom.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Atom.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry.php"; @@ -29,7 +29,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Atom { +class Science_Chemistry_Atom { /** * Element symbol @@ -42,9 +42,9 @@ var $element=""; /** - * Chem_Coordinates object + * Science_Chemistry_Coordinates object * - * @var object Chem_Coordinates + * @var object Science_Chemistry_Coordinates * @access private * * @see getCoordinates(); @@ -58,17 +58,17 @@ * @param string $element chemical symbol * @param optional array $coords array of coordinates (x, y, z) * @access public - * @return object Chem_Atom + * @return object Science_Chemistry_Atom * * @see setCoordinates() */ - function Chem_Atom($element, $coords="") { + function Science_Chemistry_Atom($element, $coords="") { if ($element && ereg("[[:alpha:]]{1,2}", $element)) $this->element = $element; else return null; if (is_array($coords) && count($coords) == 3) - if (!$this->xyz = new Chem_Coordinates($coords)) + if (!$this->xyz = new Science_Chemistry_Coordinates($coords)) return null; } @@ -80,7 +80,7 @@ * @access public */ function setCoordinates($coords) { - $this->xyz = new Chem_Coordinates($coords); + $this->xyz = new Science_Chemistry_Coordinates($coords); return (is_object($this->xyz) && !empty($this->xyz)); } @@ -99,7 +99,7 @@ /** * Returns the coordinates object for the atom * - * @return object Chem_Coordinates + * @return object Science_Chemistry_Coordinates * @access public * * @see $xyz; @@ -112,34 +112,34 @@ * Calculates the cartesian distance from this atom * instance to another * - * @param object Chem_Atom $atom2 + * @param object Science_Chemistry_Atom $atom2 * @return float distance * @access public */ function distance($atom2) { - if (!empty($this->xyz) && Chem_Coordinates::areCoordinates($this->xyz) - && Chem_Atom::isAtom($atom2)) + if (!empty($this->xyz) && +Science_Chemistry_Coordinates::areCoordinates($this->xyz) + && Science_Chemistry_Atom::isAtom($atom2)) return $this->xyz->distance($atom2->xyz); else return -1.0; } /** - * Checks if the object is an instance of Chem_Atom + * Checks if the object is an instance of Science_Chemistry_Atom * - * @param object Chem_Atom $obj + * @param object Science_Chemistry_Atom $obj * @return boolean * @access public */ function isAtom($obj) { return (is_object($obj) && - (strtolower(get_class($obj)) == strtolower("Chem_Atom") - || is_subclass_of($obj, strtolower("Chem_Atom"))) + (strtolower(get_class($obj)) == strtolower("Science_Chemistry_Atom") + || is_subclass_of($obj, strtolower("Science_Chemistry_Atom"))) ); } /** - * Returns a string representation of the Chem_Atom object + * Returns a string representation of the Science_Chemistry_Atom object * * @return string * @access public @@ -150,7 +150,7 @@ } /** - * Returns a CML representation of the Chem_Atom object + * Returns a CML representation of the Science_Chemistry_Atom object * Accepts an optional id * * @param optional string $id @@ -165,7 +165,7 @@ return $out; } -} // end of class Chem_Atom +} // end of class Science_Chemistry_Atom // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/Atom_PDB.php diff -u pear/Science/Chemistry/Atom_PDB.php:1.1 pear/Science/Chemistry/Atom_PDB.php:1.2 --- pear/Science/Chemistry/Atom_PDB.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Atom_PDB.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Atom_PDB.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Atom_PDB.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry/Atom.php" ; @@ -30,7 +30,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Atom_PDB extends Chem_Atom { +class Science_Chemistry_Atom_PDB extends Science_Chemistry_Atom { /** * PDB Atom record type, one of ATOM or HETATM @@ -158,7 +158,7 @@ var $parent_residue; - function Chem_Atom_PDB($atomrec, $residue="") { + function Science_Chemistry_Atom_PDB($atomrec, $residue="") { // reference to containing residue if (!empty($residue)) $this->parent_residue =& $residue; @@ -180,7 +180,7 @@ $x = (double) trim(substr($atomrec,30,8)); $y = (double) trim(substr($atomrec,38,8)); $z = (double) trim(substr($atomrec,46,8)); - $this->xyz = new Chem_Coordinates(array($x, $y, $z)); + $this->xyz = new Science_Chemistry_Coordinates(array($x, $y, $z)); $element = trim(substr($atomrec,76,2)); $this->element = $element; } Index: pear/Science/Chemistry/Coordinates.php diff -u pear/Science/Chemistry/Coordinates.php:1.1 pear/Science/Chemistry/Coordinates.php:1.2 --- pear/Science/Chemistry/Coordinates.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Coordinates.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Coordinates.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Coordinates.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // /** @@ -28,7 +28,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Coordinates { +class Science_Chemistry_Coordinates { /** * Array of tridimensional coordinates: (x, y, z) @@ -43,10 +43,10 @@ * not an array with 3 entries * * @param array $coords array of three floats (x, y, z) - * @return object Chem_Coordinates + * @return object Science_Chemistry_Coordinates * @access public */ - function Chem_Coordinates($coords) { + function Science_Chemistry_Coordinates($coords) { if (is_array($coords) && count($coords) == 3) $this->coords = $coords; else @@ -56,12 +56,12 @@ /** * Castesian distance calculation method * - * @param object Chem_Coordinates $coord + * @param object Science_Chemistry_Coordinates $coord * @return float distance * @access public */ function distance($coord) { - if (Chem_Coordinates::areCoordinates($coord)) { + if (Science_Chemistry_Coordinates::areCoordinates($coord)) { $xyz2 = $coord->getCoordinates(); for ($i=0; $i<count($xyz2); $i++) $sum2 += pow(($xyz2[$i] - $this->coords[$i]),2); @@ -70,16 +70,16 @@ } /** - * Checks if the object is an instance of Chem_Coordinates + * Checks if the object is an instance of Science_Chemistry_Coordinates * - * @param object Chem_Coordinates $obj + * @param object Science_Chemistry_Coordinates $obj * @return boolean * @access public */ function areCoordinates($obj) { return ( is_object($obj) && - (strtolower(get_class($obj)) == strtolower("Chem_Coordinates") - || is_subclass_of($obj, strtolower("Chem_Coordinates"))) + (strtolower(get_class($obj)) == +strtolower("Science_Chemistry_Coordinates") + || is_subclass_of($obj, +strtolower("Science_Chemistry_Coordinates"))) ); } @@ -121,7 +121,7 @@ return $out; } -} // end of class Chem_Coordinates +} // end of class Science_Chemistry_Coordinates // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/Element.php diff -u pear/Science/Chemistry/Element.php:1.1 pear/Science/Chemistry/Element.php:1.2 --- pear/Science/Chemistry/Element.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Element.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Element.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Element.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // /** @@ -27,7 +27,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Element { +class Science_Chemistry_Element { /** * Element's symbol, one or two characters, case sensitive @@ -95,10 +95,10 @@ * @param string $mp melting point (with comments) * @param string $bp boiling point (with comments) * @param string $fam family - * @return object Chem_Element + * @return object Science_Chemistry_Element * @access public */ - function Chem_Element ($sym, $name, $num, $wgt, $mp, $bp, $fam) { + function Science_Chemistry_Element ($sym, $name, $num, $wgt, $mp, $bp, $fam) { $this->symbol = $sym; $this->name = $name; $this->number = $num; @@ -109,20 +109,20 @@ } /** - * Checks if an object is a Chem_Element instance + * Checks if an object is a Science_Chemistry_Element instance * - * @param object Chem_Element $obj + * @param object Science_Chemistry_Element $obj * @return boolean * @access public */ function isElement($obj) { return (is_object($obj) && - (get_class($obj) == "Chem_Element" || - is_subclass_of($obj, "Chem_Element")) + (get_class($obj) == "Science_Chemistry_Element" || + is_subclass_of($obj, "Science_Chemistry_Element")) ); } -} // end of Chem_Element +} // end of Science_Chemistry_Element // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/Macromolecule.php diff -u pear/Science/Chemistry/Macromolecule.php:1.1 pear/Science/Chemistry/Macromolecule.php:1.2 --- pear/Science/Chemistry/Macromolecule.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Macromolecule.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Macromolecule.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Macromolecule.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry.php"; @@ -25,14 +25,14 @@ /** * Represents a macromolecule, composed of several - * Chem_Molecule objects + * Science_Chemistry_Molecule objects * * @author Jesus M. Castagnetto <[EMAIL PROTECTED]> * @version 1.0 * @access public * @package Science_Chemistry */ -class Chem_Macromolecule { +class Science_Chemistry_Macromolecule { /** * Macromolecule's name @@ -60,16 +60,16 @@ /** * Constructor for the class, requires a macromolecule name - * and an optional array of Chem_Molecule objects + * and an optional array of Science_Chemistry_Molecule objects * * @param string $name * @param optional array $molecules - * @return object Chem_Macromolecule + * @return object Science_Chemistry_Macromolecule * @access public * @see $name * @see initMacromolecule() */ - function Chem_Macromolecule($name, $molecules="") { + function Science_Chemistry_Macromolecule($name, $molecules="") { $this->name = $name; if (!empty($molecules)) if (!$this->initMacromolecule($molecules)) @@ -78,7 +78,7 @@ /** - * Initializes the array of Chem_Molecule objects + * Initializes the array of Science_Chemistry_Molecule objects * * @param array $molecules * @return boolean @@ -97,15 +97,15 @@ } /** - * Adds a Chem_Molecule object to the list of molecules in the macromolecule + * Adds a Science_Chemistry_Molecule object to the list of molecules in the +macromolecule * - * @param object Chem_Molecule $mol + * @param object Science_Chemistry_Molecule $mol * @return boolean * @access public * @see initMacromolecule() */ function addMolecule($mol) { - if (Chem_Molecule::isMolecule($mol)) { + if (Science_Chemistry_Molecule::isMolecule($mol)) { $this->molecules[] = $mol; $this->num_molecules++; return true; @@ -115,7 +115,7 @@ } /** - * Returns an array of Chem_Molecule objects + * Returns an array of Science_Chemistry_Molecule objects * * @return array * @access public @@ -126,16 +126,16 @@ } /** - * Checks if the object is an instance of Chem_Macromolecule + * Checks if the object is an instance of Science_Chemistry_Macromolecule * - * @param object Chem_Macromolecule $obj + * @param object Science_Chemistry_Macromolecule $obj * @return boolean * @access public */ function isMacromolecule($obj) { return (is_object($obj) && - (strtolower(get_class($obj)) == strtolower("Chem_Macromolecule") || - is_subclass_of($obj, strtolower("Chem_Macromolecule"))) + (strtolower(get_class($obj)) == +strtolower("Science_Chemistry_Macromolecule") || + is_subclass_of($obj, strtolower("Science_Chemistry_Macromolecule"))) ); } @@ -175,7 +175,7 @@ return $out; } -} // end of Chem_Macromolecule +} // end of Science_Chemistry_Macromolecule // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/Macromolecule_PDB.php diff -u pear/Science/Chemistry/Macromolecule_PDB.php:1.1 pear/Science/Chemistry/Macromolecule_PDB.php:1.2 --- pear/Science/Chemistry/Macromolecule_PDB.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Macromolecule_PDB.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Macromolecule_PDB.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Macromolecule_PDB.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry/Macromolecule.php"; @@ -24,14 +24,14 @@ /** * Represents a PDB macromolecule, composed of several - * Chem_Residue_PDB objects + * Science_Chemistry_Residue_PDB objects * * @author Jesus M. Castagnetto <[EMAIL PROTECTED]> * @version 1.0 * @access public * @package Science_Chemistry */ -class Chem_Macromolecule_PDB extends Chem_Macromolecule { +class Science_Chemistry_Macromolecule_PDB extends Science_Chemistry_Macromolecule { /** * Constructor for the class @@ -39,12 +39,12 @@ * @param string $pdb PDB ID of the containing file * @param array $records Array of lines comprising the macromolecule * @param object PDBFile $pdbfile reference to the PDB file object - * @return object Chem_Macromolecule_PDB + * @return object Science_Chemistry_Macromolecule_PDB * @access public * @see $pdb * @see parseResidues() */ - function Chem_Macromolecule_PDB($pdb, $records, $pdbfile="") { + function Science_Chemistry_Macromolecule_PDB($pdb, $records, $pdbfile="") { $this->pdb =& $pdb; $this->pdbfile =& $pdbfile; $this->parseResidues($records); @@ -55,7 +55,7 @@ * * @param array $records * @access private - * @see Chem_Macromolecule_PDB() + * @see Science_Chemistry_Macromolecule_PDB() */ function parseResidues($records) { $curr_res_id = ""; @@ -71,7 +71,7 @@ $res_atoms[] = $atomrec; } else { if (!empty($res_atoms)) { - $this->molecules[] = new Chem_Residue_PDB(&$this->pdb, + $this->molecules[] = new +Science_Chemistry_Residue_PDB(&$this->pdb, &$res_atoms, &$this); $this->num_molecules++; } @@ -80,7 +80,7 @@ } } } -} // end of Chem_Macromolecule_PDB +} // end of Science_Chemistry_Macromolecule_PDB // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/Molecule.php diff -u pear/Science/Chemistry/Molecule.php:1.1 pear/Science/Chemistry/Molecule.php:1.2 --- pear/Science/Chemistry/Molecule.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Molecule.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Molecule.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Molecule.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry.php"; @@ -30,7 +30,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Molecule { +class Science_Chemistry_Molecule { /** * Molecule name @@ -89,16 +89,16 @@ /** * Constructor for the class, requires a molecule name - * and an optional array of Chem_Atom objects + * and an optional array of Science_Chemistry_Atom objects * * @param string $name * @param optional array $atoms - * @return object Chem_Molecule + * @return object Science_Chemistry_Molecule * @access public * @see $name * @see initMolecule() */ - function Chem_Molecule($name, $atoms="") { + function Science_Chemistry_Molecule($name, $atoms="") { if ($name) $this->name = $name; else @@ -109,7 +109,7 @@ } /** - * Initializes the array of Chem_Atom objects + * Initializes the array of Science_Chemistry_Atom objects * * @param array $atoms * @return boolean @@ -131,15 +131,15 @@ } /** - * Adds a Chem_Atom object to the list of atoms in the molecule + * Adds a Science_Chemistry_Atom object to the list of atoms in the molecule * - * @param object Chem_Atom $atom + * @param object Science_Chemistry_Atom $atom * @return boolean * @access public * @see initMolecule() */ function addAtom($atom) { - if (Chem_Atom::isAtom($atom)) { + if (Science_Chemistry_Atom::isAtom($atom)) { $this->atoms[] = $atom; $this->num_atoms++; // unset the distance matrix and @@ -169,16 +169,16 @@ } /** - * Checks if the object is an instance of Chem_Molecule + * Checks if the object is an instance of Science_Chemistry_Molecule * - * @param object Chem_Molecule $obj + * @param object Science_Chemistry_Molecule $obj * @return boolean * @access public */ function isMolecule($obj) { return (is_object($obj) && - (strtolower(get_class($obj)) == strtolower("Chem_Molecule") || - is_subclass_of($obj, strtolower("Chem_Molecule"))) + (strtolower(get_class($obj)) == +strtolower("Science_Chemistry_Molecule") || + is_subclass_of($obj, strtolower("Science_Chemistry_Molecule"))) ); } @@ -396,7 +396,7 @@ return $ctable; } -} // end of class Chem_Molecule +} // end of class Science_Chemistry_Molecule // vim: expandtab: ts=4: sw=4 Index: pear/Science/Chemistry/Molecule_XYZ.php diff -u pear/Science/Chemistry/Molecule_XYZ.php:1.1 pear/Science/Chemistry/Molecule_XYZ.php:1.2 --- pear/Science/Chemistry/Molecule_XYZ.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Molecule_XYZ.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Molecule_XYZ.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Molecule_XYZ.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry.php"; @@ -30,7 +30,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Molecule_XYZ extends Chem_Molecule { +class Science_Chemistry_Molecule_XYZ extends Science_Chemistry_Molecule { /** * Energy of the molecule. Optional value in XYZ file format. @@ -46,11 +46,11 @@ * * @param optional string $xyzdata * @param optional string $src one of "file" or "string" - * @return object Chem_Molecule_XYZ + * @return object Science_Chemistry_Molecule_XYZ * @access public * @see parseXYZ() */ - function Chem_Molecule_XYZ($xyzdata="", $src="file") { + function Science_Chemistry_Molecule_XYZ($xyzdata="", $src="file") { if (!empty($xyzdata)) if (!$this->parseXYZ($xyzdata, $src)) return null; @@ -63,7 +63,7 @@ * @param string $src * @return boolean * @access public - * @see Chem_Molecule_XYZ() + * @see Science_Chemistry_Molecule_XYZ() */ function parseXYZ($xyzdata, $src) { if ($src == "file") { @@ -91,18 +91,18 @@ * Parses an XYZ atom record * * @param string $line - * @return object Chem_Atom + * @return object Science_Chemistry_Atom * @acess public * @see parseXYZ() */ function parseAtom($line) { list($element, $x, $y, $z) = split("[\t ]+",trim($line)); - return new Chem_Atom($element, array($x, $y, $z)); + return new Science_Chemistry_Atom($element, array($x, $y, $z)); } /** * Generates a string representation of the XYZ molecule - * Overrides parent Chem_Molecule::toString() method + * Overrides parent Science_Chemistry_Molecule::toString() method * * @return string * @access public @@ -118,7 +118,7 @@ return implode("\n",$out)."\n"; } -} // end of class Chem_Molecule_XYZ +} // end of class Science_Chemistry_Molecule_XYZ // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/PDBFile.php diff -u pear/Science/Chemistry/PDBFile.php:1.1 pear/Science/Chemistry/PDBFile.php:1.2 --- pear/Science/Chemistry/PDBFile.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/PDBFile.php Tue Apr 10 11:33:20 2001 @@ -16,21 +16,21 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: PDBFile.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: PDBFile.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry/Macromolecule_PDB.php"; /** - * Represents a PDB file, composed of one or more Chem_Macromolecule_PDB objects + * Represents a PDB file, composed of one or more Science_Chemistry_Macromolecule_PDB +objects * * @author Jesus M. Castagnetto <[EMAIL PROTECTED]> * @version 1.0 * @access public * @package Science_Chemistry - * @see Chem_PDBParser + * @see Science_Chemistry_PDBParser */ -class Chem_PDBFile { +class Science_Chemistry_PDBFile { /** * PDB ID @@ -98,7 +98,7 @@ * @see $file * @see mkArrays() */ - function Chem_PDBFile($filename) { + function Science_Chemistry_PDBFile($filename) { if (!file_exists($filename)) return null; list($pdb,) = explode(".",basename($filename)); @@ -112,7 +112,7 @@ * * @param array $arr array of lines * @access private - * @see Chem_Macromolecule_PDB() + * @see Science_Chemistry_Macromolecule_PDB() */ function parseFile($arr) { $month = array ( @@ -159,7 +159,7 @@ // of a model, if so, create new macromolecule and change // the flag if ($rectype == "ENDMDL") { - $this->macromolecules[] = new Chem_Macromolecule_PDB($this->pdb, + $this->macromolecules[] = new +Science_Chemistry_Macromolecule_PDB($this->pdb, $tmparr, &$this); $this->num_macromolecules++; $flag = "endmodel"; @@ -169,7 +169,7 @@ // if we got to the end without hitting a MODEL ... ENDMDL pair // add the only macromolecule in this file to the array if ($flag == "nomodel") { - $this->macromolecules[] = new Chem_Macromolecule_PDB(&$this->pdb, + $this->macromolecules[] = new +Science_Chemistry_Macromolecule_PDB(&$this->pdb, &$tmparr, &$this); $this->num_macromolecules++; } Index: pear/Science/Chemistry/PDBParser.php diff -u pear/Science/Chemistry/PDBParser.php:1.1 pear/Science/Chemistry/PDBParser.php:1.2 --- pear/Science/Chemistry/PDBParser.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/PDBParser.php Tue Apr 10 11:33:20 2001 @@ -16,23 +16,23 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: PDBParser.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: PDBParser.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // /** * A self-contained class to parse a PDB file into an array of residues * each containing an array of atoms * <br> - * Useful when dealing with big PDB files, where using the Chem_PDBFile + * Useful when dealing with big PDB files, where using the Science_Chemistry_PDBFile * class will generate out of memory errors. * * @author Jesus M. Castagnetto <[EMAIL PROTECTED]> * @version 1.0 * @access public * @package Science_Chemistry - * @see Chem_PDBFile + * @see Science_Chemistry_PDBFile */ -class Chem_PDBParser { +class Science_Chemistry_PDBParser { /** * PDB ID @@ -93,7 +93,7 @@ * @access public * @see parseResidues() */ - function Chem_PDBParser($filename, $multi=false, $meta=false, $full=false) { + function Science_Chemistry_PDBParser($filename, $multi=false, $meta=false, +$full=false) { if (!file_exists($filename)) return null; list($pdb,) = explode(".",basename($filename)); Index: pear/Science/Chemistry/Periodic_Table.php diff -u pear/Science/Chemistry/Periodic_Table.php:1.1 pear/Science/Chemistry/Periodic_Table.php:1.2 --- pear/Science/Chemistry/Periodic_Table.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Periodic_Table.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Periodic_Table.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Periodic_Table.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry.php"; @@ -29,7 +29,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Periodic_Table { +class Science_Chemistry_Periodic_Table { /** * The associative array containing the chemical elements @@ -40,27 +40,27 @@ var $periodic_table = array(); /** - * Returns a Chem_Element object correspoding to the symbol (case sensitive) + * Returns a Science_Chemistry_Element object correspoding to the symbol (case +sensitive) * * @param string $symbol - * @return object Chem_Element + * @return object Science_Chemistry_Element * @access public */ function getElement($symbol) { if (empty($this->periodic_table)) initTable(); $elem = $this->periodic_table[$symbol]; - if (Chem_Element::isElement($elem)) + if (Science_Chemistry_Element::isElement($elem)) return $elem; else return null; } /** - * Returns an array of Chem_Element objects belonging to an element family + * Returns an array of Science_Chemistry_Element objects belonging to an element +family * * @param string $family - * @return array Chem_Element objects + * @return array Science_Chemistry_Element objects * @access public */ function getElementFamily($family) { @@ -299,7 +299,7 @@ 109,-1, "unknown", "unknown", ""); } -} // end of Chem_Periodic_Table +} // end of Science_Chemistry_Periodic_Table // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/Residue_PDB.php diff -u pear/Science/Chemistry/Residue_PDB.php:1.1 pear/Science/Chemistry/Residue_PDB.php:1.2 --- pear/Science/Chemistry/Residue_PDB.php:1.1 Tue Apr 10 09:44:39 2001 +++ pear/Science/Chemistry/Residue_PDB.php Tue Apr 10 11:33:20 2001 @@ -16,7 +16,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Residue_PDB.php,v 1.1 2001/04/10 16:44:39 jmcastagnetto Exp $ +// $Id: Residue_PDB.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry.php"; @@ -31,7 +31,7 @@ * @access public * @package Science_Chemistry */ -class Chem_Residue_PDB extends Chem_Molecule { +class Science_Chemistry_Residue_PDB extends Science_Chemistry_Molecule { /** * PDB Residue sequence number @@ -80,7 +80,7 @@ * Reference to the protein * to which this residue belongs * - * @var object Chem_Macromolecule_PDB + * @var object Science_Chemistry_Macromolecule_PDB * @access public */ var $macromol; @@ -90,13 +90,13 @@ * * @param string $pdb PDB if of the protein/nucleic acid/etc. * @param array $atomrec_arr Array of PDB atom record lines - * @param object Chem_Macromolecule_PDB $macromol reference to the containing macromolecule - * @return object Chem_Residue_PDB + * @param object Science_Chemistry_Macromolecule_PDB $macromol reference to +the containing macromolecule + * @return object Science_Chemistry_Residue_PDB * @access public */ - function Chem_Residue_PDB($pdb, $atomrec_arr, $macromol="") { + function Science_Chemistry_Residue_PDB($pdb, $atomrec_arr, $macromol="") { for ($i=0; $i < count($atomrec_arr); $i++) - $this->atoms[] = new Chem_Atom_PDB(&$atomrec_arr[$i], &$this); + $this->atoms[] = new Science_Chemistry_Atom_PDB(&$atomrec_arr[$i], +&$this); if (!empty($this->atoms)) { $this->VALID = true; $this->macromol =& $macromol; @@ -144,7 +144,7 @@ } */ -} // end of Chem_Residue_PDB class +} // end of Science_Chemistry_Residue_PDB class // vim: expandtab: ts=4: sw=4 ?> Index: pear/Science/Chemistry/test/chi_crawler.php diff -u pear/Science/Chemistry/test/chi_crawler.php:1.1 pear/Science/Chemistry/test/chi_crawler.php:1.2 --- pear/Science/Chemistry/test/chi_crawler.php:1.1 Tue Apr 10 09:44:42 2001 +++ pear/Science/Chemistry/test/chi_crawler.php Tue Apr 10 11:33:20 2001 @@ -122,7 +122,7 @@ continue; } exec("grep HIS ".$filepath." > ".$tmpfile); - $f = new Chem_PDBParser($tmpfile); + $f = new Science_Chemistry_PDBParser($tmpfile); $histidines = $f->getResidueList(0,"HIS"); unset($f); if (empty($histidines)) { Index: pear/Science/Chemistry/test/testChem.php diff -u pear/Science/Chemistry/test/testChem.php:1.1 pear/Science/Chemistry/test/testChem.php:1.2 --- pear/Science/Chemistry/test/testChem.php:1.1 Tue Apr 10 09:44:42 2001 +++ pear/Science/Chemistry/test/testChem.php Tue Apr 10 11:33:20 2001 @@ -17,7 +17,7 @@ // | Authors: Jesus M. Castagnetto <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: testChem.php,v 1.1 2001/04/10 16:44:42 jmcastagnetto Exp $ +// $Id: testChem.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ // require_once "Science/Chemistry.php"; @@ -25,18 +25,18 @@ require_once "Science/Chemistry/Macromolecule.php"; echo "Creating and printing an atom\n"; -$a = new Chem_Atom("N", array(2.3,4.5,-2.1)); +$a = new Science_Chemistry_Atom("N", array(2.3,4.5,-2.1)); echo $a->toString()."\n"; echo "Creating a second atom and calculating distance to first one\n"; -$b = new Chem_Atom("C", array(1.2,3.4,-1.6)); +$b = new Science_Chemistry_Atom("C", array(1.2,3.4,-1.6)); echo $b->toString()."\n"; echo "\nDistance N to C: ".sprintf("%.4f", $a->distance($b))." Angstroms\n"; //print_r($a); //print_r($b); echo "\n=====\nReading a molecule:\n"; -$m = new Chem_Molecule_XYZ("his.xyz"); -echo "\$m is a molecule: ".(int)Chem_Molecule::isMolecule($m)."\n"; +$m = new Science_Chemistry_Molecule_XYZ("his.xyz"); +echo "\$m is a molecule: ".(int)Science_Chemistry_Molecule::isMolecule($m)."\n"; echo $m->toString(); //echo "Calculating Distance Matrix\n"; //$m->printDistanceMatrix(); @@ -50,11 +50,11 @@ //$big = implode("",file("7AHL.xyz")) ; //echo "It took: ".(time() - $start)." seconds\n"; -$n = new Chem_Molecule_XYZ("lys.xyz"); +$n = new Science_Chemistry_Molecule_XYZ("lys.xyz"); $mols = array($m, $n); -$big = new Chem_Macromolecule("big one", $mols); +$big = new Science_Chemistry_Macromolecule("big one", $mols); echo $big->toString(); echo $big->toCML("biggie", "big", true); Index: pear/Science/Chemistry/test/testPDB.php diff -u pear/Science/Chemistry/test/testPDB.php:1.1 pear/Science/Chemistry/test/testPDB.php:1.2 --- pear/Science/Chemistry/test/testPDB.php:1.1 Tue Apr 10 09:44:42 2001 +++ pear/Science/Chemistry/test/testPDB.php Tue Apr 10 11:33:20 2001 @@ -4,24 +4,24 @@ $start = time(); require "Science/Chemistry/PDBParser.php"; -//$file = new Chem_PDBParser("1hca.pdb"); +//$file = new Science_Chemistry_PDBParser("1hca.pdb"); // small fragment from 1hca.pdb -//$file = new Chem_PDBParser("small.pdb"); +//$file = new Science_Chemistry_PDBParser("small.pdb"); // The file below, breaks it -//$file = new Chem_PDBParser("7AHL.pdb"); +//$file = new Science_Chemistry_PDBParser("7AHL.pdb"); // muti-model file -//$file = new Chem_PDBParser("1b1g.pdb"); -$file = new Chem_PDBParser("1b1g.pdb", true); +//$file = new Science_Chemistry_PDBParser("1b1g.pdb"); +$file = new Science_Chemistry_PDBParser("1b1g.pdb", true); print_r($file); //echo "Took: ".( time() - $start )."seconds\n"; */ require "Science/Chemistry/PDBFile.php"; -//$file = new Chem_PDBFile("small.pdb"); -$file = new Chem_PDBFile("1b1g.pdb"); +//$file = new Science_Chemistry_PDBFile("small.pdb"); +$file = new Science_Chemistry_PDBFile("1b1g.pdb"); for ($j=0; $j < $file->num_macromolecules; $j++) { $mol =& $file->macromolecules[$j]; echo $mol->toCML("model", ($j + 1)); Index: pear/Science/Chemistry/test/xyz2cml.php diff -u pear/Science/Chemistry/test/xyz2cml.php:1.1 pear/Science/Chemistry/test/xyz2cml.php:1.2 --- pear/Science/Chemistry/test/xyz2cml.php:1.1 Tue Apr 10 09:44:42 2001 +++ pear/Science/Chemistry/test/xyz2cml.php Tue Apr 10 11:33:20 2001 @@ -19,7 +19,7 @@ // // Sample script that uses the Chemistry classes to convert a XYZ file to CML // -// $Id: xyz2cml.php,v 1.1 2001/04/10 16:44:42 jmcastagnetto Exp $ +// $Id: xyz2cml.php,v 1.2 2001/04/10 18:33:20 jmcastagnetto Exp $ require_once "Science/Chemistry.php"; require_once "Science/Chemistry/Molecule_XYZ.php"; @@ -63,7 +63,7 @@ echo "Converting ".$argv[1]." to $cml... "; // create the molecule object -$mol = new Chem_Molecule_XYZ($xyz); +$mol = new Science_Chemistry_Molecule_XYZ($xyz); // prepare output $out = "<?xml version=\"1.0\">
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]