def prepare_receptor(self, molecule): path = '{}_receptor.pdb'.format(self.tmpfile) pathqt = path + 'qt' pdb = molecule.write(absolute=path, filetype='pdb') self._paths.append(path) mol = MolKit.Read(path)[0] mol.buildBondsByDistance() RPO = AD4ReceptorPreparation(mol, outputfilename=pathqt) self._paths.append(pathqt) return pathqt
def receptor_preparation(receptor, output): receptor_filename = receptor verbose = None repairs = 'checkhydrogens' charges_to_add = 'gasteiger' preserve_charge_types=None cleanup = "nphs_lps_waters_nonstdres" mode = 'automatic' delete_single_nonstd_residues = None dictionary = None mols = Read(receptor) mol = mols[0] RPO = AD4ReceptorPreparation(mol, mode, repairs, charges_to_add, cleanup, outputfilename=output, delete_single_nonstd_residues=delete_single_nonstd_residues,dict=dictionary)
def preprocess_receptor(receptor_filename, outputfilename): repairs = '' charges_to_add = 'gasteiger' preserve_charge_types=None cleanup = "" mode = "automatic" delete_single_nonstd_residues = False dictionary = None mols = Read(receptor_filename) mol = mols[0] preserved = {} if charges_to_add is not None and preserve_charge_types is not None: preserved_types = preserve_charge_types.split(',') for t in preserved_types: if not len(t): continue ats = mol.allAtoms.get(lambda x: x.autodock_element==t) for a in ats: if a.chargeSet is not None: preserved[a] = [a.chargeSet, a.charge] if len(mols)>1: ctr = 1 for m in mols[1:]: ctr += 1 if len(m.allAtoms)>len(mol.allAtoms): mol = m mol.buildBondsByDistance() RPO = AD4ReceptorPreparation(mol, mode, repairs, charges_to_add, cleanup, outputfilename=outputfilename, preserved=preserved, delete_single_nonstd_residues=delete_single_nonstd_residues, dict=dictionary) if charges_to_add is not None: for atom, chargeList in preserved.items(): atom._charges[chargeList[0]] = chargeList[1] atom.chargeSet = chargeList[0]
if verbose: print "mol set to ", ctr, "th molecule with", len( mol.allAtoms), "atoms" mol.buildBondsByDistance() if verbose: print "setting up RPO with mode=", mode, print "and outputfilename= ", outputfilename print "charges_to_add=", charges_to_add print "delete_single_nonstd_residues=", delete_single_nonstd_residues RPO = AD4ReceptorPreparation( mol, mode, repairs, charges_to_add, cleanup, outputfilename=outputfilename, preserved=preserved, delete_single_nonstd_residues=delete_single_nonstd_residues, dict=dictionary) if charges_to_add is not None: #restore any previous charges for atom, chargeList in preserved.items(): atom._charges[chargeList[0]] = chargeList[1] atom.chargeSet = chargeList[0] # To execute this command type: # prepare_receptor4.py -r pdb_file -o outputfilename -A checkhydrogens