[BioPython] using NeighborSearch

Thomas Hamelryck thamelry at binf.ku.dk
Wed Feb 2 12:02:35 EST 2005


On Wednesday 02 February 2005 17:30, Minami Mo wrote:
> Hi,
>
> I am a new user to Biopython. I have to use the NeighborSearch
> function to find out the contacting atoms within certain distance.
> However, it returns error immediately when i instantiates the class
> NeighborSearch. below is a fragment of the code:

The following code works for me:

----
from Bio.PDB import *
import sys

p=PDBParser()
s=p.get_structure('X', sys.argv[1])
atom_list=Selection.unfold_entities(s,'A')
ns=NeighborSearch(atom_list)
center=atom_list[0].get_coord()
R=5.0
neighbor_l=ns.search(center,R)
residue_list=Selection.unfold_entities(neighbor_l,'R')

print residue_list
----

Maybe the PDB file is corrupt? In any case, I'll look into it
later (I'm a bit busy this week)....

Cheers,

-Thomas



More information about the BioPython mailing list