예제 #1
0
    def get(self, name):
        """
            Get a member of the Atom class

            Parameters
                name:       The name of the member (string)
            Possible Values
                type:       The type of Atom (either ATOM or HETATM)
                serial:     Atom serial number
                name:       Atom name
                altLoc:     Alternate location
                resName:    Residue name
                chainID:    Chain identifier
                resSeq:     Residue sequence number
                iCode:      Code for insertion of residues
                x:          Orthogonal coordinates for X in Angstroms.
                y:          Orthogonal coordinates for Y in Angstroms.
                z:          Orthogonal coordinates for Z in Angstroms.
                occupancy:  Occupancy
                tempFactor: Temperature Factor
                segID:      Segment identifier
                element:    Element symbol
                charge:     Charge on the atom
                bonds:      The bonds associated with the atom
                interbonds: The intrabonds associated with the atom
                extrabonds: The extrabonds assocaited with the atom
                residue:    The parent residue of the atom
                radius:     The radius of the atom
                ffcharge:   The forcefield charge on the atom
                hdonor:     Whether the atom is a hydrogen donor
                hacceptor:  Whether the atom is a hydrogen acceptor
            Returns
                item:       The value of the member
        """
        try:
            item = getattr(self, name)
            return item
        except AttributeError:
            message = "Unable to access object \"%s\" in class Atom" % name
            raise PDBInternalError(message)
예제 #2
0
    def endElement(self, name):
        if name == "residue":  # Complete Residue object
            residue = self.curholder
            if not isinstance(residue, DefinitionResidue):
                raise PDBInternalError("Internal error parsing XML!")
            resname = residue.name
            if resname == "":
                raise PDBInternalError("Residue name not set in XML!")
            else:
                self.map[resname] = residue
                self.curholder = None
                self.curobj = None

        elif name == "patch":  # Complete patch object
            patch = self.curholder
            if not isinstance(patch, Patch):
                raise PDBInternalError("Internal error parsing XML!")
            patchname = patch.name
            if patchname == "":
                raise PDBInternalError("Residue name not set in XML!")
            else:
                self.patches.append(patch)
                self.curholder = None
                self.curobj = None

        elif name == "atom":  # Complete atom object
            atom = self.curatom
            if not isinstance(atom, DefinitionAtom):
                raise PDBInternalError("Internal error parsing XML!")
            atomname = atom.name
            if atomname == "":
                raise PDBInternalError("Atom name not set in XML!")
            else:
                self.curholder.map[atomname] = atom
                self.curatom = None
                self.curobj = self.curholder

        else:  # Just free the current element namespace
            self.curelement = ""

        return self.map