Created
September 19, 2013 12:40
-
-
Save jctoledo/6622850 to your computer and use it in GitHub Desktop.
Find details about a given ligand in a PDB structure using biopython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Bio.PDB import * | |
import sys | |
p = PDBParser(PERMISSIVE=1) | |
ligand_id = "ADE" | |
radius = 5.4 | |
pdbl = PDBList() | |
structure_id = "1Y26" | |
pdbl.retrieve_pdb_file(structure_id, pdir="/tmp") | |
filename = "1y26.pdb" | |
#see for more details: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc153 | |
structure = p.get_structure(structure_id, filename) | |
models = structure.get_list() | |
#iterate over the models | |
for aModel in models: | |
#get all the chains in this model | |
chains = aModel.get_list() | |
#compute the surface of this model | |
#surface = get_surface() | |
#rd = ResidueDepth(aModel, filename) | |
#get all the atoms in this model | |
model_atoms = Selection.unfold_entities(aModel,'A') | |
#create a NeighborSearch | |
ns = NeighborSearch(model_atoms) | |
#search the chains in for the ligand_id | |
for aChain in chains: | |
residues = aChain.get_list() | |
for aResidue in residues: | |
if aResidue.get_resname() == ligand_id: | |
atom_list = Selection.unfold_entities(aResidue, 'A') | |
#pick a center | |
center = atom_list[0].get_coord() | |
neighbors = ns.search(center, radius) | |
residue_list = Selection.unfold_entities(neighbors, 'R') | |
for aResidue in residue_list: | |
print aResidue.get_full_id() | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment