Skip to content

End-to-end scRNA-seq analysis platform using FastAPI, Scanpy, AnnData, PCA, UMAP, and Leiden clustering with interactive visualization.

Notifications You must be signed in to change notification settings

wizard1729/singlecell-analysis-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧬 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

About

End-to-end scRNA-seq analysis platform using FastAPI, Scanpy, AnnData, PCA, UMAP, and Leiden clustering with interactive visualization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published