Discussion:
[BioPython] hsexposure.py
Bhima A van der Molen
2009-02-06 17:42:01 UTC
Permalink
Hi,

I am a newbe to the list.. I just started my PhD and I am trying to get
some calculations for surface accessibility for some proteins stored in
PDB format.

There is a niffty little script included with the BioPython download in
the scripts folder called hsexposure.py which is supposed to calculate
the half sphere exposure of each residue in the PDB file. However, when
I run it with the option to calculate HSE (all variations) I get 0
stored in the b-factor column of my PDB file instead of the count.. so I
tried extracting the code I want specifically.. i.e. the part to
calculate the HSEBU values and tried to get it to print on the screen..
I get the same result.. 0.0 as my HSE value.. see code below:


##code begins##
from Bio import PDB
from Bio.PDB import *
import sys

pdbfile=open('/home/aurobhima/pdb/pdb1fat.ent')
p=PDBParser()
s=p.get_structure('X', pdbfile)
m=s[0]
RADIUS=12.0
format ="4%i"

hse=PDB.HSExposureCB(m, RADIUS)
k = 'EXP_HSE_A_U'

residue_list=PDB.Selection.unfold_entities(m,'R')

for r in residue_list:

if r.xtra.has_key(k):

exposure=r.xtra[k]

if icode==' ':
icode='_'

resname=r.get_resname()

print (("%s %4i %c\t"+format) % (resname, resseq, icode, exposure))
else:
exposure=0.0

print exposure

##code ends##

if anybody has any ideas it would really help out..
I should point out that the DSSP and CN calculations work fine with the
script..

Thanks
Bhima

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bav853.vcf
Type: text/x-vcard
Size: 312 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20090206/4d09ff3c/attachment.vcf>
Peter
2009-02-12 12:05:09 UTC
Permalink
Post by Bhima A van der Molen
Hi,
I am a newbe to the list.. I just started my PhD and I am trying to get
some calculations for surface accessibility for some proteins stored in
PDB format.
There is a niffty little script included with the BioPython download in
the scripts folder called hsexposure.py which is supposed to calculate
the half sphere exposure of each residue in the PDB file. ?However, when
I run it with the option to calculate HSE (all variations) I get 0
stored in the b-factor column of my PDB file instead of the count..
It looks like the hsexposure script may be a tiny it out of date, I'll
have a quick look at this.
Post by Bhima A van der Molen
so I tried extracting the code I want specifically.. i.e. the part to
calculate the HSEBU values and tried to get it to print on the screen..
hse=PDB.HSExposureCB(m, RADIUS)
k = 'EXP_HSE_A_U'
Your code was looking for the EXP_HSE_A_U result, but never calculated
it. If you used HSExposureCB, then the extra data keys are
EXP_HSE_B_U and EXP_HSE_B_D. If you want EXP_HSE_A_U then use the
HSExposureCA class instead.

e.g.

##code begins##
from Bio import PDB

pdbfile=open('1AD5.pdb')
p=PDB.PDBParser()
s=p.get_structure('X', pdbfile)
m=s[0]
RADIUS=12.0

print "Using CB"
hse=PDB.HSExposureCB(m, RADIUS)
residue_list=PDB.Selection.unfold_entities(m,'R')
for r in residue_list[:10]:
print r.get_resname(), r.xtra
print "..."

print "Using CA"
hse=PDB.HSExposureCA(m, RADIUS)
residue_list=PDB.Selection.unfold_entities(m,'R')
for r in residue_list[:10]:
print r.get_resname(), r.xtra
print "..."
##code ends##

Peter
Peter
2009-02-12 12:18:13 UTC
Permalink
Post by Peter
Post by Bhima A van der Molen
There is a niffty little script included with the BioPython download in
the scripts folder called hsexposure.py which is supposed to calculate
the half sphere exposure of each residue in the PDB file. ?However, when
I run it with the option to calculate HSE (all variations) I get 0
stored in the b-factor column of my PDB file instead of the count..
It looks like the hsexposure script may be a tiny it out of date, I'll
have a quick look at this.
It looks like Thomas must have been trying two naming schemes for the
xtra data dictionary keys, unfortunately the example script got
checked in using EXP_HSEAD, EXP_HSEAU, EXP_HSEBD and EXP_HSEBU but the
Bio.PDB.HSExposure module was checked in using the similar but
different EXP_HSE_A_D, EXP_HSE_A_U, EXP_HSE_B_U and EXP_HSE_B_D. I
have updated the script in CVS, which you will be able to download
from here in about an hour's time:

http://cvs.biopython.org/cgi-bin/viewcvs/viewcvs.cgi/biopython/Scripts/Structure/hsexpo?cvsroot=biopython

This now seems to work :)

Peter
Peter
2009-02-12 20:26:02 UTC
Permalink
HI Peter,
Thank you for sorting that out... I am running the script on my
sequences now and I'm getting useful results.
Thank you again, you saved me a lot of work.
Regards
Bhima
Great - and thanks for reporting the problem to us.

