How to do it...

Let's take a look at the following steps:

  1. First, let's access the PSICQUIC service (its version of the UniProt database) via its REST interface, as shown in the following code:
import requestsdef get_psiquic_uniprot(query, **kwargs):    kwargs['format'] = kwargs.get('format', 'tab27')    server = 'http://www.ebi.ac.uk/Tools/webservices/psicquic/uniprot/webservices/current/search/query'    req = requests.get('%s/%s' % (server, query), params=kwargs)    return req.content.decode('utf-8')
  1. Then, get all the genes referred to (along with their respective species) and the interactions:
from collections import defaultdictgenes_species = defaultdict(set)interactions = {}def get_gene_name(my_id, alt_names):    toks = alt_names.split('|') for ...

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.