How verma-lab/platlas works
Project Type and Purpose
• PLATLAS is a full-stack web application for exploring genome-wide association (GWAS/PheWAS) data across multiple ancestries.
• Frontend: React.js SPA with interactive plots (Manhattan, QQ, Hudson) and pages for GWAS, PheWAS, downloads, etc.
• Backend: Node.js + Express REST API that serves filtered data and handles AI-powered text processing.
• Data: File-based storage of summary statistics plus Firestore for vector/document storage used by the RAG/AI service.
High-Level Components
a. User Interface (Frontend)
– React.js application (Frontend/src)
– Components: plots (Manhattan.js, QQ.js, Hudson.js), pages (GWASPage, PhewasPage, Downloads), shared UI (NavigationBar, SearchBar).
– Client-side routing: React Router (Routes.js).
– Styling: Tailwind CSS, React Bootstrap.
b. API Layer (Backend)
– Express.js server (Backend/src/index.js)
– Routes (aiRoutes.js, phenotypeRoutes.js, index.js).
– Controllers (gwasController, phewasController, phenotypeController, snpMappingController).
– Middleware: auth.js.
c. Business Logic & Services
– Core services: gwasService, phewasService, phenotypeService, tabixService, snpMappingService, findFiles.
– AI & RAG: RagService orchestrates:
• TextProcessor, gemini (AI modules)
• chatService/TextOptimizer
• Firestore vector store (ai/db/firestore.js) and document store (ai/storage/documents.js, vectors.js)
d. Data Layer
– File system: compressed GWAS/PheWAS summary statistics (.gz, .tbi), pre-rendered plot images
– Firestore: vector embeddings and documents for retrieval-augmented generation
e. External Services
– OpenAI (or similar) APIs called by AI modules in services/ai
– Firestore (Google Cloud) for vector and document storage
Relationships and Data Flows
• User → Frontend UI
• Frontend → REST API calls (/api/queryGWASData, /api/phewas, /api/getTopResults, /api/findfiles, /api/…AI)
• API Layer → Controllers → Services
• Services:
• Data services read compressed files or Tabix indices
• AI services call external LLM endpoints and Firestore queries
• Services → Responses → Frontend
• Frontend → updates UI components/plots
Architectural Patterns and Design Principles
• Separation of Concerns: UI, API routing, controllers, business services, storage
• Component-based UI (React) for reusability
• Layered backend: routes → controllers → services → data/external
• RAG pattern: uses vector store + LLM for AI-driven features
• Lazy loading & caching in frontend to optimize large data sets
Detail Level
• Drill into critical flows: e.g., a user click on a “Manhattan point” triggers /api/queryGWASData → gwasController → gwasService → file read → JSON response
• Caching or lazy-loading if relevant