UCL-CCS / TIES

Topology Superimposition based on joint graph traversal
MIT License
5 stars 1 forks source link

Stereoisomerism #331

Open AlexW12344 opened 11 months ago

AlexW12344 commented 11 months ago

Hey Mat,

Was there any solutions to do TIES transforms between stereoisomers? With the default setting it seems like the stero parts of the molecule are not seen as different and never included in the alchemical region?

Was the only way to get round this to use knowledge of the dihedrals to distinguish them (https://github.com/UCL-CCS/TIES/issues/283) or could RMSD be used as well?

Cheers, Alex

bieniekmateusz commented 11 months ago

Hey. There are weights now which can help prioritise a good RMSD. It should work. I haven't added dihedrals yet. Do you need it urgently? I think I have more example file inputs somewhere.

ps. I'll dig out an example with the RMSD, but I have to run now.

adw62 commented 11 months ago

Thanks, I would be interested to see the RMSD example when you have time :) I guess the way it works is that the stero parts are forced into the alchemical region if you make the RMSD constraint very tight? I will try this on my end as well and let you know if it works for me.

bieniekmateusz commented 11 months ago

Sure. Thanks, feedback on this would be really handy. So now there is two weights in the Config file, but I didn't connect them to the method at the back. This is a simple tuple (mcs_score_weight, rmsd_weight). See here. The overal score is:

mcs_score = (len(self.matched_pairs) * 2)   /   (len(self.top1) + len(self.top2))

Which is twice the number of matched pairs, over the cumulative number of atoms in topology 1 and 2. So it can only be equal to 1 if the topologies are equal.

The RMSD only currently is calculated only for the matched pairs.

So it uses the hard-coded cofactor of scoring. Can you modify the def extract_best_suptop(suptops, ignore_coords, weights=[1, 1], get_list=False) in topology_superimposer.py to see if it can get you to your destination? Ie weights=[1,2] to increase the importance of the RMSD.

I'll test this on #283 tomorrow when I get a minute and then update you here. Cheers

AlexW12344 commented 11 months ago

Had a go with the most recent code and RMSD weights. For the main code with weights [1,1] I get large alchemical regions say 90% appearing and disappearing where as before the RMSD stuff https://github.com/UCL-CCS/TIES/commit/7faa5d9ae2b0855d7c909992382615023ad9b1b1 I get 10-20%.

If I use weights [1,0] I dont recover the old result and now have alchemical regions of around 40%. These regions partially include the stero atoms (previously they were completely ignored) but the bonds of the stero region are messed up. Sorry I cant share the specific examples.

I got the best results using the older code and this option https://github.com/UCL-CCS/TIES/blob/498726642f62a7ce3a603cc5884ffbfdd5003c4c/ties/config.py#L578-L593 to unmatch the stereo atoms.

With an automatic way to pass ties the names of stero atoms this might work more generally.