How to do it...

Take a look at the following steps:

  1. First, let's define a function to perform REST queries on UniProt, as follows:
import requestsserver = 'http://www.uniprot.org/uniprot'def do_request(server, ID='', **kwargs):    params = ''    req = requests.get('%s/%s%s' % (server, ID, params), params=kwargs)    if not req.ok:        req.raise_for_status()    return req
  1. We can now query all p53 genes that have been reviewed:
req = do_request(server, query='gene:p53 AND reviewed:yes', format='tab', columns='id,entry name,length,organism,organism-id,database(PDB),database(HGNC)', limit='50')

We will query the p53 gene and request all entries that are reviewed (manually curated). The output will be in a tabular format. We will request a maximum of 50 results, ...

Get Bioinformatics with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.