Skip to content

About

PCA, K-Means, and Logistic Regression on GTEx bulk RNA-seq to classify tissue types from gene expression profiles

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

GTEx Tissue Classification: PCA, K-Means & Logistic Regression

Zahin Peerzade

Unsupervised and supervised ML pipeline applied to bulk RNA-seq data from the GTEx project to classify tissue types from gene expression profiles.


What This Project Does

Using gene expression data from 4 tissue types — Liver, Brain (Cerebellum), Skin (Suprapubic), and Muscle (Skeletal) — this notebook builds a full ML pipeline from raw counts to tissue classification:

  1. PCA — Reduces 15,000-gene expression matrix to a compact representation via manual eigen-decomposition (no sklearn PCA for the unsupervised steps)
  2. K-Means Clustering — Custom implementation clusters samples in PCA space; elbow method selects k=4
  3. Cluster Validation — Manual NumPy-only implementations of Silhouette Score and Adjusted Rand Index
  4. Logistic Regression — sklearn LR with L2 regularization trained on PCA-reduced features; regularization strength tuned across C ∈ {0.01, 0.1, 1, 10}
  5. Cross-Validation — 5-fold CV on training set across accuracy, precision, recall, and F1
  6. Gene Annotation — Top contributing genes identified from PCA loadings and annotated via MyGene.info API

Dataset

GTEx v8 (Genotype-Tissue Expression project)

  • Expression matrix: GTEx_Analysis_2017-06-05_v8_RNASeQCv1.1.9_gene_tpm.gct
  • Sample metadata: GTEx_Analysis.txt
  • Top 15,000 genes by expression used for computational tractability

Data is not included in this repo due to size. Download from gtexportal.org.


Requirements

pip install pandas numpy matplotlib scikit-learn requests

How to Run

  1. Download GTEx expression matrix and metadata (links above)
  2. Place both files in the same directory as the notebook
  3. Open gtex_tissue_classification.ipynb and run all cells

Key Results

Method Metric Score
K-Means (k=4) Adjusted Rand Index ~0.9+
K-Means (k=4) Silhouette Score ~0.4+
Logistic Regression (C=0.1) Test Accuracy ~1.00
Logistic Regression (C=0.1) 5-fold CV F1 (macro) ~1.00 ± 0.00

The four tissues are highly separable in PCA space — muscle and liver in particular show strong clustering driven by tissue-specific expression programs.


Repository Structure

gtex-tissue-classification/
├── gtex_tissue_classification.ipynb   # Full pipeline notebook
└── README.md

References

  • GTEx Consortium. The GTEx Consortium atlas of genetic regulatory effects across human tissues. Science. 2020.
  • Pedregosa et al. Scikit-learn: Machine Learning in Python. JMLR. 2011.
  • MyGene.info: mygene.info

About

PCA, K-Means, and Logistic Regression on GTEx bulk RNA-seq to classify tissue types from gene expression profiles

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages