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

OpenBabelParser and Tests #12

Merged
merged 29 commits into from
Jul 31, 2024
Merged

Conversation

lunamorrow
Copy link
Collaborator

In reference to #10. This is a draft of the code with the initial functionality starting to be roughly scaffolded out for feedback.

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

@lunamorrow lunamorrow self-assigned this Jun 20, 2024
@pep8speaks
Copy link

pep8speaks commented Jun 20, 2024

Hello @lunamorrow! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 16:72: W292 no newline at end of file

Comment last updated at 2024-07-31 05:52:44 UTC

@lunamorrow
Copy link
Collaborator Author

lunamorrow commented Jun 20, 2024

@hmacdope @cbouy @exs-cbouy @xhgchen Here is the start of the OpenBabelParser. Let me know if you have any suggestions/changes/concerns/etc. I will fix the PEP8 formatting oops!

Copy link
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

Looking great! Time to start exploring some of the edges with tests.

mda_openbabel_converter/OpenBabelParser.py Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
@lunamorrow lunamorrow marked this pull request as draft June 24, 2024 01:16
Copy link
Collaborator

@cbouysset cbouysset left a comment

Choose a reason for hiding this comment

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

Great start Luna 💪

mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
Copy link
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

Coming along nicely, see comments for suggestions.

mda_openbabel_converter/tests/test_openbabel_parser.py Outdated Show resolved Hide resolved
Comment on lines 238 to 247
# # PDB only
# for vals, Attr, dtype in (
# (altlocs, AltLocs, object),
# (chainids, ChainIDs, object),
# (occupancies, Occupancies, np.float32),
# (tempfactors, Tempfactors, np.float32),
# ):
# if vals:
# attrs.append(Attr(np.array(vals, dtype=dtype)))
Copy link
Member

Choose a reason for hiding this comment

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

How do you plan on handling this?

mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
# assert_equal(expected, top.elements.values)

# need to check other attrs including:
# 'ids', 'names', 'resids', 'resnums', 'chiralities', 'segids', 'charges'
Copy link
Member

Choose a reason for hiding this comment

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

I would add at least three more OBmols originating from files to test. Try and vary the chemistry, something large and protein-like perhaps, an SDF with a complex organic ligand, and something rather metallic. You can set these up in conftest.py

mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/__init__.py Outdated Show resolved Hide resolved
mda_openbabel_converter/tests/test_openbabel_parser.py Outdated Show resolved Hide resolved
@hmacdope
Copy link
Member

@lunamorrow you should also try and fix #7 (in a separate PR ) so that we can verify that the tests are working as intended here.

Copy link
Collaborator

@cbouysset cbouysset left a comment

Choose a reason for hiding this comment

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

Nice improvements Luna!

My main concern is about the use of OB v2 instead of v3 since v2 is quite old now (and v3 isn't exactly brand new). I'm happy with sticking to v2 for now, getting everything working, and then make the few required changes to switch to v3 in another PR if it's easier.

Also sorry for the lack of more regular comments resulting in me posting too many suggestions in one go 😅

.github/workflows/gh-ci.yaml Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved

# convert atomic number to element
elements.append(OBElementTable().GetSymbol(atom.GetAtomicNum()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: since we need to reuse that element table, better to assign an instance as a constant at the top of the module and reuse that same instance here

mda_openbabel_converter/OpenBabelParser.py Outdated Show resolved Hide resolved
mda_openbabel_converter/data/files.py Outdated Show resolved Hide resolved
lunamorrow added a commit that referenced this pull request Jul 24, 2024
pyproject.toml Outdated Show resolved Hide resolved
@lunamorrow lunamorrow marked this pull request as ready for review July 31, 2024 05:53
@lunamorrow lunamorrow merged commit c15500b into MDAnalysis:main Jul 31, 2024
19 of 20 checks passed
lunamorrow added a commit that referenced this pull request Sep 23, 2024
@lunamorrow lunamorrow mentioned this pull request Sep 23, 2024
4 tasks
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.

5 participants