Network pharmacology pipeline for drug discovery and target prediction. Integrates Reactome pathway analysis, STRING protein-protein interaction networks, and multi-omics enrichment (GO/KEGG/Reactome). User-friendly Python framework for computational biologists with guided workflows and publication-ready outputs.
- Overview
- Features
- Installation
- Quick Start
- Usage
- Pipeline Steps
- Output Structure
- Examples
- Documentation
- Citation
- Credits & References
- Contributing
- License
- Contact
netpharmpy is a comprehensive Python toolkit for network pharmacology analysis, designed to facilitate drug discovery and target prediction research. It automates the workflow described in recent network pharmacology studies, providing a reproducible and user-friendly pipeline for:
- Target Prediction: Identifying potential protein targets for small molecules
- Pathway Analysis: Mapping targets to biological pathways
- Network Construction: Building protein-protein interaction networks
- Functional Enrichment: Discovering biological significance
Key Applications:
- Drug repurposing studies
- Natural product pharmacology
- Mechanism of action elucidation
- Multi-target drug discovery
- Systems pharmacology research
Inspired by: Limsakul et al. (2025) - Immunomodulatory Effects of Curcumin on CAR T-Cell Therapy
Pharmacological effects often emerge from interactions across complex biological networks rather than from modulation of single molecular targets. While numerous databases and tools exist for drugโtarget and proteinโprotein interaction analysis, many available solutions are tightly coupled to specific data sources, impose rigid analytical pipelines, or obscure intermediate computational steps.
netpharmpy was developed to address these limitations by offering a minimal and extensible software layer that allows researchers to:
- Represent pharmacological data explicitly as networks,
- Apply graph-based analyses using familiar Python workflows, and
- Integrate custom data sources and downstream analyses without vendor or database lock-in.
The software prioritizes methodological clarity over automation and is intentionally agnostic to specific biological interpretations or predictive claims.
At its core, netpharmpy provides utilities for:
- Constructing network representations of drugโtarget interactions and related biological relationships
- Manipulating and querying these networks using graph-based abstractions
- Performing basic network analyses suitable for exploratory systems pharmacology research
The package is designed to interoperate seamlessly with the broader scientific Python ecosystem, allowing users to extend analyses using external libraries for statistics, visualization, or downstream biological interpretation.
netpharmpy is suitable for a range of research-oriented applications, including:
- Exploratory analysis of drugโtarget interaction networks
- Investigation of polypharmacology and multi-target drug effects
- Integration of pharmacological data with proteinโprotein interaction networks
- Identification of subnetworks or pathways potentially perturbed by drug intervention
- Rapid prototyping of network pharmacology workflows prior to large-scale or production-level analyses
The software is intended for use by computational biologists, bioinformaticians, and systems pharmacology researchers with basic familiarity in Python programming.
- โ Automated Pipeline: Five-step workflow from compound to network visualization
- โ Multi-Database Integration: SwissTargetPrediction, SuperPred, Reactome, STRING, g:Profiler
- โ Reproducible Research: Configuration files and detailed logging
- โ Publication-Ready Outputs: High-quality network visualizations (PNG, HTML)
- โ User-Friendly: Interactive prompts and clear instructions
- โ Flexible: Command-line and Python API access
- โ Well-Documented: Comprehensive examples and tutorials
- Python 3.8 or higher
- Internet connection (for API access)
pip install netpharmpy
# Clone the repository
git clone https://github.com/axp-knickei/netpharmpy.git
cd netpharmpy
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install in editable mode
pip install -e .
git clone https://github.com/axp-knickei/netpharmpy.git
cd netpharmpy
# Create and activate environment
uv venv
source .venv/bin/activate
# Install dependencies
uv pip install -r requirements.txt
# Install package
uv pip install -e .
from netpharm import NetworkPharmacology
# Initialize with curcumin (PubChem CID: 969516)
npharma = NetworkPharmacology(cid=969516)
# Run complete analysis
npharma.run_full_pipeline()
# Interactive mode
python main.py
# With configuration file
python main.py --config examples/config_example.yaml
The simplest way to use netpharmpy - the tool will guide you through each step:
python main.py
You'll be prompted for:
- Compound input (CID or SMILES)
- Target prediction thresholds
- Pathway keywords or IDs
- Network parameters
- Enrichment method
For reproducible research, use a YAML configuration file:
# config.yaml
compound:
cid: 969516 # Curcumin
target_prediction:
swiss_threshold: 0.0
superpred_threshold: 0.5
pathways:
search_terms:
- "R-HSA-1280218" # Adaptive Immune System
- "R-HSA-1280215" # Cytokine Signaling
string:
confidence: 0.700
enrichment:
method: "gprofiler" # or "david"
output:
directory: "./results"
Run with:
python main.py --config config.yaml
For integration into your own scripts:
from netpharm import NetworkPharmacology
# Initialize
npharma = NetworkPharmacology(
cid=969516,
output_base='./my_analysis'
)
# Step-by-step execution
npharma.get_compound_info()
npharma.predict_targets(swiss_threshold=0.0, superpred_threshold=0.5)
npharma.analyze_pathways(['R-HSA-1280218', 'R-HSA-1280215'])
npharma.build_network(confidence=0.700)
npharma.enrichment_analysis(method='gprofiler')
The pipeline is organized as a sequence of steps, but each step serves a different purpose.
| Step | Purpose | Question Answered |
|---|---|---|
| 1-2. Target Prediction | Data Retrieval | What are the potential targets? |
| 3. Pathway Analysis | Biological Filtering | Which targets are relevant to my specific system? |
| 4. Network Analysis | Systems Context | How do these proteins interact? |
| 5. Enrichment | Statistical Interpretation | What functions are statistically over-represented? |
Key Distinctions:
- Step 3 is not a statistical test โ it is a biologically informed filter to reduce noise.
- Step 4 does not identify drug targets โ it reveals the connectivity and structure of the system.
- Step 5 provides statistical support โ it tests for over-representation of functional themes.
Retrieves molecular properties from PubChem:
- Canonical SMILES
- Molecular formula and weight
- IUPAC name
Database: PubChem
Predicts potential protein targets using:
- SwissTargetPrediction: Similarity-based predictions
- SuperPred: Known strong binders + predicted targets
Manual workflow with clear instructions for downloading results.
Uses curated biological pathways to filter predicted targets to those relevant to the biological system of interest:
- Searches user-defined Reactome pathways
- Extracts all proteins involved in those pathways
- Retains only predicted targets that overlap with pathway proteins
Database: Reactome (used as a source of curated biological pathway knowledge)
Builds protein-protein interaction networks:
- Queries STRING database
- Analyzes network topology
- Identifies hub proteins
- Creates three visualization types:
- Basic (publication-ready PNG)
- Colored (degree-based)
- Interactive (HTML)
Database: STRING
Performs statistical enrichment analysis on biologically filtered targets:
- Gene Ontology (Biological Process, Molecular Function, Cellular Component)
- KEGG pathway annotations
- Reactome pathway annotations
Tools: g:Profiler or DAVID (used for over-representation analysis)
The pipeline intentionally separates biological filtering (Step 3), network context (Step 4), and statistical interpretation (Step 5). Step 3 determines biological relevance using curated pathway knowledge, while Step 5 statistically describes functional patterns within that biologically constrained gene set. This separation avoids conflating mechanistic reasoning with statistical enrichment.
outputs/
โโโ compound_969516_20251213_123456/
โโโ step1_compound_info/
โ โโโ compound_info.csv
โโโ step2_targets/
โ โโโ swiss_targets.csv
โ โโโ superpred_targets.csv
โโโ step3_pathways/
โ โโโ pathways_searched.csv
โ โโโ pathway_proteins.csv
โ โโโ overlapping_targets.csv
โโโ step4_network/
โ โโโ string_interactions.csv
โ โโโ network_metrics.csv
โ โโโ network_basic.png
โ โโโ network_colored.png
โ โโโ network_interactive.html
โโโ step5_enrichment/
โ โโโ gprofiler_all_results.csv
โ โโโ gprofiler_go_bp.csv
โ โโโ gprofiler_kegg.csv
โ โโโ gprofiler_reac.csv
โโโ 969516_20251213_123456.log
python examples/curcumin_example.py
This example replicates the analysis from:
Limsakul, P., et al. (2025). Immunomodulatory Effects of Curcumin on CAR T-Cell Therapy. Antioxidants, 14(4), 454.
from netpharm import NetworkPharmacology
# Example: Resveratrol (CID: 445154)
npharma = NetworkPharmacology(cid=445154)
npharma.run_full_pipeline()
Feature planned for future release.
analysis.py is a post-pipeline analysis script designed to interpret, summarize, and extend the results generated by the main network pharmacology pipeline (main.py).
Importantly:
analysis.pydoes not run the pipeline- It does not modify any results
- It only consumes outputs generated in the
outputs/directory
This strict separation ensures that data generation, visualization, and interpretation are not conflated, which is critical for reproducible and defensible scientific analysis.
The pipeline is intentionally divided into conceptual layers:
| Layer | Purpose | Scripts |
|---|---|---|
| Data generation | Retrieve, filter, and construct biological networks | main.py, core.py, network.py |
| Visualization | Render network structure for inspection and figures | visualize.py |
| Interpretation | Quantitative reasoning and result summarization | analysis.py |
This design avoids common pitfalls such as:
- Mixing statistical interpretation with network construction
- Hard-coding analytical assumptions into the pipeline
- Making figures depend on undocumented logic
analysis.py operates on pipeline outputs such as:
step4_network/network_metrics.csvstep4_network/string_interactions.csvstep3_pathways/overlapping_targets.csv- (optionally) enrichment results from Step 5
Typical analyses performed in analysis.py include:
- Identifying and ranking hub proteins
- Comparing centrality measures (degree, betweenness, closeness)
- Inspecting connector nodes and local subnetworks
- Supporting figure selection (e.g., top-N hubs)
- Preparing tables or statistics for manuscripts
All analytical decisions are explicit and script-level, making them easy to review, revise, or justify.
After running the pipeline with:
uv run python main.py --config config.yamlRun post-analysis with:
uv run python analysis.py --output_dir ./outputs/compound_XXXXanalysis.py will read existing CSV files and produce summaries, reports, and publication-quality figures without re-running the pipeline.
The analysis.py script generates two specialized bipartite networks connecting Hub Proteins (circles) to Reactome Pathways (squares). These figures use the Nature Publishing Group (NPG) color scheme and provide different topological perspectives:
- Node Size โ Betweenness Centrality: Larger protein nodes represent strategic bottlenecks in the global interaction network.
- Scientific Significance: These proteins act as critical bridges that control the flow of biological information. Targeting these "bottlenecks" often leads to the most significant disruption of the disease-related network.
- Node Size โ Global Degree: Larger protein nodes represent major cellular hubs with the highest total number of interactions in the full STRING database.
- Scientific Significance: These are the "promiscuous" proteins of the cell. While they are central to biology, high-degree hubs can sometimes be associated with a higher risk of off-target effects if inhibited.
- Coloring: Dark Blue nodes are multi-pathway hubs (pleiotropic), while Light Blue nodes connect to a single pathway in the current view.
- Edges: Smooth S-curves connect proteins to their respective pathways. Thicker lines highlight connections from multi-pathway proteins, emphasizing their functional versatility.
Because analysis.py only consumes saved outputs:
- Results can be re-analyzed without re-querying external databases
- Analytical choices can be changed without affecting raw data
- Multiple analysis strategies can be tested on the same results
This makes the workflow suitable for iterative scientific reasoning, peer review, and long-term maintenance.
- Installation Guide: See Installation
- Tutorial: See examples/curcumin_example.py
- API Reference: Coming soon
- Repository: https://github.com/axp-knickei/netpharmpy
- Troubleshooting: Check Issues
If you use netpharmpy in your research, please cite:
@software{netpharmpy2025,
author = {Alex Prima},
title = {netpharmpy: Network Pharmacology Pipeline for Drug Discovery},
year = {2025},
url = {https://github.com/axp-knickei/netpharmpy},
version = {0.1.0},
doi={doi.org/10.5281/zenodo.18074031}
}
This tool implements the methodology described in:
@article{limsakul2025immunomodulatory,
title={Immunomodulatory Effects of Curcumin on CAR T-Cell Therapy},
author={Limsakul, Praopim and Srifa, Pemikar and Huang, Ziliang and Zhu, Linshan and Wu, Yiqian and Charupanit, Krit},
journal={Antioxidants},
volume={14},
number={4},
pages={454},
year={2025},
publisher={MDPI},
doi={10.3390/antiox14040454}
}
netpharmpy integrates the following resources:
- PubChem - Kim, S., et al. (2023). PubChem 2023 update. Nucleic Acids Research, 51(D1), D1373-D1380. https://pubchem.ncbi.nlm.nih.gov/
-
SwissTargetPrediction - Daina, A., Michielin, O., & Zoete, V. (2019). SwissTargetPrediction: updated data and new features. Nucleic Acids Research, 47(W1), W357-W364. http://www.swisstargetprediction.ch/
-
SuperPred - Nickel, J., et al. (2014). SuperPred: update on drug classification and target prediction. Nucleic Acids Research, 42(W1), W26-W31. https://prediction.charite.de/
- Reactome - Milacic, M., et al. (2024). The Reactome Pathway Knowledgebase 2024. Nucleic Acids Research, 52(D1), D672-D678. https://reactome.org/
- STRING - Szklarczyk, D., et al. (2023). The STRING database in 2023: protein-protein association networks. Nucleic Acids Research, 51(D1), D638-D646. https://string-db.org/
-
g:Profiler - Kolberg, L., et al. (2023). g:Profilerโinteroperable web service for functional enrichment analysis. Nucleic Acids Research, 51(W1), W207-W212. https://biit.cs.ut.ee/gprofiler/
-
DAVID - Sherman, B.T., et al. (2022). DAVID: a web server for functional enrichment analysis. Nucleic Acids Research, 50(W1), W216-W221. https://david.ncifcrf.gov/
- PubChemPy - https://github.com/mcs07/PubChemPy
- NetworkX - Hagberg, A.A., et al. (2008). NetworkX [Software]. https://networkx.org/
- pandas - McKinney, W. (2010). Data Structures for Statistical Computing in Python. https://pandas.pydata.org/
- matplotlib - Hunter, J.D. (2007). Matplotlib: A 2D graphics environment. https://matplotlib.org/
- PyVis - https://github.com/WestHealth/pyvis
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git clone https://github.com/axp-knickei/netpharmpy.git
cd netpharmpy
pip install -e ".[dev]"
pytest tests/
- Follow PEP 8 style guidelines
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
- Author: Alex Prima
- Email: alex.prima@uq.net.au
- GitHub: @axp-knickei
- Issues: https://github.com/axp-knickei/netpharmpy/issues
- Inspired by the methodology of Limsakul et al. (2025)
- Thanks to all the database and tool maintainers cited above
- Built with support from the bioinformatics community
Release Date: February 2026
- โ Target prediction (SwissTargetPrediction + SuperPred)
- โ Pathway analysis (Reactome)
- โ Network construction (STRING)
- โ Enrichment analysis (g:Profiler + DAVID)
- โ Multiple visualization formats
- โ Configuration file support
- โ Logging system
- โ Basic unit tests
- Backup pathway data for offline analysis
- Enhanced error recovery
- Additional visualization options
- Docker container support
netpharmpy is currently released as early-stage research software. Known limitations include:
- APIs may evolve as the project matures
- Reactome API may occasionally be unavailable (temporary server issues)
- Manual downloads required for SwissTargetPrediction and SuperPred
- Documentation and tutorials are intentionally minimal but under active development
- Performance has not yet been optimized for very large-scale networks
- Large networks (>100 proteins) may take longer to visualize
- The package does not provide built-in visualization or clinical interpretation modules
Biological interpretation of results remains the responsibility of the user, and netpharmpy does not aim to provide clinical or predictive decision support.
Report bugs or request features: GitHub Issues
Last updated: January 31, 2026


