Question: Extracting Single Chains From A Pdb File Using Edpdb Module
0
gravatar for satsurae
7.9 years ago by
satsurae120
satsurae120 wrote:

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

pdb python • 3.0k views
ADD COMMENTlink written 7.9 years ago by satsurae120
1
gravatar for Pierre Lindenbaum
7.9 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum118k wrote:

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 COMMENTlink written 7.9 years ago by Pierre Lindenbaum118k
1

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

ADD REPLYlink written 7.9 years ago by Khader Shameer18k
1

saperlipopette ! http://www.wordreference.com/fren/saperlipopette

ADD REPLYlink written 7.9 years ago by Pierre Lindenbaum118k
1

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

ADD REPLYlink written 7.9 years ago by Chris Evelo9.9k

@Pierre / Chris :) !!

ADD REPLYlink written 7.5 years ago by Khader Shameer18k
1
gravatar for satsurae
7.9 years ago by
satsurae120
satsurae120 wrote:

Thanks for the responses. I ended up emailing the author of the module and he directed to use his new project MDAnalysis http://code.google.com/p/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 COMMENTlink written 7.9 years ago by satsurae120
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2276 users visited in the last hour