
AIdeas: Predicting Drug Risks Before Clinical Trials - Project Anukriti
An AI-powered in silico pharmacogenomics platform that simulates personalized drug responses across genetically diverse synthetic patient cohorts - enabling scalable pre-clinical safety screening without animal testing.
App Category
Social Impact - Making pharmacogenomic safety insight easier to explore before expensive lab or trial work, with an equity lens on diverse genomes.
Executive Summary
Project Anukriti is a research prototype for in silico pharmacogenomics. Given a drug from a curated list or a SMILES string, plus a genomic profile from local files, uploads, S3, or streamed 1000 Genomes VCFs, the system produces structured outputs: risk-style framing, per-gene phenotypes, mechanism-style narrative, confidence scores, PDF and FHIR-like exports, and per-run audit metadata. These outputs are for research and education, not clinical care.
Decisions are deterministic. A CPIC- and PharmVar-aligned rule engine performs pharmacogenomic calling and risk-style classification. Large language models do not decide risk. AWS Bedrock explains and contextualizes fixed engine outputs: Amazon Nova Lite or Nova Pro for text (configurable per request), with Amazon Titan embeddings for RAG over guideline text. Claude on Bedrock remains supported where enabled. Optional Google Gemini is available for explanation.
On constrained accounts, Anthropic models are sometimes unavailable in Bedrock (model access, region, or quota). The app defaults to Amazon Nova on Bedrock so the stack stays AWS-native without changing the architecture: the deterministic PGx engine is unchanged; only the explanation backend switches.
The product thesis is equity through representation: many historic datasets skew European; screening against genetically diverse cohorts helps surface population-relevant pharmacogenomic patterns earlier in research and training workflows.

The Problem
Drug development wastes enormous time and money on late failures; many adverse outcomes have a pharmacogenomic component. A practical gap is underrepresentation of non-European ancestry in early genomic resources, so population-specific pharmacogenomic risks are under-explored until late stages.
This project does not replace animal studies, predict full clinical trial outcomes, or replace licensed pharmacogenomic testing. It makes guideline-aligned, auditable pharmacogenomic-style screening easier to run at scale on diverse genomes for research, education, and safety communication.
Two examples that make this concrete:
When Codeine is prescribed to a CYP2D6 Ultrarapid Metabolizer, their body converts it to Morphine so rapidly that a standard dose can cause fatal respiratory depression. When Warfarin is given to a CYP2C9 Poor Metabolizer, the drug accumulates in the bloodstream, dramatically increasing the risk of life-threatening bleeding.
These gene variants are common across South Asian, East Asian, and African populations - populations historically underrepresented in clinical genomic datasets. The harm is real, preventable, and disproportionately falls on communities already medically underserved.
Vision
Project Anukriti simulates drug-genome interaction for a focused pharmacogene panel using computational rules and transparent evidence retrieval, so teams can explore what-if safety questions before wet lab or trial investment - with clear limits stated in the product.
In scope: CPIC-style interpretation for defined genes and drug-gene pairs; VCF-driven variant extraction and allele/phenotype calling for that panel; explainable narratives grounded in retrieved guidelines; cohort views over many reference or synthetic genomes; drug-triggered PGx so only relevant genes appear for the chosen drug.
Out of scope: general PK/PD or toxicology prediction; predicting overall clinical trial success; autonomous medical decisions; diagnostic or prescribing advice.
What the Product Does
Given a drug and a genomic source, Anukriti:
- Extracts variants in key pharmacogenes using Tabix on per-chromosome VCFs from local paths, S3, upload with server-side indexing, or remote 1000 Genomes and Open Data via HTTP range requests
- Calls diplotypes and phenotypes with deterministic CPIC- and PharmVar-aligned logic, including partial CYP2D6 copy-number cues from structural variant or CN fields where present
- Shows only genes relevant to the chosen drug via drug-triggered PGx (Warfarin -> CYP2C9 + VKORC1; Statins -> SLCO1B1; Thiopurines -> TPMT; Fluoropyrimidines -> DPYD; Abacavir -> HLA-B*57:01)
- Retrieves supporting text with Amazon Titan embeddings and lightweight similarity search over versioned local CPIC-oriented material, with a path to swap in OpenSearch Serverless or Aurora pgvector later
- Explains via Nova Lite or Nova Pro on Bedrock (default), Claude on Bedrock where enabled, or optionally Gemini - with structured outputs, caching, and audit fields (model ID, timing, cache hits, and clear hints when Bedrock returns credential or access errors)
- Exports PDF reports, FHIR-like JSON bundles for interoperability demos, and CSV cohort summaries
The UI includes a simulation lab, batch/cohort mode with population and risk-style analytics, a datasets manager, async jobs with polling for heavier paths, and optional real-time checks for AWS services with graceful local fallback.
How I Built This
Architecture
Pipeline: User -> Streamlit UI -> FastAPI (Docker on EC2) -> Deterministic PGx Engine -> RAG (Titan + local index) -> Nova / Claude / Gemini on Bedrock -> Structured Output + PDF + FHIR-like JSON
The LLM is not in the decision loop. It reformats and explains outputs the engine has already fixed.
Demo Video: https://www.youtube.com/watch?v=zu-1reih7wA
Three Layers
Data plane - Tabix and htslib for fast regional queries; remote VCF access without full downloads; dataset browser; sample discovery; async jobs with polling; TTL caches for demos.
Decision engine - No LLM. Hard-coded auditable rules aligned to CPIC and PharmVar tables versioned in-repo; RDKit for SMILES and similar-drug context where configured; reproducible outputs and per-run audit.
Explanation and product - Bedrock with amazon.titan-embed-text-v2 for embeddings; Amazon Nova Lite for fast, cost-efficient explanations and Nova Pro when higher-quality narrative is needed; Claude 3 via converse where enabled; optional Gemini; Streamlit for Simulation Lab, batch/cohort mode, analytics, dataset manager, and 3D views.

