Closed MrDarkHorse closed 5 years ago
Any thoughts on this?
@MrDarkHorse Thanks a lot for the feedback. In current bond stereo detection code, it is assumed that the end atoms/groups should be on different side of the bond line. The error may occur when two end groups are moved to the same side of bond as shown in your figures. This issue should be fixed soon.
Thanks! I know these are kind of ambiguous scenarios. In our situation, since we use this for teaching purposes, we would prefer that ambiguous defaults to non-matching. Thank you so much for your help!
@MrDarkHorse The issue has been fixed, please check the latest release files, :).
Thank you for fixing this!
One more ambiguous case I'm trying to deal with is if we are trying to match an ambiguous linear bond. Again, this is weird, but right now this is matching, and I was hoping that in this case it would default to not matching. I had a solution for this using the old method, but I haven't been able to sort it out using the new method.
These 2 structures should not match because the first is ambiguously drawn.
Wait! I actually have a solution for this. I could make a pull request for it if it's something others are interested in having.
adding the following lines in _calcParityOfCoordPairs:
`var axisAngle = Math.atan2(axisVector.y, axisVector.x);
var rightAxisVector = CU.substract(c1, a1); // vector of bond
var leftAxisVector = CU.substract(b1, c2); // vector of bond
var rightAxisAngle = Math.atan2(rightAxisVector.y, rightAxisVector.x);
var leftAxisAngle = Math.atan2(leftAxisVector.y, leftAxisVector.x);
var threshold = 1e-2;
var leftDiff = Math.abs(axisAngle - leftAxisAngle);
var rightDiff = Math.abs(axisAngle - rightAxisAngle);
// if there is an linearly drawn bond angle, the stereo parity is UNKNOWN
if (leftDiff < threshold || rightDiff < threshold) {
return SP.UNKNOWN;
}`
@MrDarkHorse The liner bond issue is now fixed. Please check the latest release files.
Found some weird scenarios, best shown with pictures. In my case, I'm comparing structures with 2 stereo bonds, and I'm really testing for isometry here.
First case, same structure, it correctly matches them:
Second case, I drop the Oxygen to the other side, and again, it correctly knows that these structures no longer match:
Then it starts getting weird.
Third case, I drop the Nitrogen below the left bond, but it still thinks they match
There are other variants as well.
Fourth case, I pull the Chlorine above the bond on the right, and it still thinks they match:
Another version of the previous:
Seems like something in the parity calculation breaks down. Right?