RAG-Powered Gene Discovery Assistant (ragbio)
ragbio is a study-aware, retrieval-augmented generation (RAG) toolkit for biomedical knowledge discovery built on PubMed literature, FAISS vector search, and Ollama-based large language models (DeepSeek, LLaMA-family).
It is designed as a reusable Python package that can operate standalone or as a backend service inside larger platforms such as OmniBioAI, powering chat, literature summarization, and downstream bioinformatics workflows.
Key Capabilities
ragbio enables:
- Semantic search over PubMed abstracts using FAISS
- Study-scoped ingestion and indexing for reproducibility
- Multi-study search (single study or global across all studies)
- Instant PMID retrieval (FAISS-only, no LLM calls)
- LLM-based biomedical summarization grounded in retrieved literature
- Structured JSON outputs for literature summarizers and reporting
- Optional drug–target–disease extraction and KG population
- Progress reporting hooks for real-time UI dashboards
- Cache-aware retrieval for low-latency interactive use
Example Questions
- Which genes are associated with oxidative stress in Alzheimer’s disease?
- What therapies target amyloid pathways according to recent literature?
- Summarize evidence linking TP53 variants to cancer therapies.
- Return PMIDs related to BRCA1 drug resistance (no summarization).
High-Level Architecture
User Query
│
├─► FAISS Retrieval (study-specific or multi-study)
│
├─► Top-K PubMed Abstracts
│
├─► (Optional) LLM Summarization (RAG)
│
├─► (Optional) Structured Extraction (JSON)
│
└─► Outputs:
• PMIDs (instant)
• Grounded summaries
• Structured JSON (literature summarizer / KG)
Important design choice (v1.1): FAISS retrieval is executed exactly once per request, and all downstream steps reuse the same retrieved documents. There is no duplicate search.
Installation
Install from PyPI (recommended)
pip install ragbio
Development install (from source)
git clone https://github.com/man4ish/omnibioai-rag.git
cd omnibioai-rag
pip install -e .
Data Organization (Study-Aware)
By default, all PubMed data is organized under:
data/PubMed/
├── Abstracts/<study>/
├── Metadata/<study>/
├── PDFs/<study>/
└── Index/<study>/
This enables:
- Clean separation of case studies
- Reproducible indexing
- Safe multi-study search
Usage Guide
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 step:
- Fetches PubMed abstracts and metadata
- Stores results under
Abstracts/<study>/ - Optionally downloads open-access PDFs
2️⃣ Generate Embeddings & Build FAISS Index
python -m ragbio.embeddings.embedding_engine \
--study Alzheimer_CaseStudy
- Reads abstracts from
Abstracts/<study>/ - Generates embeddings via Ollama
- Writes FAISS index to
Index/<study>/
3️⃣ Run RAG Queries (CLI)
python -m ragbio.pipeline.rag_pipeline \
--query "Which therapies target amyloid pathways in Alzheimer’s disease?" \
--top_k 10 \
--structured \
--study Alzheimer_CaseStudy
Outputs include:
- Grounded summary
- Supporting PMIDs
- Optional structured JSON
- Optional Neo4j KG updates
4️⃣ Instant PMID Retrieval (No LLM)
For low-latency applications (chat, TES, pipelines):
python -m ragbio.pipeline.rag_pipeline \
--query "TP53 apoptosis cancer therapy" \
--pmids-only \
--top_k 20
✔ FAISS-only ✔ Cache-aware ✔ Suitable for real-time UI
Python API (Recommended for Integration)
Public API (v1.1)
from ragbio.pipeline import (
RAGAssistant,
get_pmids,
run_rag_json,
)
Instant PMID Retrieval
pmids = get_pmids(
query="BRCA1 drug resistance",
top_k=20,
study=None, # search across ALL studies
)
Structured RAG Output (Literature Summarizer)
result = run_rag_json(
query="TP53 variants and chemotherapy response",
top_k=10,
study="Cancer_Study",
)
Returns structured JSON suitable for:
- Literature summarization
- ReportingService
- Downstream AI agents
Advanced Usage (Long-Lived Assistant)
assistant = RAGAssistant(study="Alzheimer_CaseStudy")
pmids = assistant.get_pmids("amyloid beta clearance")
data = assistant.run_rag_json(
"amyloid beta clearance therapies",
structured=True,
)
Multi-Study Search (v1.1)
study="default"→ search one studystudy=Noneor"*"→ search all indexed studies- Results are merged, ranked, and deduplicated
This allows:
- Cross-project reuse of indexed literature
- Global chat-style queries
- Meta-analysis across studies
Caching & Performance
-
PMID retrieval results are cached per:
- query
- study
- index version
- embedding model
-
Cache invalidates automatically if index changes
-
Designed for sub-second responses in chat workflows
Progress Reporting (UI-Ready)
All major steps emit progress events that can be wired to:
- OmniBioAI progress bars
- WebSocket updates
- TES run monitors
Example stages:
retrieval_startretrieval_completellm_summarizationstructured_extraction_complete
Technologies Used
| Category | Tools |
|---|---|
| Language | Python 3.10+ |
| Retrieval | FAISS |
| Embeddings | Ollama embedding models |
| LLMs | DeepSeek, LLaMA-family (via Ollama) |
| Data Source | PubMed (NCBI Entrez) |
| Graph (optional) | Neo4j |
| UI (optional) | Streamlit, Cytoscape |
Design Principles
- Study-first organization
- Explicit retrieval control
- No hidden FAISS calls
- Composable APIs
- Safe defaults, override when needed
- Platform-friendly (OmniBioAI, TES, agents)
Roadmap
v1.1 (current)
- Multi-study search
- Instant PMID retrieval
- Structured JSON output
- Cache-aware retrieval
- Public Python API
v1.2+
- Streaming RAG responses
- Retrieval metrics & dashboards
- Neo4j-first knowledge graphs
- FastAPI / Django service mode
- Citation confidence scoring
- Multi-study comparative dashboards
License
MIT License
Metadata
Release files for ragbio 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ragbio-2.0.3.tar.gz | 194.5 kB | Without provenance | Details for ragbio-2.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ragbio-2.0.3-py3-none-any.whl | Python 3 | none | any | Details for ragbio-2.0.3-py3-none-any.whl |
Total release size: 358.9 kB
Release files / ragbio-2.0.3.tar.gz
| Download URL | ragbio-2.0.3.tar.gz |
|---|---|
| Size | 194.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27a37205d831482b4570543cef4b12dbe85be696e5222cfb8637272b75aa423b
|
|
BLAKE2b-256 checksum How to use checksums |
9b2b58d3173cf1c58170c3aaa91d6d322fdc3e04b24636eb31554f91539ac7db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / ragbio-2.0.3-py3-none-any.whl
| Download URL | ragbio-2.0.3-py3-none-any.whl |
|---|---|
| Size | 164.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0662453216c4f6c6d60b9d260e1e8ab13040c2aeb59e8b5e136634b13ebe9749
|
|
BLAKE2b-256 checksum How to use checksums |
85f16048c5f23898bff6a2e38906c68be763bea9ab9ce1225ad2fd88312e0de3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for ragbio 2.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.