PEATDB/PE.py
def modelontheFly(self, DB, operations):
        """Produce the PDBlines for the mutant file"""
        
        self.MUT = DBActions.initProtool()

        # Create temporary array holding models
        if not getattr(DB,'tmp_3Dmodels',None):
            DB.tmp_3Dmodels={}
        # Get the structure from the parent
        parent = operations['parent']
        parentrec = DB.get(parent)
      
        if parentrec.hasStructure() == 'available':
            # Have we already modelled this one?
            if DB.tmp_3Dmodels.has_key(str(operations)):               
                pdblines = DB.tmp_3Dmodels[str(operations)]              
                import Protool
                X=Protool.structureIO()
                X.parsepdb(pdblines)
                return pdblines,X

            # Read parent structure
            pdblines = parentrec.Structure
            import Protool
            X=Protool.structureIO()
            X.parsepdb(pdblines)

            # Perform all the operations
            # First do all the deletes

            print operations['Rotamer_operations']
            for operation,uniqueid,atom in operations['Rotamer_operations']:
                #print operation,uniqueid,atom 
                if operation=='delete':                    
                    X.remove_atom(uniqueid)
            for operation,uniqueid,atom in operations['Rotamer_operations']:
                if operation=='add':                    
                    # Add atom                    
                    chainID=uniqueid.split(':')[0]
                    atomname=uniqueid.split(':')[-1]
                    residuenumber=uniqueid.split(':')[1]
                    resid='%s:%s' %(chainID,residuenumber)
                    status=X.add_atom(uniqueid=uniqueid,
                                      atomname=atomname,
                                      residuenumber=residuenumber,
                                      chainid=chainID,
                                      residuename=atom['RESNAME'],
                                      xcoord=atom['X'],ycoord=atom['Y'],zcoord=atom['Z'])
                    if not status:
                        self.parent.record_event('Modelling failed in model_on_the_fly for operations: %s' %(str(operations)))
                        return []
                    
                    # Update the arrays                    
                    X.Update()                    
                    # Rename the rest of the atoms                    
                    for this_atom in X.residues[resid]:
                        X.atoms[this_atom]['RESNAME']=atom['RESNAME']
                    X.Update()
                    #put mutation stuff into a tuple and return it too
                    #mutantinfo = (chainID,residuenumber)
            
            # Return the PDBlines and the instance            
            pdblines=X.writepdb('dummy',nowrite=1)
            
            # Store for next use            
            DB.tmp_3Dmodels[str(operations)]=pdblines[:]
            return pdblines, X
        else:
            print 'Parent does not have a structure'
            return [], None
Produce the PDBlines for the mutant file
Produce the PDBlines for the mutant file
Produce the PDBlines for the mutant file
def modelontheFly(self, DB, operations):
        self.MUT = DBActions.initProtool()
        if not getattr(DB,'tmp_3Dmodels',None):
            DB.tmp_3Dmodels={}
        parent = operations['parent']
        parentrec = DB.get(parent)
        if parentrec.hasStructure() == 'available':
            if DB.tmp_3Dmodels.has_key(str(operations)):               
                pdblines = DB.tmp_3Dmodels[str(operations)]              
                import Protool
                X=Protool.structureIO()
                X.parsepdb(pdblines)
                return pdblines,X
            pdblines = parentrec.Structure
            import Protool
            X=Protool.structureIO()
            X.parsepdb(pdblines)
            print operations['Rotamer_operations']
            for operation,uniqueid,atom in operations['Rotamer_operations']:
                if operation=='delete':                    
                    X.remove_atom(uniqueid)
            for operation,uniqueid,atom in operations['Rotamer_operations']:
                if operation=='add':                    
                    chainID=uniqueid.split(':')[0]
                    atomname=uniqueid.split(':')[-1]
                    residuenumber=uniqueid.split(':')[1]
                    resid='%s:%s' %(chainID,residuenumber)
                    status=X.add_atom(uniqueid=uniqueid,
                                      atomname=atomname,
                                      residuenumber=residuenumber,
                                      chainid=chainID,
                                      residuename=atom['RESNAME'],
                                      xcoord=atom['X'],ycoord=atom['Y'],zcoord=atom['Z'])
                    if not status:
                        self.parent.record_event('Modelling failed in model_on_the_fly for operations: %s' %(str(operations)))
                        return []
                    X.Update()                    
                    for this_atom in X.residues[resid]:
                        X.atoms[this_atom]['RESNAME']=atom['RESNAME']
                    X.Update()
            pdblines=X.writepdb('dummy',nowrite=1)
            DB.tmp_3Dmodels[str(operations)]=pdblines[:]
            return pdblines, X
        else:
            print 'Parent does not have a structure'
            return [], None
def modelontheFly ( self , DB , operations ) : self . MUT = DBActions . initProtool ( ) if not getattr ( DB , 'tmp_3Dmodels' , None ) : DB . tmp_3Dmodels = { } parent = operations [ 'parent' ] parentrec = DB . get ( parent ) if parentrec . hasStructure ( ) == 'available' : if DB . tmp_3Dmodels . has_key ( str ( operations ) ) : pdblines = DB . tmp_3Dmodels [ str ( operations ) ] import Protool X = Protool . structureIO ( ) X . parsepdb ( pdblines ) return pdblines , X pdblines = parentrec . Structure import Protool X = Protool . structureIO ( ) X . parsepdb ( pdblines ) print operations [ 'Rotamer_operations' ] for operation , uniqueid , atom in operations [ 'Rotamer_operations' ] : if operation == 'delete' : X . remove_atom ( uniqueid ) for operation , uniqueid , atom in operations [ 'Rotamer_operations' ] : if operation == 'add' : chainID = uniqueid . split ( ':' ) [ 0 ] atomname = uniqueid . split ( ':' ) [ - 1 ] residuenumber = uniqueid . split ( ':' ) [ 1 ] resid = '%s:%s' % ( chainID , residuenumber ) status = X . add_atom ( uniqueid = uniqueid , atomname = atomname , residuenumber = residuenumber , chainid = chainID , residuename = atom [ 'RESNAME' ] , xcoord = atom [ 'X' ] , ycoord = atom [ 'Y' ] , zcoord = atom [ 'Z' ] ) if not status : self . parent . record_event ( 'Modelling failed in model_on_the_fly for operations: %s' % ( str ( operations ) ) ) return [ ] X . Update ( ) for this_atom in X . residues [ resid ] : X . atoms [ this_atom ] [ 'RESNAME' ] = atom [ 'RESNAME' ] X . Update ( ) pdblines = X . writepdb ( 'dummy' , nowrite = 1 ) DB . tmp_3Dmodels [ str ( operations ) ] = pdblines [ : ] return pdblines , X else : print 'Parent does not have a structure' return [ ] , None
Produce the PDBlines for the mutant file
Produce the PDBlines for the mutant file
"""Produce the PDBlines for the mutant file""" # Create temporary array holding models
 # Get the structure from the parent
 # Have we already modelled this one?
 # Read parent structure
 # Perform all the operations
 # First do all the deletes
 #print operation,uniqueid,atom 
 # Add atom                    
 # Update the arrays                    
 # Rename the rest of the atoms                    
 #put mutation stuff into a tuple and return it too
 #mutantinfo = (chainID,residuenumber)
 # Return the PDBlines and the instance            
 # Store for next use            

self
DB
operations