Skip to main content

RAG pipeline for gene-disease literature summarization

Project description

RAG-Powered Gene Discovery Assistant (ragbio)

A reusable retrieval-augmented generation (RAG) toolkit for biomedical knowledge discovery built on PubMed literature, vector search, and Ollama-based LLMs (DeepSeek / LLaMA3).

ragbio enables study-aware ingestion, embedding, and querying of biomedical literature to support gene–disease–therapy exploration, summarization, and network visualization.

Now published as a pip-installable Python package and designed for integration into research pipelines and bioinformatics workflows.


Overview

The RAG-powered assistant enables:

  • Semantic search over PubMed abstracts
  • Study-scoped literature ingestion for reproducibility
  • Summarization of complex biomedical evidence using LLMs
  • Citation-aware responses grounded in PubMed IDs
  • Modular ingestion → embedding → retrieval pipeline
  • Optional gene–disease–drug network visualization

Example questions

  • Which genes are linked to oxidative stress in Alzheimer’s disease?
  • What therapies target amyloid pathways according to recent literature?
  • Summarize evidence connecting TP53 variants to cancer therapies.

Architecture

User Question
│
▼
FAISS Vector Retrieval (PubMed Abstracts)
│
▼
Top-K Relevant Abstracts
│
▼
Ollama LLM (DeepSeek / LLaMA3)
│
▼
Grounded Biomedical Summary + PMIDs
│
▼
(Optional) Gene–Disease–Drug Network Visualization

Installation

Install from PyPI (recommended)

pip install ragbio

Development install (from source)

git clone https://github.com/<your-username>/rag-gene-discovery-assistant.git
cd rag-gene-discovery-assistant
pip install -e .

Usage

1. Ingest PubMed Literature (study-aware)

python -m ragbio.utils.rag_data_loader \
  --study Alzheimer_CaseStudy \
  --search "Alzheimer Disease AND therapy" \
  --retmax 500 \
  --retstart 0

This creates the following structure (default: data/PubMed/):

PubMed/
├── Abstracts/Alzheimer_CaseStudy/
├── Metadata/Alzheimer_CaseStudy/
├── PDFs/Alzheimer_CaseStudy/
└── Index/Alzheimer_CaseStudy/

2. Generate Embeddings & Build FAISS Index

python -m ragbio.embeddings.embedding_engine \
  --study Alzheimer_CaseStudy
  • Reads from Abstracts/<study>/
  • Writes FAISS index to Index/<study>/

3. Run RAG Queries

python -m ragbio.pipeline.rag_pipeline \
  --query "Which therapies target amyloid pathways in Alzheimer’s disease?" \
  --top_k 10 \
  --structured \
  --study Alzheimer_CaseStudy

Outputs are generated per study for clean provenance and reproducibility.


4. Visualize Gene–Disease–Drug Networks (optional)

Launch the Streamlit app:

streamlit run ragbio/pipeline/rag_cytoscape_streamlit.py --study Alzheimer_CaseStudy

This reads structured outputs and visualizes gene–disease–drug relationships as an interactive network.

RAG Network Graph

Example: Gene–disease–drug co-occurrence network derived from PubMed abstracts.


5. Optional: Notebook Exploration

Explore example workflows in:

notebooks/RAG_GeneDiscovery_Assistant.ipynb

Technologies Used

Category Tools
Embeddings Ollama embedding models (configurable)
LLMs DeepSeek, LLaMA3 (via Ollama)
Retrieval FAISS
Data Sources PubMed (NCBI Entrez)
Visualization Streamlit, Cytoscape
Language Python 3.10+

Design Principles

  • Study-first organization for reproducibility
  • Separation of concerns (ingestion ≠ embedding ≠ retrieval)
  • Grounded answers with PubMed citations
  • Composable modules usable outside the CLI
  • Safe defaults with override via CLI or environment variables

Future Enhancements

  • Neo4j-backed gene–disease–drug knowledge graphs
  • Comparative evaluation of DeepSeek vs BioGPT outputs
  • Variant-level evidence integration
  • API support for FastAPI / Django
  • Automated citation grounding and confidence scoring
  • Multi-study dashboards and comparisons

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragbio-0.1.16.tar.gz (317.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragbio-0.1.16-py3-none-any.whl (314.0 kB view details)

Uploaded Python 3

File details

Details for the file ragbio-0.1.16.tar.gz.

File metadata

  • Download URL: ragbio-0.1.16.tar.gz
  • Upload date:
  • Size: 317.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for ragbio-0.1.16.tar.gz
Algorithm Hash digest
SHA256 a4d50061cce15193d8bfe2389dc77e12a116c7440191cb5b53e4f82de3fc5d5f
MD5 5faa91d6aefec1d9b1f82aea96ec56cd
BLAKE2b-256 26557d03382697209683443eb141bf3c21588ebe369c159e06905f55542f2760

See more details on using hashes here.

File details

Details for the file ragbio-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: ragbio-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 314.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for ragbio-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 a0468b66710fc7c7ef7d98e231b41dc5a78d6b469473a4221fc4484aa70a02cb
MD5 43a1f4a7386f3ea5e860b9a6fdba44d8
BLAKE2b-256 a73b51d94164ad35f46f891a280570a132a1b2ce41b92213a3379b69491f2f88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page