pierrepo / PBxplore

A suite of tools to explore protein structures with Protein Blocks :snake:
https://pbxplore.readthedocs.org/en/latest/
MIT License
28 stars 17 forks source link

MDAnalysis select_atoms() error #68

Closed HubLot closed 8 years ago

HubLot commented 8 years ago

Hi,

With the commit 48bc2bdd and MDAnalysis version 0.10, I have the following error :

Traceback (most recent call last):
  File "../PBassign.py", line 157, in <module>
    pbassign_cli()
  File "../PBassign.py", line 131, in pbassign_cli
    for comment, chain in chains:
  File "/path/to/PDBlib.py", line 530, in chains_from_trajectory
    selection = universe.select_atoms("backbone")
AttributeError: 'Universe' object has no attribute 'select_atoms'

This is due to a change in the API of MDAnalysis in their last version (0.11): https://github.com/MDAnalysis/mdanalysis/wiki/MDAnalysis-0.11-unifying-release-user-guide The method selectAtoms in version < 0.11 become select_atoms with versions >= 0.11

I think we need to support both versions since the 0.11 is really new. I will make a PR in that sense

pierrepo commented 8 years ago

@HubLot I'm not a big fan of keeping legacy functionalities. Could we instead modify the file dev_requirements.txt to require MDAnalysis >= 0.11? That would be much easier. An extra check of the MDAnalysis version in the code would also strengthen the thing.

jbarnoud commented 8 years ago

I am usually in favour of keeping compatibility with the penultimate version of a library. Yet, in this case I would go with @pierrepo :

We could get a compatibility tweak with import tricks and Monckey patching. But if we have this, then it should be marked right away as deprecated and come with an expiration date.

cc @HubLot

HubLot commented 8 years ago

Okay guys, you are right :) Let's support only versions >= 0.11 I will modify the dev_requirements.txt and README. It will be added also in the setup.py once PBxplore is packaged