This notebook shows how to load the Negatome database (http://mips.helmholtz-muenchen.de/proj/ppi/negatome/), which contains information on experimentally supported non-interacting protein pairs.
# Show all the plots inside the notebook
%matplotlib inline
# load packages
import pypath
import igraph # import igraph to use the plot function
import numpy as np
import pandas as pd
import seaborn as sns
pa = pypath.main.PyPath()
pa.init_network()
print('Number of nodes: {}'.format(pa.graph.vcount()))
print('Number of edges: {}'.format(pa.graph.ecount()))
We can load the Negatome resource as follows:
pa.load_resources(lst=pypath.data_formats.negative)
print('Number of nodes: {}'.format(pa.graph.vcount()))
print('Number of edges: {}'.format(pa.graph.ecount()))
Note that the number of nodes and edges has increased after loading the Negatome database. Now the edges in the graph consist of both, interactions supported by the literature and non-existent interactions according to Negatome.
We can get a list of the edges that are part of the Negatome as follows:
negatome_edge_list = pa.graph.es.select(lambda edge: 'Negatome' in edge['sources'])
If we explore the first edge in the list, we can see that, as could be expected, many of its attributes are empty.
i_negatome_edge_source = pa.graph.vs[negatome_edge_list[0].source]['label']
i_negatome_edge_target = pa.graph.vs[negatome_edge_list[0].target]['label']
print('Negatome edge:')
print('\t{} == {}'.format(i_negatome_edge_source, i_negatome_edge_target))
print('\tmethod: {}'.format(*negatome_edge_list[0]['negatome_methods']))
negatome_edge_list[0].attributes()
However, we may wonder if there are edges with contradictory evidence, i.e. with support in the literature and also listed in Negatome.
n_sources = np.array([len(i) for i in negatome_edge_list['sources']])
print('Number of edges with contradictory evidence: {}'.format(np.sum(n_sources>1)))
hist_data = sns.plt.hist(n_sources, 100)
sns.plt.xlabel('Number of sources')
sns.plt.ylabel('Number of edges')
contradictory_edges = negatome_edge_list.select(lambda edge: len(edge['sources'])>1)
We can have a look at one of these contradictory edges:
i_contradictory_edge = contradictory_edges[0]
i_source_label = pa.graph.vs[i_contradictory_edge.source]['label']
i_target_label = pa.graph.vs[i_contradictory_edge.target]['label']
print(' == '.join([i_source_label, i_target_label]))
print('Sources: ' + ', '.join(i_contradictory_edge['sources']))
We can see what are the references supporting this interaction in SPIKE.
i_contradictory_edge['refs_by_source']['SPIKE']
contradictory_ref = i_contradictory_edge['refs_by_source']['SPIKE'][0]
contradictory_ref_info = contradictory_ref.info()[contradictory_ref.pmid]
# contradictory_ref.open() # opens reference in pubmed
def citation_from_ref(ref_dict):
author_str = ', '.join([i['name'] for i in ref_dict['authors']])
title_str = ref_dict['title']
year_str = ref_dict['sortpubdate'][0:4]
journal_str = ref_dict['fulljournalname']
citation_str = author_str + ' ({}) '.format(year_str) + title_str + ' ' + journal_str
return citation_str
print(citation_from_ref(contradictory_ref_info))
We can review the reference and decide if the interaction can actually take place according to the literature.