🧬 Single-Cell Analysis Platform (scRNA-seq)
An end-to-end single-cell RNA sequencing (scRNA-seq) analysis and visualization platform built using FastAPI, Scanpy, and AnnData, supporting real biological datasets (PBMC) with interactive UMAP visualization.
🔍 Overview
This project implements a complete backend pipeline for single-cell transcriptomic analysis, starting from raw count data to dimensionality reduction, clustering, and visualization.
The system is designed as a research prototype, focusing on correctness, reproducibility, and extensibility rather than UI complexity.
🧪 Features Implemented ✅ Data Handling
Load real PBMC scRNA-seq datasets
Support for large sparse gene expression matrices
Automatic cell × gene matrix handling via AnnData
✅ Preprocessing Pipeline
Library size normalization
Log-normalization
Feature scaling
Principal Component Analysis (PCA)
✅ Dimensionality Reduction
UMAP computed on PCA space
Configurable parameters (neighbors, components)
✅ Clustering
Graph-based Leiden clustering
Uses igraph backend
Cluster labels stored in AnnData object
✅ Visualization
Interactive UMAP plot (HTML)
Zoom, pan, hover cell IDs
Cells colored by cluster
Suitable for exploratory biological analysis
🏗️ System Architecture singlecell-platform/ │ ├── backend/ │ ├── app/ │ │ ├── api/ │ │ │ ├── datasets.py # CSV / dataset endpoints │ │ │ ├── umap.py # UMAP + clustering API │ │ │ └── default.py # PBMC loader API │ │ ├── services/ │ │ │ └── singlecell_csv.py │ │ ├── state.py # Global AnnData state │ │ └── main.py # FastAPI app │ └── static/ │ └── umap.html # Interactive UMAP visualization │ └── README.md
🚀 How to Run
1️⃣ Create Environment
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
2️⃣ Install Dependencies pip install fastapi uvicorn scanpy anndata umap-learn igraph plotly
3️⃣ Start Server uvicorn app.main:app --reload
Server runs at: http://127.0.0.1:8000
🧭 API Endpoints Load PBMC Dataset POST /api/load_pbmc
Response { "status": "PBMC loaded", "cells": 2700, "genes": 2000 }
Get UMAP Coordinates GET /api/umap Returns cell-wise UMAP coordinates with cluster labels.
Visualization Open in browser: http://127.0.0.1:8000/static/umap.html
🧠 Research Significance
Implements a standard scRNA-seq analysis workflow
Uses industry-standard tools (Scanpy, AnnData)
Suitable as:
Research prototype
Methods chapter foundation
Base for further biological extensions
🏁 Project Status
✅ Completed — Version 1.0 This version represents a stable, functional, and research-ready implementation.
👤 Author Anurag Lal Software Engineer | Scientific Computing | Research Systems