-
Notifications
You must be signed in to change notification settings - Fork 36
ComputeBondOrders
dstoeckel edited this page Mar 16, 2015
·
2 revisions
BALL offers an AssignBondOrderProcessor that computes optimal bond order assignments based on atomic penalty scores.
This work was published in
Dehof, A.K., Rurainski, A., Bui, Q.B.A., Böcker, S., Lenhof, H.-P. & Hildebrandt, A. (2011).
Automated Bond Order Assignment as an Optimization Problem.
Bioinformatics, 2011
The processor can be fine tuned via options, e.g.
- AssignBondOrderProcessor::Option::ALGORITHM
- AssignBondOrderProcessor::Option::INIFile
- AssignBondOrderProcessor::Option::MAX_NUMBER_OF_SOLUTIONS
- AssignBondOrderProcessor::Option::COMPUTE_ALSO_NON_OPTIMAL_SOLUTIONS
The processor offers three strategies to solve the optimization problem:
- A-Star
- ILP
- FPT
The FPT is best suited for larger molecules, yet currently does not support all options (e.g. partial bond order assignment, inclusion of bond length information, adding hydrogens).
An exemplary utility application can be found in BALL/source/APPLICATIONS/UTILITIES/assign_bond_orders.C.
#include <BALL/STRUCTURE/assignBondOrderProcessor.h>
...
System system;
// create the processor
AssignBondOrderProcessor abop;
// set some options
abop.options.setInteger(AssignBondOrderProcessor::Option::MAX_NUMBER_OF_SOLUTIONS, 0);
abop.options.setBool(AssignBondOrderProcessor::Option::COMPUTE_ALSO_NON_OPTIMAL_SOLUTIONS, false);
// compute the current score
cout << "Current score: " << abop.evaluatePenalty(&system) << endl;
// apply the processor
system.apply(abop);
cout << "Number of computed solutions: " << abop.getNumberOfComputedSolutions() << endl;
// apply the second solution to the original ligand
abop.apply(1);
cout << "Score of second solution: " << abop.getTotalPenalty(1) << endl;An exemplary python application can be found in BALL/source/EXAMPLES/PYTHON/UTILITIES/assignBondOrders.py.
import sys
from BALL import *
system = System()
...
# create an BondOrderAssignmentProcessor
abop = AssignBondOrderProcessor()
abop.options.setBool(AssignBondOrderProcessor.Option.KEKULIZE_RINGS, True)
abop.options.set(AssignBondOrderProcessor.Option.ALGORITHM, AssignBondOrderProcessor.Algorithm.A_STAR)
abop.options.setInteger(AssignBondOrderProcessor.Option.MAX_NUMBER_OF_SOLUTIONS,10)
abop.options.setBool(AssignBondOrderProcessor.Option.COMPUTE_ALSO_NON_OPTIMAL_SOLUTIONS, True)
print "Current penalty: " , abop.evaluatePenalty(system)
# apply the processor
system.apply(abop)
print "Computed", abop.getNumberOfComputedSolutions(), "bond order assignments:"
# print and export all assignments
for i in range(abop.getNumberOfComputedSolutions()):
print " solution", str(i) , ": penalty", str(abop.getTotalPenalty(i)) #, " , ", abop.getNumberOfAddedHydrogens(i) , " added hydrogens."
# apply the i-th solution
if (abop.apply(i)):
# and write the solution into an MOL2file
outfile_name = String(sys.argv[2]) + "_" + str(i) + ".mol2";
print " Writing solution", i, "as", outfile_name
outfile = MOL2File(outfile_name, File.MODE_OUT)
outfile.write(system)
outfile.close()
# done
print "Done."