Molecule selections too similar

Hi,

It's often the case that we need to select a subset of molecules based on a number of objectives including chemical desirability and diversity.

Using the Pareto subset optimiser is a nice tool for doing this, for example, maxmising unique feature counts for fingerprint bits or Murcko scaffolds can help encourage diversity.

However, I have found that similar molecules can still be selected and think that better performance could result from minimising the maximum similarity between compounds within the subset.

Has anyone tried this or knows whether this might be easy to implement? - I notice there is a "custom score" option available although can't quite see whether/how this could be used for this purpose

Thanks in advance

Kris

Answers 10
JB
JB 2010-09-21

Hi,

I did something similar using the help from one of the protocol

with the maxmin method

MaxMin method see http://www.springerlink.com/content/wlm8077091q5248t Optimization and visualization of molecular diversity of combinatorial libraries from Hassan et al.

It is this example protocol:

07 Create Drug-Like Diverse Libraries with Custom Score

Where the custom score is a component to do the calculation of similarity between molecules. But you could replace it by another one (like Diversity FP Distances).

Those components have multiple output:

  • MinDistance: the minimum distance observed between any pair of molecules in the set.
  • AvgDistance: the average distance for all pairs of molecules in the set.
  • MaxDistance: the maximum distance observed between any pair of molecules in the set.

So in your idea, you could use Diversity Property Distances (or FP), as custom score.

In the parameter Custom Score Property, you could put MaxDistance (or MaxSimiliraty).

And  goal: minimize.

What I tried what to use the MinDistance and maximize it using the Diversity FP distances fingerprint. But I did not compare with something else.

Cheers,

Jérémy

KB
KB 2010-09-22

Thanks for your reply Jérémy, this would indeed seem to be the way to do it - however, upon testing the result is expected...

The minimum distance statistic for the subset calculated using the custom score (as recommended above) does not agree with the minimum distance calculated for the subset afterwards using the fingerprint similarity component - try running the attached protocol and see for yourself...

Is this a bug or am I wrong to expect that the minimum distances should be the same??

comment imagecomment image
JB
JB 2010-09-22

Hi,

That's a good observation (it is also the case for the Accelrys example by picking one subset the value on the graphs is not the same than the one calculated separately).

If a person with more knowledge (Dana/Willem?) comes around please provide a good explanation.

I have the impression that the value that is output by the pareto component does not take into account the full set of data in a subset, but a pair in the subset.

Which does not seem to be the case for the Unique Value Count, that works.

I would assume as well that it should be the same, so it seems to work (increasing the number of iterations increases the true value of MinDistance) but the output is not what I would expect.

I'm sorry that I can't provide more explanation.

To add more observations to the protocol attached:

Also I tried with more iterations and found this:

100 Iterations, 1 Subset, 10 Cpds:

Value from Pareto Cmpt: 0.93750

Value from the normal component: 0.85227

50 Iterations, 1 Subset, 10 Cpds:

Value from Pareto Cmpt: 0.93750

Value from the normal component: 0.80952

So yep it seems to work with more iterations, the value is increasing. But the value displayed as output is the same in both cases and not the one expected.

And the log file for 50 iterations is:

Iteration     MinDistance (Diversity FP Distances)
0     0.8852459
2     0.88888889
[...]
8     0.88888889
10     0.9
12     0.90697674

[...]

20 0.92391304
[...]
28     0.92391304
30     0.93181818
[...]
38     0.93181818
40     0.9375
[...]
50     0.9375

DH
DH 2010-09-22

Thanks for flagging this. It turns out there is a bug in the optimizer for certain types of Custom Score Protocol, including Diversity Property Distances. But fortunately there is a workaround.

The way the optimizer works with a custom score protocol is to "push" all the members of a given subset through the protocol, followed by empty data records until an answer comes out. If you open up the Diversity Property Distances component (which is a subprotocol), you'll notice that there is a fork in the first pipe. Evidently, the approach used by the optimizer doesn't work for this case. You end up getting a minimum distance based on just a subset of all pairwise distance comparisons.By contrast, Diversity Num FP Features, which doesn't contain a forked pipe, works fine as a custom scorer.

The workaround is to create a custom version of the component that first caches the incoming data and then reads from the cache. See the attached custom component. Using this as a custom scorer with the example protocol "07 Create Drug-Like Diverse Libraries with Custom Score", you get MinDistance values from the optimizer in agreement with MinDistance values by direct calculation.

