Extracting Single Chains From A Pdb File Using Edpdb Module
2
0
Entering edit mode
13.6 years ago
satsurae ▴ 120

I am trying to extract individual chains from a pdb file using the edPDB module. In python I load the module then:

>>> edPDB.xpdb.write_pdb(structure='1ES7.pdb',filename='1ES7_B2.pdb', chain='B')

to which I get the following error:

edPDB.write_pdb: INFO     Setting the chain id for ALL atoms to 'B'
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/lib/python2.6/dist-packages/GromacsWrapper-0.1.15_dev-py2.6.egg/edPDB/xpdb.py", line 194, in write_pdb
    for c in structure.get_chains():
AttributeError: 'str' object has no attribute 'get_chains'

Anyone else have this problem? Is there another way to do this using Python?

Cheers,

Sat

python pdb • 5.0k views
ADD COMMENT
1
Entering edit mode
13.6 years ago

Is there another way to do this using Python?

I don't know much about PDB, but for the structure you gave, you could use XSLT to extract the chains with the following stylesheet:


<xsl:stylesheet xmlns:xsl="&lt;a href="http://www.w3.org/1999/XSL/Transform" "="" rel="nofollow">http://www.w3.org/1999/XSL/Transform'
    xmlns:p="http://pdbml.pdb.org/schema/pdbx-v32.xsd"
        version='1.0'
        >
<xsl:key name="entity_poly" match="p:datablock/p:entity_polyCategory/p:entity_poly" use="@entity_id"/>
<xsl:output method="text"/>

<xsl:template match="/">
<xsl:apply-templates select="p:datablock"/>
</xsl:template>

<xsl:template match="p:datablock">
<xsl:apply-templates select="p:entityCategory/p:entity"/>
</xsl:template>

<xsl:template match="p:entity[@id]">
<xsl:if test="key('entity_poly',@id)">
<xsl:text>></xsl:text>
<xsl:value-of select="p:pdbx_description"/>
<xsl:text>
</xsl:text>
<xsl:value-of select="key('entity_poly',@id)/p:pdbx_seq_one_letter_code"/>
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>

</xsl:stylesheet>

Usage:

xsltproc --novalid chains.xsl "http://www.pdb.org/pdb/download/downloadFile.do?fileFormat=xml&compression=NO&structureId=1ES7"

Result:

>BONE MORPHOGENETIC PROTEIN-2
MAQAKHKQRKRLKSSCKRHPLYVDFSDVGWNDWIVAPPGYHAFYCHGECPFPLADHLNSTNHAIVQTLVNSVNSKIPKAC
CVPTELSAISMLYLDENEKVVLKNYQDMVVEGCGCR
>BONE MORPHOGENETIC PROTEIN RECEPTOR IA
TLPFLKCYCSGHCPDDAINNTCITNGHCFAIIEEDDQGETTLASGCMKYEGSDFQCKDSPKAQLRRTIECCRTNLCNQYL
QPTLPPVVI
ADD COMMENT
1
Entering edit mode

Pierre: I think he is looking for the structure coordinates here.

ADD REPLY
1
Entering edit mode
ADD REPLY
1
Entering edit mode

Did you see the Google translation on wordreference.com? Brilliant ;-)

ADD REPLY
0
Entering edit mode

@Pierre / Chris :) !!

ADD REPLY
1
Entering edit mode
13.6 years ago
satsurae ▴ 120

Thanks for the responses. I ended up emailing the author of the module and he directed to use his new project MDAnalysis. It is fairly straight forward to install, but does have a number of prerequisites. Here is the solution for extracting a chain taken from http://code.google.com/p/mdanalysis/wiki/Examples :

import MDAnalysis
u = MDAnalysis.Universe('1ES7.pdb', permissive=False)    # permissive=False uses Bio.PDB (True will probably also work)
A = u.selectAtoms('segid A')
A.write('1ES7_A.pdb')

Cheers!

ADD COMMENT

Login before adding your answer.

Traffic: 1965 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