[Biopython-dev] [Biopython - Bug #3276] (New) inconsistent returns of Bio.PDB.NeighborSearch.search()
redmine at redmine.open-bio.org
redmine at redmine.open-bio.org
Wed Aug 3 14:52:32 UTC 2011
Issue #3276 has been reported by Hongbo Zhu.
----------------------------------------
Bug #3276: inconsistent returns of Bio.PDB.NeighborSearch.search()
https://redmine.open-bio.org/issues/3276
Author: Hongbo Zhu
Status: New
Priority: Normal
Assignee:
Category:
Target version:
URL:
In the current version of BioPython (source code as of 3 Aug. 2011), it seems the outcome of Bio.PDB.NeighborSearch.search() is inconsistent if different levels are specified when the returned list is empty.
i.e.
@
ns.search(center, radius, 'A')
[]
ns.search(center, radius, 'R') # similar for levels 'C', 'M', 'S'
IndexError: list index out of range
@
Obviously, this is because the Bio.PDB.NeighborSearch.search() functions tries to convert returned list to levels other than 'A' using function Bio.PDB.Selection.unfold_entities() (see line 92 in NeighborSearch.py). In function unfold_entities(), the first element of input argument entity_list is evaluated without entity_list being checked for emptiness (see line 47 in Selection.py). An IndexError is raised when entity_list is empty.
So, I think either the length of the returned list in Bio.PDB.NeighborSearch.search() should be checked before invoking Bio.PDB.Selection.unfold_entities(), or the function Bio.PDB.Selection.unfold_entities() should be revised so that it simply returns an empty list if the argument entity_list is empty. I prefer the latter solution because this would also fix other similar situations when Bio.PDB.Selection.unfold_entities() is invoked in other functions.
cheers, hongbo
----------------------------------------
You have received this notification because this email was added to the New Issue Alert plugin
--
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here and login: http://redmine.open-bio.org
More information about the Biopython-dev
mailing list