This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retreive associated DOI from PDB

Does anyone know if it's possible (and if so how) to obtain a DOI number associated with a PDB ID, through a script - preferably in python.

The idea is this:

  1. Existing script trawls HMMs, returns a closest PDB ID match.
  2. Results of script in 1 are tabulated by my own script.
  3. For each PDB hit that's returned, I'd like to 'look up' the DOI of the paper responsible for depositing it, and append that DOI to the end of the line in the table.

Cheers

pdb python doi

3 answers

Check out the PDBe REST API: http://www.ebi.ac.uk/pdbe/api/doc/

Simple python example:

import requests

res = requests.get("https://www.ebi.ac.uk/pdbe/api/pdb/entry/publications/5m98")
data = res.json()

print(data["5m98"][0]['doi'])

Oh perfect, thanks very much! Python continues to amaze.

Interesting, this was the approach a colleague suggested, I'll give it a go!

Thanks Pierre, the following worked for me:

esearch -db pubmed -query "4MIX" | esummary | xtract -pattern DocumentSummary -block ArticleId -sep "\t" -tab "\n" -element IdType,Value | grep doi | cut -f 2

I'm surprised you didn't choose genomax2's answer

My experience with XML and web querying is pretty limited so chose the path of least resistance!

using a xsltstylesheet:


<xsl:stylesheet xmlns:xsl="&lt;a href=" <a="" href="http://www.w3.org/1999/XSL/Transform" rel="nofollow">http://www.w3.org/1999/XSL/Transform" "="" rel="nofollow">http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="dataset/record"/>
</xsl:template>
<xsl:template match="record">
    <xsl:variable name="acn" select="dimStructure.structureId/text()"/>
    <xsl:for-each select="dimStructure.doi">
        <xsl:value-of select="$acn"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="./text()"/>
        <xsl:text>
</xsl:text>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

execute:

curl -s  'http://www.rcsb.org/pdb/rest/customReport.xml?pdbids=1stp,2jef,1cdg&customReportColumns=structureId,doi&primaryOnly=1' |\
xsltproc stylesheet.xsl -

1STP null
2JEF 10.1074/jbc.M700656200
1CDG 10.1006/jmbi.1994.1168

See the example 2 for PDB API here.

Log in to answer this question.