[BioPython] protein-ligand interactions
mitlox
mitlox at op.pl
Fri Mar 20 12:18:48 UTC 2009
Thank you very much for your code, it works and the output is exactly
for what I was looking for.
I try to get a structureCA object to write out the results in a PDB file
(outCA.pdb) like this:
ATOM 5275 CA ILE A 881 17.242 57.141 22.062 1.00
38.49 C
ATOM 5283 CA VAL A 882 16.292 57.880 25.678 1.00
38.90 C
....
And the second reason for a structureCA object is that I do not want use:
structureCA = Bio.PDB.PDBParser().get_structure(outCA.pdb, outCA.pdb)
Unfortunately I get this error with the extension:
ILE 881 3.64203
VAL 882 3.58559
ALA 885 4.62673
THR 886 4.95211
ILE 963 4.64252
ASP 964 3.08788
Traceback (most recent call last):
File "interaction.py", line 31, in ?
io.save('out.pdb')
File
"/usr/lib/python2.4/site-packages/biopython-1.49-py2.4-linux-i686.egg/Bio/PDB/PDBIO.py",
line 121, in save
for model in self.structure.get_list():
AttributeError: 'list' object has no attribute 'get_list'
Here is the code:
import Bio.PDB
import numpy
pdb_code = "1E8W"
pdb_filename = "1E8W.pdb"
structure = Bio.PDB.PDBParser().get_structure(pdb_code, pdb_filename)
model = structure[0]
chainA = model["A"]
structureCA = []
def residue_dist_to_ligand(protein_residue, ligand_residue) :
"""Returns distance from the protein C-alpha to the closest ligand
atom."""
distances = []
for atom in ligand_residue :
diff_vector = protein_residue["CA"].coord - atom.coord
distances.append(numpy.sqrt(numpy.sum(diff_vector * diff_vector)))
return min(distances)
#From looking at the PDB file, ligand is last residue in chain A, named QUE
ligand_res = chainA.child_list[-1]
assert ligand_res.resname == "QUE"
for protein_res in chainA.child_list[:-1] :
dist = residue_dist_to_ligand(protein_res, ligand_res)
if dist < 5.0 :
print protein_res.resname, protein_res.id[1], dist
structureCA.append(protein_res)
io=Bio.PDB.PDBIO()
io.set_structure(structureCA)
io.save('outCA.pdb')
How can I get a structureCA object of the results?
Thank you in advance.
Best regards
More information about the Biopython
mailing list