Skip to content

DataLens-Tools/scrna-data-visualization

Repository files navigation

scRNA-seq Organoid Analyzer

Epithelial developmental stage calibration — local Scanpy + Streamlit


Setup (run once)

# 1. Create a virtual environment (recommended)
python -m venv scrna_env
source scrna_env/bin/activate        # Mac/Linux
# scrna_env\Scripts\activate         # Windows

# 2. Install dependencies
pip install -r requirements.txt

# 3. Launch the web app
streamlit run scrna_app.py

The app opens automatically at http://localhost:8501


Files

File Purpose
scrna_pipeline.py Core Scanpy pipeline — QC → normalization → UMAP → clustering → annotation → developmental scoring
scrna_app.py Streamlit web app — connects to the pipeline, interactive UI
requirements.txt Python dependencies

Pipeline steps (teach these to your junior researcher)

1. Load data

adata = sc.read_h5ad("your_file.h5ad")
print(adata)   # adata.X = expression matrix (cells × genes)

2. Quality control

adata.var["mt"] = adata.var_names.str.startswith("MT-")
sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], inplace=True)

# Filter low-quality cells
sc.pp.filter_cells(adata, min_genes=200)
sc.pp.filter_cells(adata, max_genes=6000)
adata = adata[adata.obs.pct_counts_mt < 15].copy()

3. Normalize

adata.raw = adata.copy()               # save raw counts
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)

4. Highly variable genes

sc.pp.highly_variable_genes(adata, flavor="seurat_v3", n_top_genes=3000)
sc.pp.scale(adata, max_value=10)

5. PCA → UMAP → Clustering

sc.tl.pca(adata, svd_solver="arpack", use_highly_variable=True)
sc.pp.neighbors(adata, n_neighbors=15, n_pcs=50)
sc.tl.umap(adata)
sc.tl.leiden(adata, resolution=0.5)

6. Visualize

sc.pl.umap(adata, color=["leiden", "cell_type", "pct_counts_mt"])
sc.pl.dotplot(adata, marker_genes, groupby="leiden")

Developmental stage scoring

Each cluster is scored on 5 transcriptional axes:

  • Stemness — LGR5, ASCL2, OLFM4, SMOC2 (high = early fetal crypt)
  • Proliferation — MKI67, TOP2A, PCNA (high = transit-amplifying)
  • Maturation — VIL1, FABP1, ALPI (high = adult enterocyte-like)
  • Differentiation — MUC2, CHGA, DCLK1 (high = secretory lineage)
  • Specialization — DEFA5, TRPM5, SST (high = terminally differentiated)

Overall maturity score = mean(Maturation + Differentiation + Specialization)

Score range Developmental equivalent
0–30 Early fetal (10–14 weeks gestation)
30–60 Mid-to-late fetal (15–22 weeks)
60–80 Late fetal / neonatal (23–30 weeks)
80–100 Postnatal / adult-like

Run pipeline from the command line (no UI)

python scrna_pipeline.py /path/to/your_organoid.h5ad
# Saves processed file as your_organoid_processed.h5ad

Key references

  • Elmentaite et al. (2021) Nature — Human Cell Atlas intestinal reference
  • Múnera et al. (2023) — Organoid developmental atlas
  • Wolf et al. (2018) Genome Biology — Scanpy framework
  • Traag et al. (2019) — Leiden clustering algorithm

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages