How to use biopython neighborsearch?
1
1
Entering edit mode
7.2 years ago
lcy9086 ▴ 10

I am trying to figure out whether a compound is a potential drug precursor using biopython. And I need to search the atoms in the compound within a certain range of a given atom in a given residue. But I don't know how to use the NeighborSearch in the Bio.PDB and after reading this website(Syntax For Neighborsearch Module In Biopython) just made me more confused....

Could anyone procide me with a specific example about how to use the NeighborSearch? Thank you very much!

biopython python • 7.3k views
ADD COMMENT
6
Entering edit mode
7.2 years ago
Rodrigo ▴ 190

Normally you should write down what have you tried so others understand the specifics of the problem. That being said, here is an concrete example for NeighborSearch. Suppose you have a PDB 1prot.pdb in the current directory and want to find all residues at distance 5 angstroms from alpha carbon in residue position 311 in chain A:

import Bio.PDB

parser = Bio.PDB.PDBParser(QUIET=True) # QUIET=True avoids comments on errors in the pdb.

structures = parser.get_structure('1prot', '1prot.pdb')
structure = structures[0] # 'structures' may contain several proteins in this case only one.
target_atom = structure['A'][311]['CA']

atoms  = Bio.PDB.Selection.unfold_entities(structure, 'A')
ns = Bio.PDB.NeighborSearch(atoms)

close_atoms = ns.search(target_atom.coord, 5)

close_atoms is a list containing all atoms at distance 5 from the coordinates of target_atom. Note that this includes target_atom itself. To eliminate it from the list do: close_atoms.remove(target_atom).

ADD COMMENT
0
Entering edit mode

Thanks a lot for your help ,and sorry for the fact that I haven't posted what I have written in the question. The real problem is that those codes seem so unfamiliar with me and I have trouble understanding why I should write something like 'unfold_entities' or 'atom_list'(see in the url I posted). I suppose it is actually a statement of initiation? By the way, when I change the 'A' in the "atoms = Bio.PDB.Selection.unfold_entities(structure, 'A')" statement into the name of the drug, then the search result is limited to the atoms in the drug, is that how it works?

Thank you very much!!!!!!

ADD REPLY
0
Entering edit mode

I recommend you to try to learn python then at the same time you try to understand this code. I recommend you this book.

Now, everything in the example prefixed by Bio is part of the biopython package. In the same manner, everything prefixed by Bio.PDB is part of the PBB module of biopython, you get the idea.

Bio.PDB.Selection.unfold_entities(structure, 'A') returns a list of all the atoms in structure. Here the A is for atoms, you can change it by an R or C for residues and chain respectively.

All that information is explained in this tutorial.

To search in all the atoms of your drug, you need to define structure with the structure of your drug. This can be done easily like in the first three lines of the example. You just need to replace 1prot.pdb by the name of your drug's PDB file. If it is in another format than PDB, then you need to use another parser, e.g. mmCIF file use Bio.PDB.MMCIFParser. Again, all that is included in the tutorial.

Good luck.

ADD REPLY

Login before adding your answer.

Traffic: 1612 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6