Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Scaling data

Introduction

As the tutorial mentioned, scaling data is a prerequisite step for dimensionality reduction like Principal Component Analysis (PCA), where data per gene across cells is centered and standardized.

This method ensures that all genes are given equal weight and are placed on the same scale (z-scores), allowing for accurate downstream comparisons.

Methods

The scaled-row value (SRijSR_{ij}) is calculated for each gene ii and cell jj. The data is scaled vertically by gene across all cells, using values from the normalized matrix (log-normalize matrix in the case of the tutorial).

{μi=1Nk=1NLNikσi=k=1N(LNikμi)2N1SRij=min(LNijμiσi,SRmax)\begin{cases} \begin{aligned} \mu_i &= \frac{1}{N}\sum_{k=1}^{N}{LN_{ik}} \\ \sigma_i &= \sqrt{\frac{\sum_{k=1}^{N}{ (LN_{ik} - \mu_i)^2 }}{N-1}} \\ SR_{ij} &= min \left(\frac{LN_{ij} - \mu_i}{\sigma_i}, SR_{\text{max}} \right) \end{aligned} \end{cases}

First, the mean value of each gene (μi\mu_i) is computed as the average of log-normalized values across all cells for gene ii, where NN is the total number of cells. From that, standard deviation σi\sigma_i is calculated for each gene. The normalized values are standardized using the mean and the standard deviation of each gene and clipped at a maximum threshold (SRmaxSR_{\max}), which defaults to 10, controlled by the scale.max argument.

Summary

While Normalization minimizes technical noise to enable accurate cell-to-cell comparisons, scaling standardizes the data to allow for direct comparisons across different genes. See ScaleData.R for more details.