EN / TR
Özge Karasu Özge Karasu

Curiosity leads me. I follow and write.

Unsupervised Clustering of Pan-Cancer Gene Expression

15.05.2021

Background

High-dimensional gene-expression data can contain structure associated with biologically distinct patient groups even when class labels are not used during model fitting.

Using a pan-cancer gene-expression dataset containing 801 patient samples and 20,531 gene-expression features, I explored whether unsupervised learning could recover structure associated with five known cancer types:

  • BRCA — Breast invasive carcinoma
  • KIRC — Kidney renal clear cell carcinoma
  • LUAD — Lung adenocarcinoma
  • PRAD — Prostate adenocarcinoma
  • COAD — Colon adenocarcinoma

The project combined K-Means clustering with PCA and t-SNE to investigate both cluster structure and the challenges of representing extremely high-dimensional biological data in two dimensions.

Research Goals

  1. Explore the structure of a high-dimensional pan-cancer gene-expression dataset.
  2. Use K-Means clustering to identify patient groups without using cancer labels during model fitting.
  3. Compare alternative approaches for selecting the number of clusters, including within-cluster sum of squares and silhouette scores.
  4. Use PCA and t-SNE to visualise high-dimensional gene-expression patterns in two dimensions.
  5. Compare unsupervised cluster assignments with known cancer labels to assess how closely the discovered structure corresponded to existing biological categories.

Dataset

The dataset contained:

  • 801 patient samples
  • 20,531 gene-expression features
  • 5 known cancer types: BRCA, KIRC, LUAD, PRAD, and COAD

The class distribution was not uniform, with BRCA representing the largest group and COAD the smallest.

The analysis first examined basic properties of the gene-expression matrix before applying clustering and dimensionality-reduction methods.

Methodology

K-Means Clustering

K-Means was evaluated across several candidate numbers of clusters:

k = 2, 3, 5, 6, 7, 8, and 9

Two complementary criteria were used to examine cluster quality:

  • Within-Cluster Sum of Squares (WCSS): Used to identify where additional clusters produced diminishing improvements in compactness.
  • Silhouette Score: Used to evaluate how well individual samples were separated from neighbouring clusters.

Principal Component Analysis

PCA was used to project the gene-expression data into a lower-dimensional linear representation.

For the first two principal components, the explained-variance ratios were:

  • PC1: 15.84%
  • PC2: 10.50%

Together, the first two components explained approximately 26.34% of the total variance, illustrating how much information is lost when the full gene-expression structure is compressed into a two-dimensional linear representation.

The gene-expression features were standardised for the two-dimensional PCA visualisation.

t-SNE

t-distributed Stochastic Neighbor Embedding (t-SNE) was applied as a nonlinear dimensionality-reduction method to examine local structure in the high-dimensional expression space.

PCA and t-SNE projections were visualised alongside:

  • known cancer labels
  • K-Means cluster assignments

This allowed the structure discovered by the unsupervised algorithm to be compared with existing biological categories without using those labels during model fitting.

Results

The cluster-selection analysis produced an important methodological result: different evaluation criteria did not identify exactly the same preferred number of clusters.

K-Means and WCSS

Within-cluster sum of squares decreased as additional clusters were introduced, as expected.

The reduction began to slow noticeably around k = 5, making five clusters a plausible choice according to the elbow criterion.

This was also notable because the dataset contained five known cancer types, although the class labels were not used to determine the clustering solution.

Silhouette Analysis

Silhouette analysis produced a slightly different result:

  • k = 5: silhouette score ≈ 0.2246
  • k = 6: silhouette score ≈ 0.2288

Among the tested values, k = 6 produced the highest silhouette score, although the difference from k = 5 was small.

The analysis therefore did not support a simple claim that there was one objectively correct number of clusters. Instead, the preferred value depended partly on the evaluation criterion: the elbow analysis suggested approximately five clusters, while the silhouette metric marginally favoured six.

PCA

The two-dimensional PCA representation showed substantial overlap between patient groups.

Because the first two components explained only approximately 26% of total variance, much of the structure present in the original 20,531-dimensional feature space was necessarily omitted from the visualisation.

The resulting projection therefore made several cancer groups difficult to distinguish clearly.

t-SNE

The t-SNE representation produced visually clearer separation between several cancer groups than the two-dimensional PCA projection.

Comparing cancer labels with K-Means assignments showed that some of the structure discovered in the gene-expression data was associated with known cancer categories, although the unsupervised partition did not reduce to a perfectly separated one-to-one mapping between clusters and labels.

The comparison also illustrated an important limitation: a visually clear two-dimensional embedding does not by itself establish that the original high-dimensional data contain well-separated clusters.

Contributions

  • Analysed a high-dimensional dataset containing 801 cancer patients and 20,531 gene-expression features.
  • Applied K-Means clustering without using cancer labels during model fitting.
  • Compared cluster configurations using both WCSS and silhouette analysis.
  • Identified a disagreement between selection criteria: the elbow analysis suggested approximately k = 5, while the highest tested silhouette score occurred at k = 6.
  • Quantified the information retained by two-dimensional PCA, with the first two components explaining approximately 26.34% of total variance.
  • Compared linear PCA and nonlinear t-SNE representations, with t-SNE producing clearer visual separation of several cancer groups.
  • Used known cancer labels only as an external reference for interpreting the structure discovered through unsupervised learning.

Impact

This project demonstrated that discovering structure in high-dimensional data is not simply a matter of running a clustering algorithm and accepting the resulting partition.

Even in a dataset with five known biological categories, different unsupervised evaluation criteria produced slightly different conclusions about the preferred number of clusters. Similarly, PCA and t-SNE produced substantially different visual representations of the same underlying data.

The project therefore highlighted a broader principle in machine learning: the apparent structure of a dataset depends partly on the model, metric, and representation used to examine it.

Understanding those dependencies is important before interpreting an unsupervised pattern as a reliable representation of the underlying data.