Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppress rdkit reaction atom map warning in residue padder #198

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

diogomart
Copy link
Contributor

For the reaction run by ResiduePadders, it suppresses the following rdkit warnings:

[23:00:47] product atom-mapping number 11 not found in reactants.
[23:00:47] product atom-mapping number 12 not found in reactants.
[23:00:47] product atom-mapping number 11 not found in reactants.
[23:00:47] product atom-mapping number 12 not found in reactants.
[23:00:47] product atom-mapping number 13 not found in reactants.

these arise because the product has atom labels that the reactants don't, but those labels are added on purpose. The filter is removed immediately after the reaction. Since the logger is a singleton, it is not guaranteed that the same warning won't be suppressed when multiprocessing from some other reaction that happens to be running, but I think that's OK.

@diogomart diogomart requested a review from rwxayheee October 15, 2024 06:18
Copy link
Contributor

@rwxayheee rwxayheee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Tested with some basic examples. Thanks!

rdkit_logger = logging.getLogger("rdkit")
rdkit_logger.handlers[0].setLevel("WARNING")
rdkit_logger.handlers[0].setFormatter(
logging.Formatter('[RDKit] %(levelname)s:%(message)s'),
Copy link
Contributor

@rwxayheee rwxayheee Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's in init, it will change the format of RDKit logging messages (severity >= warning) once meeko is imported. Do you want to enforce this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving a record of what we discussed: I don't know. It may be useful to know which messages come from RDKit.

@diogomart diogomart merged commit f784758 into develop Oct 15, 2024
1 check passed
@diogomart diogomart deleted the supress_atom_map_rdkit_warning branch October 15, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants