def print_structures(self, static_structure, mobile_structure, pdb_file, single_pdb=False): ''' Print all PDB decoys ''' decoy_list = [] for decoy in self: if singlePDB: decoy_structure = decoy.get_structure(mobile_structure) decoy_list.append((static_structure, decoy_structure)) else: decoy.print_structure(static_structure, decoy_structure, pdb_file+'_'+str(decoy.get_num())+'.pdb') if singlePDB: PDB.write_pdb(decoy_list, pdb_file+'.pdb', multi_chain=True, multi_model=True)
def print_decoys(self, static, mobile, pdbFile, singlePDB=False): ''' Print each decoy in a PDB format @singlePDB = Prints each decoy as a model in a single PDB file ''' staticDecoy = self.get_static_structure(static) decoyList = [] for decoy in self.get_decoys(): mobileDecoy = self.get_mobile_structure(static, mobile, decoy) if singlePDB: DecoyList.append((staticDecoy, mobileDecoy)) else: PDB.write_pdb((staticDecoy, mobileDecoy), pdbFile+'_'+str(decoy.get_id())+'.pdb' , multiChain=True, multiModel=False) if singlePDB: PDB.write_pdb(decoyList, pdbFile+'.pdb', multiChain=True, multiModel=True)
def get_structure(self, mobile_structure): ''' Gets the structure of the given docking result ''' ZDock_create = os.path.abspath(os.path.join(os.path.dirname(__file__), 'ZDock_create')) if self.zdock.switch_num != '': create_cmd = '%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s' % ( ZDock_create, self.zdock.switch_num, self.zdock.rec_rand1, self.zdock.rec_rand2, self.zdock.rec_rand3, self.zdock.lig_rand1, self.zdock.lig_rand2, self.zdock.lig_rand3, self.zdock.r1, self.zdock.r2, self.zdock.r3, self.zdock.l1, self.zdock.l2, self.zdock.l3, self.alpha, self.beta, self.gamma, self.x, self.y, self.z, self.zdock.n, self.zdock.spacing) else: create_cmd = '%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s' % ( ZDock_create, self.zdock.lig_rand1, self.zdock.lig_rand2, self.zdock.lig_rand3, self.zdock.r1, self.zdock.r2, self.zdock.r3, self.zdock.l1, self.zdock.l2, self.zdock.l3, self.alpha, self.beta, self.gamma, self.x, self.y, self.z, self.zdock.n, self.zdock.spacing) p = subprocess.Popen(create_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) create_out, create_err = p.communicate(str(mobile_structure)) structure = PDB.read_pdb(create_out, from_string=True) return structure
def print_structure(self, static_structure, mobile_structure, pdbFile): decoy_structure = self.get_structure(mobile_structure) PDB.write_pdb((static_structure, decoy_structure), pdbFile + '.pdb', multi_chain=True, multi_model=False)