Protocol Online logo
Top : New Forum Archives (2009-): : Bioinformatics and Biostatistics

Script for retrieving information from PDB - (Dec/02/2009 )

I am looking for a script that returns the name of a structure whose PDB ID is given. For example, when the input is "1afo", the output will be "DIMERIC TRANSMEMBRANE DOMAIN OF HUMAN GLYCOPHORIN A, NMR, 20 STRUCTURES"

Does anybody have a script that does it or could someone point me to in the right direction for writing it in Python?

Edit: PDB=Protein Data Bank (www.pdb.org)

-mmt-

What database are you retrieving the info from? I could write it in Perl, but I don't know Python...

-HomeBrew-

HomeBrew on Dec 2 2009, 08:19 PM said:

What database are you retrieving the info from? I could write it in Perl, but I don't know Python...


From PDB. (Protein Data Bank - www.pdb.org). I wanted to integrate the code it into another Python program that I'm writing, but I guess a separate perl script would work too.

-mmt-

Do you want to the program to prompt for the PDB ID input, or read it from a file?

-HomeBrew-

HomeBrew on Dec 3 2009, 12:19 AM said:

Do you want to the program to prompt for the PDB ID input, or read it from a file?


Ideally what I wanted to do was give it a list of PDB IDs in a text file, and get the output in a text file again. For example:

when input.txt looks like:

3emg
2v4w
2e1q
...

output.txt:

<Name of structure 1>
<Name of structure 2>
<Name of structure 3>


Thanks for your attention.

-mmt-

This will get a PDB file.

import urllib
def get_pdb(id):
url = 'http://www.rcsb.org/pdb/files/%s.pdb' % id
return urllib.urlopen(url).readlines()

myid = "3chy"

for line in get_pdb(myid):
print line.strip()

-perlmunky-

perlmunky on Dec 8 2009, 06:43 AM said:

This will get a PDB file.

import urllib
def get_pdb(id):
url = 'http://www.rcsb.org/pdb/files/%s.pdb' % id
return urllib.urlopen(url).readlines()

myid = "3chy"

for line in get_pdb(myid):
print line.strip()


Thanks perlmunky. Again:)

-mmt-

The PDB offers RESTful and SOAP services, I only recently found out about them (damn it). See here for details on the RESTful approach http://www.pdb.org/pdb/software/rest.do

-perlmunky-

I'm sorry, mmt -- this somehow slipped off my to-do list. Are you all set?

Thanks for jumping in, perlmunky...

-HomeBrew-

HomeBrew on Dec 10 2009, 05:49 AM said:

I'm sorry, mmt -- this somehow slipped off my to-do list. Are you all set?

Thanks for jumping in, perlmunky...


No problem, think I will have to change the username to pythonmunky ... or not. The solution I provided won't really help with getting the functional information - that's where the RESTful interface comes in and perhaps some more wonderful code (yippee).

-perlmunky-