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
Python3 PDB NeighborSearch: TypeError: '<' not supported between instances of 'Residue' and 'Residue' #1356
Comments
Object ordering is something which changed drastically from Python 2 to Python 3, and it appears there are still things missing in the PDB code for this (and missing unit test coverage). Cross reference #1189 which is related and was fixed after Biopython 1.70 was released. |
Can confirm it here on an independent piece of code. I'll have a look. Thanks for assigning this Peter, and thanks @harryjubb for raising it! |
@peterjc this also breaks in 1.69 and Python 3. I don't really understand how the comparison was done before, truth be told. The private sorting methods were never called afaik, unless there is some magic somewhere. My first guess is that we need to define Edit |
Yes, __lt__ or __gt__ along with the decorator functools.total_ordering
should do it.
|
I think I fixed it. @harryjubb could you test it on your end? |
Thanks for working on this - I agree a full implementation of sorting with tests is the best plan here 🥇 |
Apologies for the long delay: have run a quick test and so far so good! Thanks for fixing it :), I'll keep trying it out. |
OK, I'll close this issue now - but please do report back if you run into any problems. Thank you! |
Setup
I am reporting a problem with Biopython version, Python version, and operating
system as follows:
Expected behaviour
ns.search_all(2.0, level='R')
to return all pairs of residues in the NeighborSearch object that are within 2 Angstroms of each other.Actual behaviour
Steps to reproduce
Minimal script to reproduce the problem:
The text was updated successfully, but these errors were encountered: