connorcoley / rdchiral

Wrapper for RDKit's RunReactants to improve stereochemistry handling
MIT License
154 stars 53 forks source link

FutureWarning in template_extractor.py #12

Closed acquaregia closed 4 years ago

acquaregia commented 4 years ago

Dear Connor, I receive a warning message whne usign the template extactor, is it anything we should work on?

thanks a lot in advance, kind regards. marco

D:\development\PycharmProjects\crac\rdchiral\templates\template_extractor.py:491: FutureWarning: Possible nested set at position 4 atom_tags_in_reactant_fragments = re.findall('\:([[0-9]+)]', reactant_fragments)

connorcoley commented 4 years ago

Thanks for the heads up. It looks like I accidentally put in an extra open square bracket in that expression. It's being parsed in a slightly different way than intended but doesn't have an effect on the functionality in this context. The regular expression should be changed to what appears elsewhere in the file:

all_labels = re.findall('\:([0-9]+)\]', transform)

which explicitly escapes the close square bracket as the final character.

P.S. As-is, it that expression is parsed as [ [0-9 ]+ so that an open square bracket could be matched in the captured group. The final close square bracket is still parsed as a literal character as expected, but this behavior must be changing in new versions of Python's regex handler

acquaregia commented 4 years ago

Thanks Connor, for the replay and the explanation, I'll get any new version you will publish. Great work, by the way. Cheers, marco

Il giorno ven 6 dic 2019 alle ore 19:35 Connor Coley < notifications@github.com> ha scritto:

Thanks for the heads up. It looks like I accidentally put in an extra open square bracket in that expression. It's being parsed in a slightly different way than intended but doesn't have an effect on the functionality in this context. The regular expression should be changed to what appears elsewhere in the file:

all_labels = re.findall('\:([0-9]+)]', transform)

which explicitly escapes the close square bracket as the final character.

P.S. As-is, it that expression is parsed as [ [0-9 ]+ so that an open square bracket could be matched in the captured group. The final close square bracket is still parsed as a literal character as expected, but this behavior must be changing in new versions of Python's regex handler

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/connorcoley/rdchiral/issues/12?email_source=notifications&email_token=AJN3JMIZUTBAEEFR6F5B5GTQXKLPTA5CNFSM4JVHYAGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGE7B6Q#issuecomment-562688250, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJN3JMMX3VYOTVCES4OYJATQXKLPTANCNFSM4JVHYAGA .