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

Added compatibility with MDAnalysis 2.4 #36

Merged
merged 28 commits into from
Feb 3, 2023
Merged

Added compatibility with MDAnalysis 2.4 #36

merged 28 commits into from
Feb 3, 2023

Conversation

ianmkenney
Copy link
Member

  • Removed the get_propka function (next version must be 2.0.0)
  • PropkaTraj constructor accepts atom indices for selections
  • Pandas Index with a dtype of float64 instead of Float64Index, per deprecation warning from Pandas
  • Removed removed tests for get_propka and changed the baseanalysis test names to be being the standard
  • Expanded parameters for test_single_frame_regression
  • Removed MDAnalysis version constraint in setup.py

- Removed the `get_propka` function (next version must be 2.0.0)
- PropkaTraj constructor accepts atom indices for selections
- Pandas Index with a dtype of float64 instead of Float64Index,
  per deprecation warning from Pandas
- Removed removed tests for `get_propka` and changed the baseanalysis
  test names to be being the standard
- Expanded parameters for `test_single_frame_regression`
- Removed MDAnalysis version constraint in setup.py
@ianmkenney
Copy link
Member Author

ianmkenney commented Jan 27, 2023

@orbeckst do you know why this linter might be failing? it does not fail for me locally and I'm using the same version of pylint...

@ianmkenney ianmkenney mentioned this pull request Jan 27, 2023
8 tasks
@orbeckst
Copy link
Member

no idea, sorry

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Can we just decide to only support Python ≥ 3.8? If so, the setup.py metadata needs to be up-to-date (and we could remove six etc). We can then also set MDAnalysis>=2.

I am confused why select can be a list/array of indices in addition to a selection str. I can't remember when we added that but in any case, it's unlike any of the other typical MDA analysis functions so given that we do 2.0.0 #37 anyway, i suggest we remove this functionality and make it as simple as possible.

@@ -5,7 +5,7 @@

from __future__ import print_function, division

from six import string_types, StringIO, raise_from
from six import StringIO, raise_from
Copy link
Member

Choose a reason for hiding this comment

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

We could get rid of six and just support Python >=3.8

Copy link
Member

Choose a reason for hiding this comment

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

... but that can be another issue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If CI is 3.8+ then we should just make that move now.

Comment on lines 154 to 155
if not isinstance(select, str):
self.ag = atomgroup.atoms[select].atoms
Copy link
Member

Choose a reason for hiding this comment

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

Why is this necessary? Can select be a index array??

Copy link
Member

Choose a reason for hiding this comment

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

The doc string says that it can only be a string. If you want it to also be an index array then you need to change the docs and a versionchanged.

However, MDAnalysis analysis functions never use index arrays: either a selection or an AtomGroup. I'd probably just remove the ability to pass anything except a selection string and keep it simple.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, I'm also opposed to using an index array unless there's a good reason for it.

propkatraj/propkatraj.py Show resolved Hide resolved
propkatraj/tests/test_regression.py Outdated Show resolved Hide resolved
@@ -52,32 +53,8 @@ def pka_from_file(filename):
return resnums, pkas


@pytest.mark.parametrize('selection', ['protein', 'array', 'list'])
@pytest.mark.parametrize('selection', ['protein', 'ag', 'array', 'list'])
Copy link
Member

Choose a reason for hiding this comment

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

I honestly have no idea why we are testing anything except a selection string. As far as I am concerned, I would just test "protein" and perhaps "protein and resid 1-10".

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like line 79 was erroneously removed and this one (which was intended for the old method) was kept instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

@IAlibay I figured that I'd do the union of the two parameter sets. I'll switch it to just protein and ag

propkatraj/tests/test_regression.py Show resolved Hide resolved
Copy link
Collaborator

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

I'll have a look at the pylint failure later today

.github/workflows/gh-ci.yaml Outdated Show resolved Hide resolved
.github/workflows/gh-ci.yaml Outdated Show resolved Hide resolved
devtools/environment.yml Outdated Show resolved Hide resolved
Comment on lines 154 to 155
if not isinstance(select, str):
self.ag = atomgroup.atoms[select].atoms
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, I'm also opposed to using an index array unless there's a good reason for it.

@@ -52,32 +53,8 @@ def pka_from_file(filename):
return resnums, pkas


