Conversation
|
Hello @cbouy! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-08-26 15:54:51 UTC |
Linter Bot Results:Hi @cbouy! Thanks for making this PR. We linted your code and found the following: Some issues were found with the formatting of your code.
Please have a look at the Please note: The |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4305 +/- ##
===========================================
+ Coverage 93.63% 93.85% +0.21%
===========================================
Files 177 178 +1
Lines 22033 22122 +89
Branches 3115 3129 +14
===========================================
+ Hits 20631 20763 +132
+ Misses 948 902 -46
- Partials 454 457 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8620085 to
ba1714a
Compare
0009427 to
77e5b35
Compare
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class MDAnalysisInferer: |
There was a problem hiding this comment.
No code changes here apart from refactoring all the different bond order inferring functions under this class, a deprecation warning if specifying max_iter anywhere else than in __init__, and some code formatting with black
| ---------- | ||
| template : rdkit.Chem.rdchem.Mol | ||
| Molecule containing the bond orders and charges. | ||
| adjust_hydrogens: bool, default = True |
There was a problem hiding this comment.
Just checking that the default to True sounds reasonable to everyone? Otherwise if you have a charged mol you'll need to add explicit hydrogens on the template to have an exact match with your input mol which may be a bit of a pain.
This was originally in ProLIF to read PDBQT files as valid RDKit mols, happy to add it here (and should be fine license-wise)
There was a problem hiding this comment.
I think True makes sense, especially if this is just to make template matching possible.
However, can you document under which circumstances users should use False?
|
|
||
| def __call__(self, mol: "Chem.Mol") -> "Chem.Mol": | ||
| new = Chem.Mol(mol) | ||
| DetermineBondOrders(new, charge=self.charge) |
There was a problem hiding this comment.
RDKit now also has a DetermineBonds which could be interesting to add as an alternative to guess_bonds? Or at least in the RDKitConverter which requires bonds anyway
|
Thanks @cbouy ! From a quick look this seems great, I'll try to review it at some point over the next week (unless someone gets to it first). P.S. For others that might review here - codecov seems to be throwing a bunch of "uncovered code" messages (when they seem like they are). Cycling the PR might clear them, but I don't think it's a major necessity right now. |
|
@cbouy are you still working on the PR or is this ready for review? |
|
Should be ready for review, I'll just need to update the changelog when ready for merging |
|
That's great. Can you please add the CHANGELOG update right away, even if it will require resolving a merge conflict later? The summary there tends to be really helpful for assessing a PR.... and typically no reviewer will green-light such a PR without the CHANGELOG in place anyway. |
|
@richardjgowers do you have capacity to shepherd the PR to completion? If not please let me know and un-assign yourself. Thanks! |
11f68ac to
3a85fde
Compare
2c09952 to
ea26569
Compare
|
Sorry for the spam, should be good now! |
|
@richardjgowers are you able to review this PR yourself or is there someone you could ping? From my very cursory glance, this looks pretty much ready and would be good to get in, given our roadmap towards "better chemistry". |
|
Not sure why one of the azure test is timing out, or why the bot removed some of the tags but this is re-ready for review 😅 |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
necrobump 😅 Should I split this PR in the refactoring bit vs the additional "inferers" (from template mol and the one using rdkit's XYZ2MOL code) to get it moving? |
orbeckst
left a comment
There was a problem hiding this comment.
I did a very superficial review – noting that a lot of the new code does not show up with test coverage, noting that this would go into 2.10.0 (and not 2.8.0...).
I can't say much about the actual inferrers – I am not a cheminformatics wizard. Generally the refactor and the new additions look sensible to me. Some docs would help to explain the motivation and how the new inferrers would be used.
I would also suggest to make the rdkit converter its own sub-package by creating a rdkitconverter directory and collecting RDKit.py and RDKitInferring.py there.
| ---------- | ||
| template : rdkit.Chem.rdchem.Mol | ||
| Molecule containing the bond orders and charges. | ||
| adjust_hydrogens: bool, default = True |
There was a problem hiding this comment.
I think True makes sense, especially if this is just to make template matching possible.
However, can you document under which circumstances users should use False?
|
Forgot to run black, oopsie, will adjust. |
You're asking the wrong person 🇩🇪 ;-). My hunch is inferrer. Supported by https://en.wiktionary.org/wiki/inferrer |
0caeeb4 to
8dd3df1
Compare
|
ready for next review |
orbeckst
left a comment
There was a problem hiding this comment.
I am going to say 👍 based on the fact that you looked at everything I mentioned and that you're the expert (and not I).
It would be great to have some more eyes from people knowledgeable about the converters/cheminformatics – @lilyminium @IAlibay ? However, I'd say if nobody else has time and there are no major concerns, just merge within a week.
|
@richardjgowers I unassigned you from the PR, please feel free to re-assign yourself if you want to shepherd this PR. Thanks. |
|
Thanks @orbeckst! |
|
Hooray 🎉 ! |
Fixes part of #3996
Changes made in this Pull Request:
RDKitInferringmodule. The bond order and charges inferer has been move to aMDAnalysisInfererdataclass in there.NoImplicitparameter toimplicit_hydrogensand added a separateinfererargument (defaults toMDAnalysisInferer(). PassingNoImplicitto any of the relevant functions will issue a warning and make the necessary arrangements to execute the code in a backwards-compatible way (i.e.implicit_hydrogens=not NoImplicitandif NoImplicit is False: inferer=None).TemplateInfererthat wraps around RDKit'sAssignBondOrdersFromTemplate. There's an additionaladjust_hydrogensparameter that when set toTrueallows one to assign bond orders from a template molecule with implicit hydrogens to an input molecule with explicit hydrogens (which won't work with the baseAssignBondOrdersFromTemplatefor charged molecules where the charged atom has a hydrogen). I originally had this code in ProLIF for dealing with PDBQT inputs, figured it would be worth here as well.rdDetermineBondsinferring wrapper as showcased here.PR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4305.org.readthedocs.build/en/4305/