Protein Interaction Network Visualization
Abstract
This report presents the analysis and visualization of protein interaction networks using
computational tools. The project involves processing protein network datasets, constructing
graph representations, and creating visual interpretations of biological interactions. Using
Python libraries including NetworkX and Matplotlib, we developed a workflow for
transforming raw protein interaction data into meaningful network visualizations.
1. Introduction
Protein interaction networks (PINs) are fundamental structures in molecular biology that
represent relationships between proteins within cellular systems. These networks provide
insights into cellular processes, disease mechanisms, and functional protein modules.
The primary objectives of this project are to develop a systematic approach for processing
protein interaction datasets, implement graph-based representations of protein networks,
and create clear visualizations of protein interactions.
The project employs a graph-based approach where nodes represent individual proteins and
edges represent interactions between them.
2. Dataset Description
The protein interaction dataset was obtained from Christopher Morris's graph kernel datasets
repository:
● Source: [Link]
● Direct Download: [Link]
● Dataset Name: PROTEINS
The PROTEINS dataset contains multiple protein interaction networks with the following file
structure:
PROTEINS/
PROTEINS_A.txt → adjacency (edges)
PROTEINS_graph_indicator.txt → maps nodes → graph IDs
PROTEINS_node_labels.txt → node categorical features
PROTEINS_node_attributes.txt → node numerical features
PROTEINS_graph_labels.txt → graph classification labels
We need a conversion script to convert this data into .csv files
[Link] Script
# convert_proteins.py
import os
import pandas as pd
DATA_DIR = "PROTEINS"
def read_pair_file(path, names):
return pd.read_csv(path, sep=r'[,\s]+', engine='python',
header=None, names=names)
# edges
edges_path = [Link](DATA_DIR, "PROTEINS_A.txt")
edges = read_pair_file(edges_path, names=["src", "dst"])
# graph indicator
gi = pd.read_csv([Link](DATA_DIR,
"PROTEINS_graph_indicator.txt"),
header=None, names=["graph_id"])
# graph labels
graph_labels = pd.read_csv([Link](DATA_DIR,
"PROTEINS_graph_labels.txt"), header=None, names=["graph_label"])
# node labels
node_labels_path = [Link](DATA_DIR, "PROTEINS_node_labels.txt")
if [Link](node_labels_path):
node_labels = pd.read_csv(node_labels_path, header=None,
names=["node_label"])
else:
node_labels = [Link]({"node_label": []})
# node attributes
node_attr_path = [Link](DATA_DIR, "PROTEINS_node_attributes.txt")
if [Link](node_attr_path) and [Link](node_attr_path) >
0:
node_attrs = pd.read_csv(node_attr_path, header=None,
sep=r'[,\s]+', engine='python')
node_attrs.columns = [f"feat_{i}" for i in
range(node_attrs.shape[1])]
else:
node_attrs = [Link]()
# Build nodes df
num_nodes = len(gi)
nodes = [Link]({
"id": range(1, num_nodes + 1),
"graph_id": gi["graph_id"].astype(int)
})
if len(node_labels) == num_nodes:
nodes["node_label"] = node_labels["node_label"]
else:
nodes["node_label"] = [Link]
if not node_attrs.empty:
nodes = [Link]([nodes, node_attrs.reset_index(drop=True)],
axis=1)
graph_id_to_label = {i+1: int(graph_labels.iloc[i,0]) for i in
range(len(graph_labels))}
nodes["graph_label"] = nodes["graph_id"].map(graph_id_to_label)
edges.to_csv("[Link]", index=False)
nodes.to_csv("[Link]", index=False)
print("Saved [Link] and [Link]")
print("Nodes:", [Link], "Edges:", [Link])
Run :
python convert_proteins.py
After this you will have [Link] and [Link] in the project root.
[Link] # Node information and attributes
[Link] # Edge connections
The [Link] file contains protein identifiers and associates each node with a specific
graph ID. The [Link] file defines pairwise protein interactions and references nodes by
their identifiers.
3. Implementation Workflow
Set up python environment
Create [Link]
pandas
networkx
matplotlib
jupyterlab
scikit-learn
seaborn
Run : pip install -r [Link]
All the requirements are installed and python scripts are ready to run!
Data Processing
The implementation was done using Python in a Jupyter Notebook environment with the
following libraries:
● NetworkX for graph construction and analysis
● Matplotlib for visualization
● Pandas for data manipulation
The workflow consists of these main steps:
1. Dataset Acquisition: Downloaded [Link] file and extract [Link] and
[Link] files
2. Data Loading: Imported CSV files using Pandas and validated data integrity
3. Network Selection: Filtered individual protein networks using graph IDs
4. Graph Construction: Built NetworkX graphs from selected nodes and edges
5. Visualization: Applied layout algorithms and styling for clear representations
6. Output Generation: Saved high-resolution visualizations to plots folder
Graph Construction
Individual protein networks are constructed by:
● Filtering nodes and edges by specific graph IDs
● Creating NetworkX graph objects
● Adding node attributes like protein identifiers and labels
● Establishing edge connections between interacting proteins.
Create [Link] in the project root
import pandas as pd
import networkx as nx
import [Link] as plt
# Load nodes and edges
nodes = pd.read_csv("[Link]")
edges = pd.read_csv("[Link]")
graph_id = 83 # choose which protein to plot
# Subset nodes and edges
nodes_sub = nodes[nodes["graph_id"] == graph_id]
edges_sub = edges[edges["graph_id"] == graph_id]
# Create graph
G = [Link]()
G.add_nodes_from(nodes_sub["node_id"].tolist())
G.add_edges_from(edges_sub[["source", "target"]].[Link]())
# Add node attributes (optional, e.g. label)
for _, row in nodes_sub.iterrows():
[Link][row["node_id"]]["label"] = [Link]("node_label", None)
[Link](figsize=(6,6))
pos = nx.spring_layout(G, seed=42) # layout algorithm
labels = nx.get_node_attributes(G, "label")
[Link](
G, pos,
with_labels=True,
labels=labels, # show node labels if available
node_size=300,
node_color="skyblue",
edge_color="gray"
[Link](f"Protein Graph {graph_id}")
4. Visualization Methodology
Output Management
All visualizations are systematically stored in a plots directory with descriptive filenames and
high-resolution formats suitable for publication and analysis.
[Link](f"plots/graph_{graph_id}.png", dpi=300,
bbox_inches="tight")
[Link]()
5. Results
Network Visualizations
when graph_id = 83 (for example)
when graph_id = 19 (for example)
when graph_id = 59 (for example)
Additional visualization:
nodes_per_graph = [Link]("graph_id").size()
[Link](nodes_per_graph, bins=50)
[Link]("Nodes per graph")
[Link]("Frequency")
[Link]("Distribution of nodes per graph")
[Link]("plots/nodes_per_graph_distribution.png", dpi=300)
[Link]()
7. Applications and Future Work
The visualized protein networks provide insights for:
● Identifying essential proteins through network centrality
● Discovering functional modules through clustering
● Analyzing disease-related protein pathways
● Prioritizing drug targets based on network properties
Future enhancements could include:
● Interactive web-based visualizations
● Integration with protein structure data
● Dynamic network analysis over time
● Machine learning-based protein function prediction
8. Conclusion
This project successfully demonstrated a comprehensive approach to protein interaction
network visualization. The systematic workflow from data acquisition to final visualization
provides a robust framework for biological network analysis.
Key achievements include establishing a complete processing pipeline, generating
high-quality visualizations, and creating interpretable representations of complex protein
interactions. The methodology has broad applications in systems biology research, drug
discovery, and disease mechanism studies.
The integration of graph theory and computational biology provides powerful tools for
understanding biological systems and establishes a foundation for advanced protein network
analysis.
References
1. Morris, C. et al. "Graph Kernel Datasets."
[Link]
2. Hagberg, A., Schult, D., & Swart, P. "NetworkX: Python Software for Network
Analysis." [Link]
3. Hunter, J. D. "Matplotlib: A 2D Graphics Environment." Computing in Science &
Engineering, 2007.