@pytest.mark.parametrize('selection', ['protein', 'array', 'list'])
@pytest.mark.parametrize('selection', ['protein', 'ag', 'array', 'list'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like line 79 was erroneously removed and this one (which was intended for the old method) was kept instead.

propkatraj/tests/test_regression.py Show resolved Hide resolved
propkatraj/tests/test_regression.py Show resolved Hide resolved
- instead of original 'protein' use 'default'
- added 'protein' to replace 'ag'
- New selections can be added move conveniently now, but the use
  of `PSF_FRAME_ZERO_PKA` gets in the way. Selecting a file from a
  dictionary based on the selection string would fix this.
@ianmkenney
Copy link
Member Author

@IAlibay @orbeckst Linting failed because MDAnalysis was not installed alongside pylint, it had no idea what attributes were defined in the superclass and just assumed I wrote something invalid. This is probably going to be an issue for projects using the cookiecutter.

@IAlibay
Copy link
Collaborator

IAlibay commented Jan 31, 2023

@IAlibay @orbeckst Linting failed because MDAnalysis was not installed alongside pylint, it had no idea what attributes were defined in the superclass and just assumed I wrote something invalid. This is probably going to be an issue for projects using the cookiecutter.

That should be easy enough to fix, we should push a self install upstream to the cookiecutter bits.

@ianmkenney
Copy link
Member Author

I raised an issue for the cookiecutter.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Looking pretty good, just some issues surrounding MDA and Python versions.

devtools/environment.yml Outdated Show resolved Hide resolved
propkatraj/tests/test_regression.py Outdated Show resolved Hide resolved
setup.py Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@ianmkenney
Copy link
Member Author

@IAlibay Is the current state of this good for you?

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

WIth use of .results (which is good), the docs also need to be changed

  • doc string
  • example notebook

propkatraj/propkatraj.py Show resolved Hide resolved
self.failed_times = []
self.results.pkas = []
self.results.num_failed_frames = 0
self.results.failed_frames_log = []
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove failed_frames_log and just use failed_frames?

Copy link
Member

Choose a reason for hiding this comment

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

oops misunderstood:frames vs times, will fix

self.num_failed_frames += 1
self.failed_frames_log.append(self._ts.frame)
self.failed_times.append(self._ts.time)
self.results.num_failed_frames += 1
Copy link
Member

Choose a reason for hiding this comment

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

superfluous?

Can we remove failed_frames_log and just use failed_frames?

@orbeckst
Copy link
Member

orbeckst commented Feb 3, 2023

@ianmkenney sorry, lots of doc updates, please squash eventually or just squash the whole PR

@ianmkenney
Copy link
Member Author

@IAlibay do the proposed changes work for you?

Copy link
Collaborator

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Sorry I thought I had pushed the request changes a couple hours ago, but for some reason it's not done it...

PYLINTRC: .pylintrc
run: |
pylint propkatraj
pypi_check:
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's some empty line consistency issues all over this yaml 🤣 it's not technically incorrect so I won't block over it, but I don't know how I'm the only one feeling anxious looking at the formatting..

Comment on lines 212 to 213
perc_failure = (self.results.num_failed_frames / self.n_frames) \
* 100
Copy link
Collaborator

Choose a reason for hiding this comment

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

PEP8 implicit line continuation vs explicit?

Tbh here please do just break PEP8 and put it on one line, line comprehension >>> adhering to 79 chars

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm typically on board with that, I don't particularly like the column maximum requirement, especially for an indentation based language. I will gladly switch it back.

setup.py Outdated
@@ -25,27 +19,25 @@
classifiers=['Development Status :: 6 - Mature',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'License :: OSI Approved :: GNU General Public License v2+ (GPLv2+)',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
'License :: OSI Approved :: GNU General Public License v2+ (GPLv2+)',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',

See: https://github.com/pypa/trove-classifiers/blob/main/src/trove_classifiers/__init__.py#L276

packages=['propkatraj'],
scripts=[],
license='GPLv3',
long_description=open('README.md').read(),
long_description_content_type='text/markdown; variant=GFM',
install_requires=['six', 'numpy', 'pandas', 'MDAnalysis<2.0.0', 'propka==3.1']
python_requires='>=3.8',
install_requires=['numpy', 'pandas', 'MDAnalysis>=2.0.0', 'propka==3.1']
Copy link
Collaborator

Choose a reason for hiding this comment

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

re: propka3.1, I can't fully remember. My suggestion is that after this PR we open a separate one that unpins and see what happens.

If I remember correctly 3.2 is broken, then we fixed things upstream and 3.3 works, see: #20. Probably in the next PR just try to pin directly to 3.3 and see if that runs fine, then we can do >=3.3?

Copy link
Member Author

Choose a reason for hiding this comment

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

That sounds reasonable.

- PEP8 requirement ignored in favor of clarity
- setup.py license: v2+ -> v2 or later
Copy link
Collaborator

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

lgtm!

@IAlibay
Copy link
Collaborator

IAlibay commented Feb 3, 2023

Are we happy to squash merge?

@ianmkenney
Copy link
Member Author

Are we happy to squash merge?

Squash away

@IAlibay IAlibay merged commit f3c8f56 into dev Feb 3, 2023
@IAlibay IAlibay deleted the mda2.4 branch February 3, 2023 21:07
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.

3 participants