Protool/structure.py
def add_atom(self,uniqueid,
                 atomnumber=0,atomname='X',
                 chainid='X',residuename='DUM',residuenumber='000',
                 xcoord=0.0,ycoord=0.0,zcoord=0.0,update=1,BFACTOR=None,OCCUPANCY=None,CHARGE=None,RADIUS=None,tag=None,accept_duplicate=False):
        """Add an atom to the arrays"""
        #
        # Correct for duplicate atom names
        #
        Fail=False
        if accept_duplicate:
            import string
            orguid=uniqueid
            
            if self.atoms.has_key(uniqueid):
                Fail=True
                for letter in string.letters:
                    if not self.atoms.has_key(uniqueid):
                        Fail=False
                        atomname=uniqueid.split(':')[-1]
                        print 'Changed uniqueid and atom name from: %s to %s' %(orguid,uniqueid)
                        break
                    uniqueid=orguid+letter
        #
        # Add the atom
        #
        if not self.atoms.has_key(uniqueid) and not Fail:
            self.atoms[uniqueid]={}
            self.atoms[uniqueid]['NUMBER']=atomnumber
            self.atoms[uniqueid]['ATNAME']=atomname
            self.atoms[uniqueid]['CHAINID']=chainid
            self.atoms[uniqueid]['RESNAME']=residuename
            self.atoms[uniqueid]['RESNUM']=residuenumber
            self.atoms[uniqueid]['X']=xcoord
            self.atoms[uniqueid]['Y']=ycoord
            self.atoms[uniqueid]['Z']=zcoord
            if not OCCUPANCY:
                OCCUPANCY=1.0
            self.atoms[uniqueid]['OCCUPANCY']=OCCUPANCY
            if not BFACTOR:
                BFACTOR=0.0
            self.atoms[uniqueid]['B-FACTOR']=BFACTOR
            if CHARGE:
                self.atoms[uniqueid]['CHARGE']=CHARGE
            if RADIUS:
                self.atoms[uniqueid]['RADIUS']=RADIUS
            if tag:
                self.atoms[uniqueid]['tag']=tag
            if update:
                self.Update()
            return 1
        else:
            raise Exception('ProTool: Trying to add an atom that is already present!: %s %s' %(uniqueid,str(self.atoms[uniqueid])))
        return None
Add an atom to the arrays
Add an atom to the arrays
Add an atom to the arrays
def add_atom(self,uniqueid,
                 atomnumber=0,atomname='X',
                 chainid='X',residuename='DUM',residuenumber='000',
                 xcoord=0.0,ycoord=0.0,zcoord=0.0,update=1,BFACTOR=None,OCCUPANCY=None,CHARGE=None,RADIUS=None,tag=None,accept_duplicate=False):
         Correct for duplicate atom names
        Fail=False
        if accept_duplicate:
            import string
            orguid=uniqueid
            if self.atoms.has_key(uniqueid):
                Fail=True
                for letter in string.letters:
                    if not self.atoms.has_key(uniqueid):
                        Fail=False
                        atomname=uniqueid.split(':')[-1]
                        print 'Changed uniqueid and atom name from: %s to %s' %(orguid,uniqueid)
                        break
                    uniqueid=orguid+letter
         Add the atom
        if not self.atoms.has_key(uniqueid) and not Fail:
            self.atoms[uniqueid]={}
            self.atoms[uniqueid]['NUMBER']=atomnumber
            self.atoms[uniqueid]['ATNAME']=atomname
            self.atoms[uniqueid]['CHAINID']=chainid
            self.atoms[uniqueid]['RESNAME']=residuename
            self.atoms[uniqueid]['RESNUM']=residuenumber
            self.atoms[uniqueid]['X']=xcoord
            self.atoms[uniqueid]['Y']=ycoord
            self.atoms[uniqueid]['Z']=zcoord
            if not OCCUPANCY:
                OCCUPANCY=1.0
            self.atoms[uniqueid]['OCCUPANCY']=OCCUPANCY
            if not BFACTOR:
                BFACTOR=0.0
            self.atoms[uniqueid]['B-FACTOR']=BFACTOR
            if CHARGE:
                self.atoms[uniqueid]['CHARGE']=CHARGE
            if RADIUS:
                self.atoms[uniqueid]['RADIUS']=RADIUS
            if tag:
                self.atoms[uniqueid]['tag']=tag
            if update:
                self.Update()
            return 1
        else:
            raise Exception('ProTool: Trying to add an atom that is already present!: %s %s' %(uniqueid,str(self.atoms[uniqueid])))
        return None
def add_atom ( self , uniqueid , atomnumber = 0 , atomname = 'X' , chainid = 'X' , residuename = 'DUM' , residuenumber = '000' , xcoord = 0.0 , ycoord = 0.0 , zcoord = 0.0 , update = 1 , BFACTOR = None , OCCUPANCY = None , CHARGE = None , RADIUS = None , tag = None , accept_duplicate = False ) : Fail = False if accept_duplicate : import string orguid = uniqueid if self . atoms . has_key ( uniqueid ) : Fail = True for letter in string . letters : if not self . atoms . has_key ( uniqueid ) : Fail = False atomname = uniqueid . split ( ':' ) [ - 1 ] print 'Changed uniqueid and atom name from: %s to %s' % ( orguid , uniqueid ) break uniqueid = orguid + letter if not self . atoms . has_key ( uniqueid ) and not Fail : self . atoms [ uniqueid ] = { } self . atoms [ uniqueid ] [ 'NUMBER' ] = atomnumber self . atoms [ uniqueid ] [ 'ATNAME' ] = atomname self . atoms [ uniqueid ] [ 'CHAINID' ] = chainid self . atoms [ uniqueid ] [ 'RESNAME' ] = residuename self . atoms [ uniqueid ] [ 'RESNUM' ] = residuenumber self . atoms [ uniqueid ] [ 'X' ] = xcoord self . atoms [ uniqueid ] [ 'Y' ] = ycoord self . atoms [ uniqueid ] [ 'Z' ] = zcoord if not OCCUPANCY : OCCUPANCY = 1.0 self . atoms [ uniqueid ] [ 'OCCUPANCY' ] = OCCUPANCY if not BFACTOR : BFACTOR = 0.0 self . atoms [ uniqueid ] [ 'B-FACTOR' ] = BFACTOR if CHARGE : self . atoms [ uniqueid ] [ 'CHARGE' ] = CHARGE if RADIUS : self . atoms [ uniqueid ] [ 'RADIUS' ] = RADIUS if tag : self . atoms [ uniqueid ] [ 'tag' ] = tag if update : self . Update ( ) return 1 else : raise Exception ( 'ProTool: Trying to add an atom that is already present!: %s %s' % ( uniqueid , str ( self . atoms [ uniqueid ] ) ) ) return None
Add an atom to the arrays
Add an atom to the arrays
"""Add an atom to the arrays""" # # Correct for duplicate atom names # # # Add the atom #
self
uniqueid
atomnumber
atomname
chainid
residuename
residuenumber
xcoord
ycoord
zcoord
update
BFACTOR
OCCUPANCY
CHARGE
RADIUS
tag
accept_duplicate