Let's take a look at the following steps:
- 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')
- 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 ...