[Biopython] fetch random id

Brad Chapman chapmanb at 50mail.com
Fri Nov 13 17:20:33 UTC 2009


Hi Yvan;

> I have to crash test a webservice so was wondering if any one knows a way to
> get random sequence id from swissprot or genbank?

ExPASy can give you a random SwissProt entry:

http://www.expasy.org/cgi-bin/get-random-entry.pl?S

See the ExPASy documentation for all of their URLs:

http://ca.expasy.org/expasy_urls.html

You can use this to get the UniProt ID from the redirect:

>>> import urllib2
>>> u = urllib2.urlopen("http://www.expasy.org/cgi-bin/get-random-entry.pl?S")
>>> u.geturl()
'http://www.uniprot.org/uniprot/Q824C8'

Hope this helps,
Brad



More information about the Biopython mailing list