Prevent splitting commas in SMARTS expressions#120
Prevent splitting commas in SMARTS expressions#120speakinside wants to merge 3 commits intoipb-halle:masterfrom
Conversation
|
Hi, cool, thanks for the contribution, I enabled the test run. |
|
Sure, one test case added |
|
Hi, I can confirm that things compile, the test fails with current master and succeeds with your patch. |
|
I was wondering the same when I saw this... |
|
I found the problem when I used the "FilterSmartsInclusionList" parameter to pre-filter the candidates. the value I used for this parameter was So the right split would be Any other comma split would result in incorrect SMARTS expressions, causing errors in the constructor function of Also, I suspected the "FilterSmartsExclusionList" parameter would face the same issue. So, I doubt splitting all commas would be a feature. |
|
OK so part of the problem is that (as you mentioned) commas are valid separators within SMARTS expressions contained within square brackets (as are semi-colons), but the expression you provided seems to require a comma and space combination as a separator for examples that are not in square brackets (which is two separators, not one). Is the space mandatory in the fix? Are you able to provide a candidate list/query parameters that you used together with this SMARTS expression, to test this for ourselves? |
|
No, the space is not a part of the separator. The original code and mine both trim the substring. Here is a parameter file I used |
|
What irks me is that we have that nowhere documented, maybe I could ask for a piece of documentation and an example ? I tried to figure where best to put that, and frankly only found |
|
I primarily use the command line tool in my research. Based on my understanding, the Regarding your example, would the parameter list I provided in my previous comment meet your requirements?
Additionally, I've implemented some code updates that now properly handle commas between bond primitives in SMARTS notation (e.g., |
|
I see some tests have failed. It should be easy to fix. Should I fix it in my pull request? I worry it may be irrelevant to my pull request. |
|
Hi, thanks for checking, and a separate PR with that fix would be highly appreciated, |
…rtsInclusionList" or "FilterSmartsExclusionList" parameters.
…erSmartsInclusionList" or "FilterSmartsExclusionList" parameters.
The SMARTS expressions with commas in the parameters like "FilterSmartsInclusionList" will be wrongly split right now, since all the commas are split in the current code.
As far as I know, the comma in SMARTS expressions only appears in paired square brackets.
Therefore, I added a new function to prevent splitting the commas in SMARTS expressions based on the above fact.
Hope it can be useful.