Dear all
Is there a 'universal' way to programmatically (via biopython) access protein data/features without going to each of the different DBs (uniprot, swissprot, prosite, and pfam)? via ExPAsy? or InterPro?
urllib.urlretrieve('http://www.uniprot.org/uniprot/A2Z669.txt',filename='xxx.txt')
has worked once or twice before but no longer does now. I can open the file on my browser though.
I tried uniprot's template for python programmatic access, for a ROSALIND's exercise (http://rosalind.info/problems/mprt/) but it doesn't work - IDLE gets frozen.
code used, from uniprot:
import urllib,urllib2
url = 'http://www.uniprot.org/mapping/'`
params = {
'from':'ACC',
'to':'P_REFSEQ_AC',
'format':'tab',
'query':'A2Z669 B5ZC00 P07204_TRBM_HUMAN P20840_SAG1_YEAST'
}
data = urllib.urlencode(params)
request = urllib2.Request(url, data)
contact = "my.email.address"
request.add_header('User-Agent', 'Python contact')
response = urllib2.urlopen(request)
page = response.read(200000)`
Thanks
make sure to understand that the urlretrieve will only work if the URL exists and can be accessed say from a browser. It does not do anything more and it has no bioinformatics awareness.
For the second example you should edit your answer and include more of the code. It is impossible to troubleshoot as posted - we don't know all the ROSALIND examples by heart.
Thanks for the code. I have the following 'HTTPError: HTTP Error 405: Not Allowed' with urlopen. Hope you can help me with this?