The first piece of code in the section on the Rules of Five has an error. Instead of using that, copy the following function (by selecting and then using “CTRL+C”) and paste into the Python console (by clicking in the Python console and using “CTRL+V”):
def lipinski(mol):
descs = [('WeightDescriptor', 'MW'), ('HBondDonorCountDescriptor', 'nHBDon'),('HBondAcceptorCountDescriptor', 'nHBAcc'), ('ALOGPDescriptor', 'ALogp2')]
targets = [500, 5, 10, 5.0]
descvalues = mol.calcdesc([x[0] for x in descs])
failures = 0
for desc, target in zip(descs, targets):
descvalue = descvalues["%s_%s" % (desc[0], desc[1])]
if descvalue > target:
failures += 1
return failures