Odd result after MergeQueryHs #7442
Unanswered
DavidACosgrove
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have the SMARTS string below, using explicit Hs. If I run the code, the answer is False, which is correct.
If I use MergeQueryHs, and repeat the substructure query:
the answer is True. The merge gives the warning:
[14:41:41] WARNING: merging explicit H queries involved in ORs is not supported. This query will not be merged.
The query is
![image](https://private-user-images.githubusercontent.com/9198870/330832393-c71821d0-170e-41bf-8e00-b1998bc14e20.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgwMjc0MzIsIm5iZiI6MTcxODAyNzEzMiwicGF0aCI6Ii85MTk4ODcwLzMzMDgzMjM5My1jNzE4MjFkMC0xNzBlLTQxYmYtOGUwMC1iMTk5OGJjMTRlMjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MTBUMTM0NTMyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Zjc5Zjg4YmUwYTI0YWQyNmYwMWI4ZjAxY2IzOWY5NDIyMDIwZDg4YWU1MDY3Zjg4ZDRmYTBlNjg0MmNmYzllMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.SNnctnTG66epYfNcX3nuHXvg-UsmWdbI_DKPl-V-NVQ)
![image](https://private-user-images.githubusercontent.com/9198870/330832539-03194b64-e4d1-4edc-a846-5b1622078caa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgwMjc0MzIsIm5iZiI6MTcxODAyNzEzMiwicGF0aCI6Ii85MTk4ODcwLzMzMDgzMjUzOS0wMzE5NGI2NC1lNGQxLTRlZGMtYTg0Ni01YjE2MjIwNzhjYWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MTBUMTM0NTMyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Yjc5ODI5ZWM3MDdjZjlmYTkzMmZlNjVlMTMxYWM5YjY3MTg3YjIwMjVmOWNhNzMxMDljNjMwNzE1MGYzZWU4OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.9fwc1kckoPVim_OvEVLsF92xgwlpIO3jTq-w8ZyvF9Q)
and the molecule is
What seems to have happened is that the query has been partially merged, giving the SMARTS string
O=CC=[C&!H0][#6,#1]
and the match is now True because the single hydrogen on the hydroxylated carbon is being counted twice - once as the H satisfying [C&!H0] and once as the explicit H in [#6,#1].
This issue arose because I was building a FilterCatalog:
and this overload of the SmartsMatcher constructor calls MergeQueryHs. The result was that the FilterCatalog gave different results from building an array of query molecules from the SMARTS and matching them one-by-one against the molecules.
I am not sure if this is a bug or an unwelcome feature, but I think that, at the least, the warning should be stronger, indicating that the query may no longer be correct as a result of the partial merge. It might be better if the query was left completely unchanged if the merge fails, with a warning about this.
Version 2024.03.2, installed via mamba on macOS.
Beta Was this translation helpful? Give feedback.
All reactions