Back to thesis page

Interactive · MSc Thesis · METU Biotechnology · September 2024

Next-Generation Cell Type Annotation

A system that improves cell type classification in scRNA-seq data by combining NLP and ML techniques. Scroll down — start to finish.

01 — The Problem

Why is identifying cell type hard?

Single-cell RNA sequencing (scRNA-seq) extracts the gene expression profile of each cell. But this data is high-dimensional and complex.

Correctly labeling which type a cell is (T cell, B cell, monocyte...) is critical. Traditional methods don't capture the relationship between genes and cell types well enough.

The thesis's starting point: model this relationship better and raise annotation accuracy.

02 — The Idea

Reading genes like "text"

The core idea: turn gene symbols into embeddings with natural language processing (NLP). Using the tokenizer + embedding parts of BERT, GPT2 and GPT3, each gene symbol is converted to a vector.

These embeddings capture semantic relationships between genes — connections not visible from expression values alone.

Novelty: no other work combines BERT/GPT2/GPT3 tokenizers with autoencoders for cell type annotation.

03 — System Architecture

A two-phase design

The whole study was built on two phases — an engineering decision that makes experiments objectively comparable.

Phase 1 — Scanpy

A 10-step preprocessing + quality control pipeline for Human Cell Atlas PBMC data. Filtering, normalization, dimensionality reduction.

Phase 2 — 5 Pipelines

5 separate pipelines following the same protocol but with different data handling steps. Each isolates a single variable.

04 — Comparison Design

5 pipelines, one variable

Each pipeline takes the same data but with a different input combination. This clearly answers "how much does each component contribute?"

1Only Text EmbeddingF1 0.790
2Text Embedding + Gene ExpressionF1 0.818
3Only Gene ExpressionF1 0.312
4One-Hot Encoded + Gene ExpressionF1 0.262
5Only One-Hot EncodedF1 0.231
05 — Methodology Flow

Embedding → Outlier → Autoencoder → ML

The four steps inside a pipeline:

  1. 1Text embeddingGene symbols converted to vectors with an NLP tokenizer
  2. 2Outlier detectionZ-Score, Isolation Forest, Local Outlier Factor
  3. 3AutoencoderDimensionality reduction + feature extraction with the encoder part
  4. 4ML predictionNeural Network, SVM, SGD, Decision Tree, Random Forest
06 — The Data

PBMC data and text construction

Main dataset: PBMC from the Human Cell Atlas (COVID-19 multi-omic blood atlas). The Human Protein Atlas's 19,751-gene-symbol dataset was used for gene name mapping.

17 cell types, the top 100 expressed genes per cluster, 1700 highly variable genes (HVG) in total.

Type I

1 combination

Type II

5 combination

Type III

8 combination

07 — Results

Best result: F1 = 0.818

The highest score was achieved with Pipeline 2 (Text Embedding + Gene Expression) on the Type III (8 genes) construction: F1 = 0.818.

P1
0.79
P2
0.82
P3
0.31
P4
0.26
P5
0.23

One-hot encoding pipelines scored lowest (~0.23). There is a clear 0.48–0.59 gap versus text embeddings.

08 — Findings

What was achieved?

  • Text-based pipelines clearly outperformed all other approaches.
  • GPT3 was the best embedding model; GPT2 also produced better representations than BERT.
  • Type III (8 genes) text construction consistently outperformed simpler constructions.
  • Using autoencoders improved model performance.
  • Outlier detection improved the results.
  • Data preprocessing design was more decisive than the chosen ML model.
  • Text embeddings effectively captured complex relationships between genes.
  • The method produced more accurate results than one-hot encoding approaches.
09 — Impact & Future

Towards a Model Atlas

The results showed that cell types can be predicted with high accuracy from gene symbols + expression levels — meaning it's possible to build a "Model Atlas" like existing data atlas projects.

Future work: different neural network layer designs, using gene "absence" information, and single-cell multi-omic approaches combining scRNA-seq with scATAC-seq.

"Key is getting information from data"

— My research philosophy

Back to thesis summary and PDF
Orçun Sami Tandoğan - Python Developer & Data Scientist