# Loading all PPI information from Uniprot into a graph in NetworkX

I am looking for guidance to load all SwissProt PPI data for Homo sapiens into a graph (from NetworkX). In particular, the part that I'm struggling with is gathering the data from SwissProt for each human protein.

The data that I'm looking to extract is protein-protein interaction. This is not included in the files found here, which @rtviii (answer below) suggested to use. Rather, when say you click on an entry in SwissProt, for each entry, there is a section devoted to "Interaction" as shown in the image attached below. I would like to extract that information for each human protein, and load it into a graph data structure using NetworkX

EDIT 2:

How I ended up doing it:


query = "reviewed:yes+AND+organism:9606"
args = {'query': query, 'format': 'xls', 'columns':'id,entry name,interactor'}

uniprot_url = "https://www.uniprot.org/uniprot/?{}".format(urllib.parse.urlencode(args))

with open(<DESIRED FILE PATH>, "wb") as target:
target.write(requests.get(url).content)


• What are you trying to do exactly? Are you starting with a list of proteins and want to find their interactions? If so, why not go straight to Mint or Intact (but be careful with Intact, there's a lot of dirty data in there)? Why would you start from uniprot? If you want to build a high quality human PPI network, this really isn't the simplest or best approach. You might want to ask a new question, taking a step back to basics. Apr 13 '20 at 16:21

The query link for all interactors would be thus : https://www.uniprot.org/uniprot/?query=organism%3A9606+AND+interactor%3A*&sort=score

There is always an option of downloading the static version of the service if you find it incovnient to deal with their API for your use case from here and have it all to yourself, pipe data into your dataframes locally. I find it useful to just broswe their repositories sometimes instead of reading the specifications.

In general, you can get a variety of datashapes from uniprot that you cannot get from their static database-image by specifying the appropriate parameters in the request. You can browse and explore parameters by expanding their GUI's search fields as described in this little guide. Then you can request your data like so, in python for example.

import requests
URL = "https://www.uniprot.org/uniprot/"
PARAMS = {'organism': 9606, 'format': 'tab', ....#Additional parameters#...}
response = requests.get(url=URL, params=PARAMS)

• Thanks for the reply. So I was already able to download the database data, I'll explain in more detail what it is exactly that I need in the post. Apr 12 '20 at 1:12
• @AnIgnorantWanderer Added query for interactors. Tag on &format=tab to make your life easier once you get to python. Apr 12 '20 at 1:33