Jump to content

  • Log in with Facebook Log in with Twitter Log in with Windows Live Log In with Google      Sign In   
  • Create Account

Submit your paper to J Biol Methods today!
Photo
- - - - -

Script for retrieving information from PDB


  • Please log in to reply
9 replies to this topic

#1 mmt

mmt

    member

  • Active Members
  • Pip
  • 11 posts
0
Neutral

Posted 02 December 2009 - 05:05 PM

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)

Edited by mmt, 02 December 2009 - 09:22 PM.


#2 HomeBrew

HomeBrew

    Veteran

  • Global Moderators
  • PipPipPipPipPipPipPipPipPipPip
  • 930 posts
16
Good

Posted 02 December 2009 - 08:19 PM

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

#3 mmt

mmt

    member

  • Active Members
  • Pip
  • 11 posts
0
Neutral

Posted 02 December 2009 - 09:21 PM

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.

#4 HomeBrew

HomeBrew

    Veteran

  • Global Moderators
  • PipPipPipPipPipPipPipPipPipPip
  • 930 posts
16
Good

Posted 03 December 2009 - 12:19 AM

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

#5 mmt

mmt

    member

  • Active Members
  • Pip
  • 11 posts
0
Neutral

Posted 03 December 2009 - 03:17 PM

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.

#6 DELETEMYACCOUNTPLEASE

DELETEMYACCOUNTPLEASE

    Y U NOT DELETE MY ACCOUNT?

  • Active Members
  • PipPipPipPipPip
  • 58 posts
1
Neutral

Posted 08 December 2009 - 06:43 AM

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()

#7 mmt

mmt

    member

  • Active Members
  • Pip
  • 11 posts
0
Neutral

Posted 08 December 2009 - 01:29 PM

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:)

#8 DELETEMYACCOUNTPLEASE

DELETEMYACCOUNTPLEASE

    Y U NOT DELETE MY ACCOUNT?

  • Active Members
  • PipPipPipPipPip
  • 58 posts
1
Neutral

Posted 10 December 2009 - 02:26 AM

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/p...oftware/rest.do

#9 HomeBrew

HomeBrew

    Veteran

  • Global Moderators
  • PipPipPipPipPipPipPipPipPipPip
  • 930 posts
16
Good

Posted 10 December 2009 - 05:49 AM

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

Thanks for jumping in, perlmunky...

#10 DELETEMYACCOUNTPLEASE

DELETEMYACCOUNTPLEASE

    Y U NOT DELETE MY ACCOUNT?

  • Active Members
  • PipPipPipPipPip
  • 58 posts
1
Neutral

Posted 10 December 2009 - 08:01 AM

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).




Home - About - Terms of Service - Privacy - Contact Us

©1999-2013 Protocol Online, All rights reserved.