Built on AWS (Bedrock-Native)
- Amazon Bedrock - Titan embeddings (amazon.titan-embed-text-v2:0); Nova Lite / Nova Pro for explanations under guardrailed prompts; Claude 3 where enabled
- Amazon EC2 (Free Tier) - FastAPI and Streamlit in Docker via Docker Compose
- Amazon S3 - genomic objects (per-chromosome VCFs + Tabix indexes) with Intelligent Tiering; report storage with 30-day lifecycle and presigned URLs
- AWS Lambda - batch-style population runs designed for large cohorts at low per-run cost (~$0.0001 per patient)
- AWS Step Functions - orchestration, retries, monitoring for multi-step pipelines
- Amazon CloudWatch - logs, metrics, cost and ops visibility
- IAM - least-privilege roles for service access
The entire system runs within AWS Free Tier + limited credits, proving that clinically relevant decision support can be prototyped affordably on AWS.
Pharmacogene Panel (8 genes, 7 chromosomes)
| Gene | Chromosome | Clinical Relevance |
|---|---|---|
| CYP2D6 | chr22 | ~25% of drugs; copy-number-aware |
| CYP2C19 | chr10 | Antiplatelet, antidepressants |
| CYP2C9 | chr10 | Anticoagulation, NSAIDs |
| UGT1A1 | chr2 | Irinotecan toxicity |
| SLCO1B1 | chr12 | Statin myopathy |
| VKORC1 | chr16 | Warfarin sensitivity |
| TPMT | chr6 | Thiopurine toxicity |
| DPYD | chr1 | Fluoropyrimidine toxicity |
| HLA-B*57:01 | chr6 (HCP5 proxy) | Abacavir hypersensitivity |
Deterministic PGx Engine (No LLM)
Hard-coded CPIC-aligned rules:
- CYP2C19: PharmVar allele tables (TSV) + CPIC phenotype tables (JSON) -> deterministic diplotype calling (*1/*2 -> Intermediate Metabolizer)
- Warfarin: CYP2C9 + VKORC1 variants -> warfarin_response.json -> dosing recommendation
- SLCO1B1: rs4149056 genotype -> statin myopathy risk (TT / TC / CC)
- TPMT and DPYD: PharmVar/CPIC tables plus curated Tier 1 variants (TPMT *3A, DPYD *2A / c.2846A>T)
- HLA-B*57:01: detected via rs2395029 proxy; flagged for abacavir workflow
- CYP2D6 CNVs: structural variant records and INFO CN= parsed to infer copy number
All risk decisions are made before any LLM is called. The LLM only explains and reformats those decisions for humans.
Technology Stack
| Layer | Technology |
|---|---|
| Frontend | Streamlit |
| Backend | FastAPI + Uvicorn + Docker |
| Genomics | htslib / Tabix; VCF; 1000 Genomes + AWS Open Data |
| Cheminformatics | RDKit; ChEMBL |
| Guidelines | CPIC- and PharmVar-oriented tables versioned in-repo |
| AI | Amazon Titan Embeddings v2; Amazon Nova Lite/Pro; Claude 3 (Bedrock); optional Gemini |
| Cloud | EC2, S3, Lambda, Step Functions, CloudWatch, IAM |
| Observability | CloudWatch; optional Google Analytics |
| Exports | PDF; FHIR-like JSON; CSV |
Demo
Live Demo: anukriti.abhimanyurb.com
GitHub: github.com/Abm32/Synthatrial
Demo Video: https://www.youtube.com/watch?v=zu-1reih7wA
Note: If Bedrock rate limits or regional availability affect the live demo, screenshots and the video remain the reference; the architecture is unchanged.
(Screenshots of the Anukriti interface)

Simulation Lab - Select a drug or enter a SMILES string. Drug-triggered PGx highlights only relevant genes. In VCF mode, choose source (Local / S3 / Upload / Remote 1000G / S3 Open Data), select a dataset and sample, and run a background VCF profile job with live progress updates.

Batch Mode - Configure cohort size (50-2,000+ patients), select a drug, run a population simulation. Results include population diversity (AFR, EUR, EAS, SAS, AMR), risk distribution charts, gene-level phenotype distributions, throughput and cost estimates, and Lambda/Step Functions usage indicators.



Simulation Results - Displays Risk Level, Predicted Reaction, Biological Mechanism, Dosing Implication, Confidence Score, Processing Time, backend/model used, a collapsible audit trail, and Download Clinical Report (PDF) and Download EHR JSON (FHIR-like) buttons.
Validation
Interpretations are checked against CPIC Level A-style examples for supported pairs (Warfarin-CYP2C9/VKORC1, Codeine-CYP2D6, Clopidogrel-CYP2C19, Thiopurines-TPMT, Fluorouracil/Capecitabine-DPYD) using fixture-style cases and manual review - not a regulatory validation package.
What I Learned
Separate decisions from explanations - the reliable pattern for healthcare-adjacent AI. Early versions asked the LLM to decide risk. Results sounded confident but were not reliable. The architectural shift - CPIC rules decide, the LLM explains - transformed reliability.
Targeted panels beat whole-genome breadth for trust and debuggability. A focused CPIC-grade panel delivered more clinically meaningful results than a genome-wide approach.
Nova Lite and Pro on Bedrock give a practical AWS-native path when other foundation models are gated, without changing the clinical engine. This was a key lesson in building resilient, AWS-first architecture.
S3 and streaming VCFs make diverse cohort demos accessible without petabyte downloads - the same codebase works across local dev, single EC2, and multi-instance deployments.
Lightweight RAG is enough at this scale. Local Titan embeddings + NumPy cosine search provided grounded, high-quality context before a full-blown vector DB was needed.
Asynchronous jobs, explanation caching, and VCF caching matter for UX and cost. Background jobs with polling and TTL caches turned potentially frozen UI moments into smooth interactions and kept API bills reasonable.
Genomic diversity is an equity issue. This project became as much about global health equity as about cloud or AI. Building tools that explicitly consider non-European populations feels like a meaningful use of AI and AWS.
Current Status and Known Limitations
Production-ready features (current beta): Deterministic CPIC/PharmVar-aligned calling for 8 key genes; drug-triggered PGx; dual LLM backend (Nova + Gemini + Bedrock Claude) with per-request override; PDF and FHIR-like EHR JSON export; per-run audit trails; async VCF jobs with TTL caching; batch/cohort mode with gene-level analytics and CSV export; real-time AWS status with graceful fallback; Lambda-based population-scale simulation.
Known limitations:
- Incomplete multi-variant haplotypes and partial structural resolution, especially full CYP2D6 CNV resolution
- Panel scope is eight core genes, not whole-genome pharmacogenomics
- Prototype only - not a certified clinical decision support system and not for real patients
- Demo may depend on Bedrock quotas or IAM; local paths still demonstrate the deterministic pipeline
Future work: Richer haplotype phasing and activity-score models for CYP2D6; expanded genes (G6PD, CYP3A5, more HLA loci); deeper EHR and trial integrations; optional managed vector stores (OpenSearch Serverless or Aurora pgvector).
Project Anukriti is a research prototype. Outputs are synthetic predictions and must not be used for clinical decision-making, diagnosis, or treatment. Not medical advice.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article