Source for file PDBFile.php
Documentation is available at PDBFile.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> |
// +----------------------------------------------------------------------+
require_once "Science/Chemistry/Macromolecule_PDB.php";
* Represents a PDB file, composed of one or more Science_Chemistry_Macromolecule_PDB objects
* @author Jesus M. Castagnetto <jmcastagnetto@php.net>
* @package Science_Chemistry
* @see Science_Chemistry_PDBParser
* PDB macromolecule(s) class
* Array of macromolecular objects
* Number of molecules/subunits
* Constructor for the class, requires a PDB filename
* @param string $filename
* @return object PDBFile;
$this->parseFile (file($filename), $usemeta);
* Makes the arrays of all present PDB record types
* @param array $arr array of lines
* @see Science_Chemistry_Macromolecule_PDB()
function parseFile ($arr, $usemeta) {
"JAN" => "01", "FEB" => "02", "MAR" => "03",
"APR" => "04", "MAY" => "05", "JUN" => "06",
"JUL" => "07", "AUG" => "08", "SEP" => "09",
"OCT" => "10", "NOV" => "11", "DEC" => "12"
$header_re = "/^HEADER[[:space:]]+(([^[:space:]]+ )+)[[:space:]]+";
$header_re .= "([0-9]{2}-[A-Z]{3}-[0-9]{2,4})[[:space:]]+[A-Z0-9]{4}/";
$this->class = trim($regs[1 ]);
// put date in a more standard format
$year = 2000 + (int) $tmp[2 ];
$year = 1900 + (int) $tmp[2 ];
$this->date = $year. "-". $month[$tmp[1 ]]. "-". $tmp[0 ];
for ($i=0; $i < count($arr); $i++ ) {
// check if we have multi-model file
if ($rectype == "MODEL") {
// create the meta array and accumulate the atom records
if ($rectype != "ATOM" && $rectype != "HETATM") {
$this->meta[$rectype][] = trim($arr[$i]);
// did we get a multi-model file and are parsing the end
// of a model, if so, create new macromolecule and change
if ($rectype == "ENDMDL") {
$this->num_macromolecules++;
// 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->num_macromolecules++;
* Returns a CML representation of the PDB file
// vim: expandtab: ts=4: sw=4
Documentation generated on Mon, 11 Mar 2019 15:48:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|