Protool/structure.py
def resname(self,uniqueid):
        """ Given an uniqueid or a residue number, this function returns the residue name"""
        import string
        if self.atoms.has_key(uniqueid):
            return self.atoms[uniqueid]['RESNAME']
        elif self.residues.has_key(uniqueid):
            #
            # Get the first atom of the residue and return the resname there
            #
            atomname=self.residues[uniqueid][0]
            if not self.atoms.has_key(atomname):
                raise ProtoolError, 'Inconsistent self.atoms and self.residues: %s is not found in atoms.' %atomname
            return self.atoms[atomname]['RESNAME']
        elif self.residues.has_key(':'+uniqueid):
            return self.atoms[self.residues[':'+uniqueid][0]]['RESNAME']
        #
        # Check for non-existing atom, but existing residue
        #
        elif self.residues.has_key(string.join(uniqueid.split(':')[:-1],':')):
            uniqueid=string.join(uniqueid.split(':')[:-1],':')
            atomname=self.residues[uniqueid][0]
            if not self.atoms.has_key(atomname):
                raise ProtoolError, 'Inconsistent self.atoms and self.residues: %s is not found in atoms.' %atomname
            return self.atoms[atomname]['RESNAME']
        elif self.residues.has_key(':'+uniqueid.split(':')[1]):
            res=':'+uniqueid.split(':')[1]
            at0=self.residues[res][0]
            resname=self.atoms[at0]['RESNAME']
            if resname==uniqueid.split(':')[2]:
                return self.atoms[at0]['RESNAME']
            else:
                raise ResidueNotFoundErrror,'Residue not found for %s' %uniqueid
        else:
            raise ResidueNotFoundError,'Residue not found for %s' %uniqueid
 Given an uniqueid or a residue number, this function returns the residue name
Given an uniqueid or a residue number, this function returns the residue name
Given an uniqueid or a residue number this function returns the residue name
def resname(self,uniqueid):
        import string
        if self.atoms.has_key(uniqueid):
            return self.atoms[uniqueid]['RESNAME']
        elif self.residues.has_key(uniqueid):
             Get the first atom of the residue and return the resname there
            atomname=self.residues[uniqueid][0]
            if not self.atoms.has_key(atomname):
                raise ProtoolError, 'Inconsistent self.atoms and self.residues: %s is not found in atoms.' %atomname
            return self.atoms[atomname]['RESNAME']
        elif self.residues.has_key(':'+uniqueid):
            return self.atoms[self.residues[':'+uniqueid][0]]['RESNAME']
         Check for non-existing atom, but existing residue
        elif self.residues.has_key(string.join(uniqueid.split(':')[:-1],':')):
            uniqueid=string.join(uniqueid.split(':')[:-1],':')
            atomname=self.residues[uniqueid][0]
            if not self.atoms.has_key(atomname):
                raise ProtoolError, 'Inconsistent self.atoms and self.residues: %s is not found in atoms.' %atomname
            return self.atoms[atomname]['RESNAME']
        elif self.residues.has_key(':'+uniqueid.split(':')[1]):
            res=':'+uniqueid.split(':')[1]
            at0=self.residues[res][0]
            resname=self.atoms[at0]['RESNAME']
            if resname==uniqueid.split(':')[2]:
                return self.atoms[at0]['RESNAME']
            else:
                raise ResidueNotFoundErrror,'Residue not found for %s' %uniqueid
        else:
            raise ResidueNotFoundError,'Residue not found for %s' %uniqueid
def resname ( self , uniqueid ) : import string if self . atoms . has_key ( uniqueid ) : return self . atoms [ uniqueid ] [ 'RESNAME' ] elif self . residues . has_key ( uniqueid ) : atomname = self . residues [ uniqueid ] [ 0 ] if not self . atoms . has_key ( atomname ) : raise ProtoolError , 'Inconsistent self.atoms and self.residues: %s is not found in atoms.' % atomname return self . atoms [ atomname ] [ 'RESNAME' ] elif self . residues . has_key ( ':' + uniqueid ) : return self . atoms [ self . residues [ ':' + uniqueid ] [ 0 ] ] [ 'RESNAME' ] elif self . residues . has_key ( string . join ( uniqueid . split ( ':' ) [ : - 1 ] , ':' ) ) : uniqueid = string . join ( uniqueid . split ( ':' ) [ : - 1 ] , ':' ) atomname = self . residues [ uniqueid ] [ 0 ] if not self . atoms . has_key ( atomname ) : raise ProtoolError , 'Inconsistent self.atoms and self.residues: %s is not found in atoms.' % atomname return self . atoms [ atomname ] [ 'RESNAME' ] elif self . residues . has_key ( ':' + uniqueid . split ( ':' ) [ 1 ] ) : res = ':' + uniqueid . split ( ':' ) [ 1 ] at0 = self . residues [ res ] [ 0 ] resname = self . atoms [ at0 ] [ 'RESNAME' ] if resname == uniqueid . split ( ':' ) [ 2 ] : return self . atoms [ at0 ] [ 'RESNAME' ] else : raise ResidueNotFoundErrror , 'Residue not found for %s' % uniqueid else : raise ResidueNotFoundError , 'Residue not found for %s' % uniqueid
Given an uniqueid or a residue number, this function returns the residue name
Given an uniqueid or a residue number this function returns the residue name
""" Given an uniqueid or a residue number, this function returns the residue name""" # # Get the first atom of the residue and return the resname there # # # Check for non-existing atom, but existing residue #
self
uniqueid