Take a look at the following steps:
- 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
- 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, ...