Built for the RIFT Hackathon.
The trial-and-error approach to prescribing medication has always seemed crazy to me. To try and fix that, we spent the hackathon building GenomeRx: a platform that reads raw patient genetic data (VCF files) and generates personalized drug dosing recommendations based on how their specific body will metabolize the medication.
Instead of guessing, GenomeRx builds a "Digital Twin" to simulate their metabolism based on their genetic profile.
The system runs on a Next.js frontend and a FastAPI backend. We split the core logic into a few different engines:
- Genetic Analysis: We wrote a parser to extract pharmacogenomic variants from VCF 4.x files. It maps these to functional star alleles and clinical phenotypes (like Poor or Rapid Metabolizer), then evaluates them against CPIC guidelines.
- Pharmacokinetic (PK) Simulator: This solves 1-compartment ODEs to predict drug concentration over time. You can compare a patient's curve against other metabolizer types on the same chart. We also built a cohort simulator that runs Monte-Carlo trials on 100 digital twins based on known population allele frequencies.
- 3D Protein Viewer: We added real-time 3D protein folding using ESMFold to visualize drug-enzyme interactions. This runs locally if you have an NVIDIA GPU, or falls back to a procedural model if you don't. It animates drug molecules docking into the active site.
- Clinical Reasoning & Reports: We use Claude 3.5 Sonnet to translate the raw data and CPIC guidelines into plain-text explanations that doctors can quickly read. We also added a "Genetic Influence Heatmap" to show exactly which variants drove the final recommendation, and we generate formatted PDF reports for easy sharing.
- Edge-Case Handling: The pipeline is built to gracefully handle messy real-world data, including malformed files, empty uploads, and extreme metabolizer phenotypes.
- Backend: Python, FastAPI, Motor/MongoDB (falls back to in-memory if no database is found), NumPy, SciPy.
- Frontend: Next.js 15, React 19, Tailwind CSS v4, Recharts, React Three Fiber.
- AI & Modeling: Claude 3.5 Sonnet, ESMFold via PyTorch/NVIDIA NIM.
You'll need Python 3.10+ and Node.js 18+. You also need an Anthropic API key to generate the clinical reasoning.
Install the Python requirements:
git clone https://github.com/your-repo/genomerx.git
cd genomerx
pip install -r requirements.txt(Optional) If you have an RTX card and want to run the 3D structure prediction locally:
pip install torch --index-url https://download.pytorch.org/whl/cu128Create a backend/.env file and add your keys:
ANTHROPIC_API_KEY=your_key_here
LOCAL_ESMFOLD=1 # Set to 1 if you installed the torch version above
Boot up the server:
python backend/main.pyThe API will be available at http://localhost:8000.
Open a new terminal, install the Node packages, and start the app:
cd frontend
npm install
npm run devThe frontend will start at http://localhost:3000.
We included some sample VCF files (including edge cases) in the data/ directory. If you want to verify that the whole pipeline works from parsing to recommendation, you can run our integration script:
python test_integration.py