Peter
Peter
2009-02-12 20:26:02 UTC
Permalink
HI Peter,
Thank you for sorting that out... I am running the script on my
sequences now and I'm getting useful results.
Thank you again, you saved me a lot of work.
Regards
Bhima
Great - and thanks for reporting the problem to us.

Peter

Peter
2009-02-12 12:18:13 UTC
Permalink
Post by Peter
Post by Bhima A van der Molen
There is a niffty little script included with the BioPython download in
the scripts folder called hsexposure.py which is supposed to calculate
the half sphere exposure of each residue in the PDB file. ?However, when
I run it with the option to calculate HSE (all variations) I get 0
stored in the b-factor column of my PDB file instead of the count..
It looks like the hsexposure script may be a tiny it out of date, I'll
have a quick look at this.
It looks like Thomas must have been trying two naming schemes for the
xtra data dictionary keys, unfortunately the example script got
checked in using EXP_HSEAD, EXP_HSEAU, EXP_HSEBD and EXP_HSEBU but the
Bio.PDB.HSExposure module was checked in using the similar but
different EXP_HSE_A_D, EXP_HSE_A_U, EXP_HSE_B_U and EXP_HSE_B_D. I
have updated the script in CVS, which you will be able to download
from here in about an hour's time:

http://cvs.biopython.org/cgi-bin/viewcvs/viewcvs.cgi/biopython/Scripts/Structure/hsexpo?cvsroot=biopython

This now seems to work :)

Peter
Bhima A van der Molen
2009-02-06 17:42:01 UTC
Permalink
Hi,

I am a newbe to the list.. I just started my PhD and I am trying to get
some calculations for surface accessibility for some proteins stored in
PDB format.

There is a niffty little script included with the BioPython download in
the scripts folder called hsexposure.py which is supposed to calculate
the half sphere exposure of each residue in the PDB file. However, when
I run it with the option to calculate HSE (all variations) I get 0
stored in the b-factor column of my PDB file instead of the count.. so I
tried extracting the code I want specifically.. i.e. the part to
calculate the HSEBU values and tried to get it to print on the screen..
I get the same result.. 0.0 as my HSE value.. see code below:


##code begins##
from Bio import PDB
from Bio.PDB import *
import sys

pdbfile=open('/home/aurobhima/pdb/pdb1fat.ent')
p=PDBParser()
s=p.get_structure('X', pdbfile)
m=s[0]
RADIUS=12.0
format ="4%i"

hse=PDB.HSExposureCB(m, RADIUS)
k = 'EXP_HSE_A_U'

residue_list=PDB.Selection.unfold_entities(m,'R')

for r in residue_list:

if r.xtra.has_key(k):

exposure=r.xtra[k]

if icode==' ':
icode='_'

resname=r.get_resname()

print (("%s %4i %c\t"+format) % (resname, resseq, icode, exposure))
else:
exposure=0.0

print exposure

##code ends##

if anybody has any ideas it would really help out..
I should point out that the DSSP and CN calculations work fine with the
script..

Thanks
Bhima

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bav853.vcf
Type: text/x-vcard
Size: 312 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython/attachments/20090206/4d09ff3c/attachment-0002.vcf>
Peter
2009-02-12 12:05:09 UTC
Permalink
Post by Bhima A van der Molen
Hi,
I am a newbe to the list.. I just started my PhD and I am trying to get
some calculations for surface accessibility for some proteins stored in
PDB format.
There is a niffty little script included with the BioPython download in
the scripts folder called hsexposure.py which is supposed to calculate
the half sphere exposure of each residue in the PDB file. ?However, when
I run it with the option to calculate HSE (all variations) I get 0
stored in the b-factor column of my PDB file instead of the count..
It looks like the hsexposure script may be a tiny it out of date, I'll
have a quick look at this.
Post by Bhima A van der Molen
so I tried extracting the code I want specifically.. i.e. the part to
calculate the HSEBU values and tried to get it to print on the screen..
hse=PDB.HSExposureCB(m, RADIUS)
k = 'EXP_HSE_A_U'
Your code was looking for the EXP_HSE_A_U result, but never calculated
it. If you used HSExposureCB, then the extra data keys are
EXP_HSE_B_U and EXP_HSE_B_D. If you want EXP_HSE_A_U then use the
HSExposureCA class instead.

e.g.

##code begins##
from Bio import PDB

pdbfile=open('1AD5.pdb')
p=PDB.PDBParser()
s=p.get_structure('X', pdbfile)
m=s[0]
RADIUS=12.0

print "Using CB"
hse=PDB.HSExposureCB(m, RADIUS)
residue_list=PDB.Selection.unfold_entities(m,'R')
for r in residue_list[:10]:
print r.get_resname(), r.xtra
print "..."

print "Using CA"
hse=PDB.HSExposureCA(m, RADIUS)
residue_list=PDB.Selection.unfold_entities(m,'R')
for r in residue_list[:10]:
print r.get_resname(), r.xtra
print "..."
##code ends##

Peter
Loading...