Diversity FP Distances has the same problem as Diversity Property Distances, so you'll need to create an analogous custom version if you want to use that component with the optimizer.

comment imagecomment image
KB
KB 2010-11-04

On closer inspection I think there may indeed be a bug, even with the workaround...

If you output the list of structures that enter the custom-score protocol it seems that the Pareto subset optimiser submits only half of the subset structures to the custom score protocol, e.g. if selecting a subset size 100, only 50 structures are entered into the custom score protocol

Is there some explanation or a fix please??

DH
DH 2010-11-04

This is the behavior you see with a branched initial pipe as in the "Diversity Property Distances" component. That is, half of the input records get lost. Please check your custom score protocol and confirm that there are no branches in the first pipe.

If you modify the "My Diversity Property Distances" component that I posted by changing the cache reader/writer scope to User Only, you can read the cache after the optimization and see that all compounds made it through. If instead you insert a no-op component and branch the first pipe to write the input stream to an SD file as well as to the cache, you will find that the SD file contains only half the expected compounds.

If this does not explain what you see, please post the custom score protocol you are using and I will see if I can find what the problem is.

DH
DH 2010-11-04

As far as the optimizer is concerned, any custom score protocol is a black box which takes the members of a subset as input and produces a score as output. Any details of how the score is produced are opaque to the optimizer. Thus, any tracking of already-computed distances must be done by the scoring protocol itself.

But note that for each subset, you'd need to store the 10K x 10K / 2 matrix of distances somewhere. That's a lot of memory, or a lot of disk I/O if you store to disk (which you'd probably need to). 0.5 x 10^8 floating point distances is roughly half a gigabyte of memory -- and that's just for one subset.

Even if you could do this, the performance increase might not be that great. This is because the crossover operation of the genetic algorithm used by the optimizer can replace a large fraction of the compounds in a given subset. In crossover, two subsets are "mated" to produce a child subset. The child may contain, say, 5543 compounds from parent subset 1 and 4457 from parent subset 2. Even if the original distances were cached and the appropriate subset of the parent distance matrices transferred to the child, there are 5543 x 4457 new distances that need to be calculated. Finally, once all distances have been computed, you still need to perform order-n-squared comparisons to find the minimum distance. By storing already-computed distances, you could perhaps reduce the compute time per iteration from 1 hour to 30 minutes, but I doubt you'd be able to get it down to 10 minutes or less.

I think there's no getting around that fact that optimizing large subsets with an order-n-squared score is an expensive problem to solve with Pareto optimization. Not only is each iteration costly, but larger subsets tend to take more iterations to converge. You might consider first doing a preliminary optimization with an order-n diversity measure such as the number of unique FP features and then optimizing the results of that optimization using the more expensive distance-based score. (Output the results of the first optimization as "Original Data with Subset IDs" so they can be used as input to the second optimization.)

Another thought is to use clustering to get an already-diverse, but smaller, parent population and then use a less expensive diversity measure in the Pareto optimization when you trade off diversity against other properties.

KB
KB 2010-11-04

Thanks for the workaround Dana, I have a question about the Pareto subset optimiser that has arisen from testing this out...

When selecting large subsets of molecules e.g. 10,000 the custom scoring using diversity FP distances is very slow (>1 hour per iteration!) - this is understandable since the component has to do a 10,000 by 10,000 comparison to find the minimum distance between a pair of molecules in the subset. However, this approach is hugely inefficient since all that is needed is to calculate the similarity for those molecules that differ between iterations - presumably only a relatively small proportion of the selected subset is replaced each iteration?

I think this would be a significant improvement that would allow for application of the Pareto subset optimiser on a large scale

So I guess my question is whether (and if so how) it is possible to monitor the list of molecules in the subset each iteration such that the similarity calculation need only be carried out for the newly added molecules?

I'm sure it should be possible although I don't know if achieving this would require access to the Pareto subset optimiser component internal data

CO
CO 2011-01-20

I am unfortunately using an old version (6.1.5) of PP and your attached protocol "My Diversity Property Distance.xml" is written in version 8 and contains features not supported in my old version.

Could you please provide me a version of your protocol compatible with version 6.1.5.

Thanks

DH
DH 2011-01-26

Claude,

Attached is a version I built in PP 6.1.5, which I tested with the example protocol "07 Create Drug-Like Diverse Libraries with Custom Score."

Cheers,

Dana

comment imagecomment image