[BioPython] Problem with Bio.PDB

Peter biopython at maubp.freeserve.co.uk
Wed Jul 25 13:00:02 UTC 2007


Shameer Khadar wrote:
> Hi,
> I want to use Bio.PDB module to calculate HSE and Resdue depth for all
> residues in a  couple of proteins.
> This is the code I had written and am getting some serious errors :( .  (My
> PyQ(Python Quotient is low, sorry if there is any significant syntax
> errors:) ))

And your HSE code:
> #!/usr/bin/python
> from Bio.PDB import *
> parser = PDBParser()
> structure = parser.get_structure('str1', '1crn.pdb')
> model=structure[0]
> hse = HSExposure()
> exp_ca = hse.calc_hs_exposure(model, option='CA3')
> exp_cb = hse.calc_hs_exposure(model, option='CB')
> print exp_ca[100]

I'm guessing that code was based on a very old copy of the sample file:
biopython/Scripts/Structure/hsexpo (which lacks a .py extension), dating 
to the release of Biopython 1.40 or earlier.  Note that the DSSP, 
ResidueDepth and HSExposure classes changed two years ago.

Here is my suggestion based on reading the latest version of that 
example (shipped with Biopython 1.41 onwards):

from Bio.PDB import *

RADIUS = 13.0

parser = PDBParser()
structure = parser.get_structure('xxxx', '1crn.pdb')
model=structure[0]

print "HSE based on the approximate CA-CB vectors,"
print "using three consecutive CA positions:"
hse_ca = HSExposureCA(model, RADIUS)
for key in hse_ca.keys() : print key, hse_ca[key]

print "HSE based on the real CA-CB vectors:"
hse_cb = HSExposureCB(model, RADIUS)
for key in hse_cb.keys() : print key, hse_cb[key]


Peter



More information about the Biopython mailing list