You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
StructureTools#getGroupsWithingShell(Structure, Group,double,boolean) method should return Set<Group> #327
The StructureTools#getGroupsWithinShell(Structure structure, Group group, double distance, boolean includeWater) currently returns a List.
As this method calls the StructureTools#getGroupsWithinShell(Structure structure, Atom atom, Set excludeResidues, double distance, boolean includeWater) repeatedly for each atom, the returned list can contain multiple copies of the same Group object as it may be within the threshold distance from more than 1 atom in the query group.
The method called also returns a Set, which makes sense, and it would therefore make more sense for both methods to return a Set.
However, changing the return type of this method may break other code elsewhere, so maybe a new method:
public static Set getUniqueGroupsWithinShell(Structure structure, Group group, double distance, boolean includeWater)
should be added?
If you let me know which is preferred, I will implement it.
I'd say let's change the signature of that method. I don't think it is widely used, as such this should be not too painful. Any patch for this is welcome! Please also update any other place in the code that is referring to this method. Thanks!
Just a note related to that method, there's some more code to calculate contacts and atoms within a distance in the org.biojava.nbio.structure.contact package. In the StructureTools class there's some methods making use of them, see for instance getAtomsInContact(Chain, Chain, String[], double, boolean). The return type of those ones is an AtomContactSet, which in turn contains AtomContacts (both classes from the org.biojava.nbio.structure.contact package).
Thanks Jose. I will take a look at those.
I have checked and the method here is not called anywhere else, so I see no problems with changing the signature. I have therefore changed the signature to return Set, and the implementation generates a LinkedHashSet as per the other #getGroupsWithinShell method, and submitted a pull request
Steve
Activity
andreasprlic commentedon Sep 17, 2015
I'd say let's change the signature of that method. I don't think it is widely used, as such this should be not too painful. Any patch for this is welcome! Please also update any other place in the code that is referring to this method. Thanks!
sroughley commentedon Sep 17, 2015
OK, I will check for anywhere in the code referring to that and unless it causes too many problems, submit a pull request in the next few days.
josemduarte commentedon Sep 17, 2015
Just a note related to that method, there's some more code to calculate contacts and atoms within a distance in the
org.biojava.nbio.structure.contactpackage. In theStructureToolsclass there's some methods making use of them, see for instancegetAtomsInContact(Chain, Chain, String[], double, boolean). The return type of those ones is anAtomContactSet, which in turn containsAtomContacts (both classes from theorg.biojava.nbio.structure.contactpackage).josemduarte commentedon Sep 17, 2015
The tutorial has something about contacts, have a look too:
https://github.com/biojava/biojava-tutorial/blob/master/structure/contact-map.md
Modified StructureTools#getGroupsWithinShell method to return a Set not
sroughley commentedon Sep 18, 2015
Thanks Jose. I will take a look at those.
I have checked and the method here is not called anywhere else, so I see no problems with changing the signature. I have therefore changed the signature to return Set, and the implementation generates a LinkedHashSet as per the other #getGroupsWithinShell method, and submitted a pull request
Steve
Merge pull request #328 from sroughley/master