def setup_design(numcores, conf_spaces, eps, num_seqs, algo_index, data): """setup_design Set up the classes required to run the design conf_spaces: A dictionary containing protein, ligand, and complex conf spaces along with force-field parameters num_seqs: The number of top sequences we want (usually 5) Returns a BBKStar instance, ready to run """ parallelism = osprey.Parallelism(cpuCores=numcores) data['numCpus'] = numcores # how should we compute energies of molecules? minimizingEcalc = osprey.EnergyCalculator(conf_spaces['complex'], conf_spaces['ffparams'], parallelism=parallelism, isMinimizing=True) # record the seq tree file name data['seq_tree_name'] = data["design name"] + "seqTree.tree" # configure basic inputs for SHARKStar design = osprey.BBKStar( conf_spaces['protein'], conf_spaces['ligand'], conf_spaces['complex'], numBestSequences=num_seqs, epsilon= eps, # you proabably want something more precise in your real designs showPfuncProgress=True, maxSimultaneousMutations=9, numConfsPerBatch=BBK_BATCH_SIZE, maxNumConfsPerBatch=8, #printSequenceTree=data["seq_tree_name"] ) # configure SHARK*/BBK* inputs for each conf space configure_bbk(design, minimizingEcalc, "shark", data["design name"], algo_index) return design
# how should we define energies of conformations? def confEcalcFactory(confSpace, ecalc): eref = osprey.ReferenceEnergies(confSpace, ecalc) return osprey.ConfEnergyCalculator(confSpace, ecalc, referenceEnergies=eref) # configure BBK* bbkstar = osprey.BBKStar( proteinConfSpace, ligandConfSpace, complexConfSpace, numBestSequences=2, epsilon= 0.99, # you proabably want something more precise in your real designs writeSequencesToConsole=True, writeSequencesToFile='bbkstar.results.tsv') # configure BBK* inputs for each conf space for info in bbkstar.confSpaceInfos(): # how should we define energies of conformations? eref = osprey.ReferenceEnergies(info.confSpace, minimizingEcalc) info.confEcalcMinimized = osprey.ConfEnergyCalculator( info.confSpace, minimizingEcalc, referenceEnergies=eref) # compute the energy matrix ematMinimized = osprey.EnergyMatrix(info.confEcalcMinimized,
rigidEcalc = osprey.SharedEnergyCalculator(minimizingEcalc, isMinimizing=False) # how should we define energies of conformations? def confEcalcFactory(confSpace, ecalc): eref = osprey.ReferenceEnergies(confSpace, ecalc) return osprey.ConfEnergyCalculator(confSpace, ecalc, referenceEnergies=eref) # configure BBK* bbkstar = osprey.BBKStar(proteinConfSpace, ligandConfSpace, complexConfSpace, numBestSequences=5, epsilon=0.683, writeSequencesToConsole=True, writeSequencesToFile='bbkstar.results.tsv') # configure BBK* inputs for each conf space for info in bbkstar.confSpaceInfos(): # how should we define energies of conformations? eref = osprey.ReferenceEnergies(info.confSpace, minimizingEcalc) info.confEcalcMinimized = osprey.ConfEnergyCalculator( info.confSpace, minimizingEcalc, referenceEnergies=eref) # compute the energy matrix ematMinimized = osprey.EnergyMatrix(info.confEcalcMinimized, cacheFile='emat.%s.dat' % info.id)
eref = osprey.ReferenceEnergies(confSpace, ecalc) return osprey.ConfEnergyCalculator(confSpace, ecalc, referenceEnergies=eref) # how should confs be ordered and searched? def astarFactory(emat, rcs): return osprey.AStarMPLP(emat, rcs, numIterations=5) # run K* bbkstar = osprey.BBKStar(proteinConfSpace, ligandConfSpace, complexConfSpace, rigidEcalc, minimizingEcalc, confEcalcFactory, astarFactory, numBestSequences=2, epsilon=0.99, energyMatrixCachePattern='emat.*.dat', writeSequencesToConsole=True, writeSequencesToFile='bbkstar.results.tsv') scoredSequences = bbkstar.run() # use results for scoredSequence in scoredSequences: print("result:") print("\tsequence: %s" % scoredSequence.sequence) print("\tscore: %s" % scoredSequence.score)
import osprey osprey.start() # run this example AFTER you've trained the three LUTE models using LUTE.train.py # import our conf spaces from another file exec(open("LUTE.confSpaces.py").read()) # configure BBK* bbkstar = osprey.BBKStar(confSpaces['protein'], confSpaces['ligand'], confSpaces['complex'], epsilon=0.01, numBestSequences=2, writeSequencesToConsole=True) # configure BBK* inputs for each conf space for info in bbkstar.confSpaceInfos(): # read the trained LUTE model pmat = osprey.DEE_read(info.confSpace, 'LUTE.pmat.%s.dat' % info.id) model = osprey.LUTE_read('LUTE.%s.dat' % info.id) # make a LUTE energy calculator from the model luteEcalc = osprey.LUTE_ConfEnergyCalculator(info.confSpace, model) info.confEcalcMinimized = luteEcalc # how should confs be ordered and searched? # (since we're in a loop, need capture variables above by using defaulted arguments) def makeAStar(rcs, luteEcalc=luteEcalc, pmat=pmat):