Tutorials › Multi-Omics Data Integration › A Worked Preprocessing Pipeline for Matched Multi-Omics Blocks

Preprocessing, Scaling and Block Weighting · Tutorial 58 of 597

A Worked Preprocessing Pipeline for Matched Multi-Omics Blocks

Learn to build and audit a reproducible preprocessing pipeline for matched count and intensity matrices without confusing normalization, scaling, or block weighting.

Intermediate 12 min read

What You'll Learn

  • Arrange matched samples consistently across count and intensity blocks.
  • Adjust counts for library size and apply a log transformation.
  • Define modality-specific filtering rules and assess which features pass.
  • Center and scale retained features within each block using sample standard deviations.
  • Check transformed values and summaries for common preprocessing failures.
  • Document choices without treating preprocessing as block weighting.

Why a Worked Pipeline Needs Explicit Decisions

A multi-omics analysis can begin with measurements on the same subjects but on very different scales. A count block may contain sequencing counts affected by library size; an intensity block may contain positive measurements spanning orders of magnitude. Preprocessing makes the features within each block usable on a stated scale. It does not make the blocks biologically equivalent, guarantee that technical effects are gone, or decide how much influence each block should have in a later analysis.

The order and rules matter. A reproducible pipeline states which samples are matched, how measurements are transformed, what qualifies a feature for retention, and how retained features are centered and scaled. The earlier material on normalization versus scaling distinguishes adjustments for measurement scale or sampling depth from transformations that put features on comparable numerical scales. Here those distinctions are applied in one small, hypothetical data set.

Definition: Let \(X^{(b)}\) denote a data block for modality \(b\), with \(n\) matched subjects in rows and \(p_b\) features in columns. A preprocessing pipeline applies specified operations to each block, possibly with modality-specific rules, while preserving the subject correspondence. Within-block centering subtracts each feature's mean across subjects; within-block scaling divides its centered values by that feature's standard deviation.

The examples use four subjects, S1–S4, and two blocks. Rows refer to the same subjects in the same order in both blocks. The count block gives raw counts and library sizes; the intensity block gives positive measurements. All values are hypothetical. For clarity, the count normalization below uses counts per million (CPM), and the intensity values are assumed to have already undergone any required background correction.

Count Block: Adjust, Transform, Then Filter

CPM divides a feature's count for a subject by that subject's total library size and multiplies by one million. It adjusts for differing total counts, but it does not by itself eliminate every possible compositional bias. For this illustration, log transformation follows CPM: \(Y_{ij}=\log_2(\mathrm{CPM}_{ij}+1)\). The added 1 permits a zero CPM value and makes the transformation defined; it is a stated pseudocount, not a universal constant that fits every data set.

SubjectLibrary sizeGene AGene BGene CGene D
S1100,0001000200
S2200,0002000400
S3100,0003000602
S4100,0004000800

For example, Gene A in S2 has \((200/200{,}000)\times 1{,}000{,}000=1{,}000\) CPM, not 2,000 CPM. Gene D has 20 CPM in S3 and zero in the other subjects. Suppose the prespecified filter retains a gene when its CPM is at least 1 in at least two subjects. This rule retains Gene A and Gene C, and removes Gene B (zero in all subjects) and Gene D (threshold met in only one subject). It is a practical filtering rule for this example, not a claim that the threshold is optimal for all count studies.

Worked Example: Normalizing and Transforming the Count Block

Calculate the CPM and log-transformed values for Gene A and Gene C, then verify the stated filtering decision.

For Gene A in S1, CPM is \((100/100{,}000)\times1{,}000{,}000=1{,}000\). Its transformed value is \(\log_2(1{,}000+1)=9.967\). In S2, CPM is \((200/200{,}000)\times1{,}000{,}000=1{,}000\), again giving 9.967. S3 has 3,000 CPM and \(\log_2(3{,}001)=11.551\); S4 has 4,000 CPM and \(\log_2(4{,}001)=11.966\).

For Gene C, the CPM values are 200, 200, 600, and 800. The transformed values are \(\log_2(201)=7.651\), \(\log_2(201)=7.651\), \(\log_2(601)=9.231\), and \(\log_2(801)=9.646\). Both genes exceed 1 CPM in all four subjects, so both pass the filter. Gene D exceeds 1 CPM only in S3, so it fails the requirement of at least two subjects. Gene B never exceeds the threshold.

After filtering, center and scale each retained feature separately. For a transformed feature \(j\), let \(y_{ij}\) be its value in subject \(i\), let \(\bar{y}_j\) be its sample mean across the \(n\) subjects, and let \(s_j\) be its sample standard deviation. The standardized value is \(z_{ij}=(y_{ij}-\bar{y}_j)/s_j\). The sample standard deviation uses denominator \(n-1\), so this operation gives each retained feature sample mean zero and sample variance one, provided \(s_j>0\).

Worked Example: Centering and Scaling a Retained Count Feature

For Gene A, the transformed values are approximately 9.967, 9.967, 11.551, and 11.966. Their mean is \(\bar{y}_A=(9.967+9.967+11.551+11.966)/4=10.863\). The sample standard deviation is \(s_A=\sqrt{\sum_i(y_{iA}-\bar{y}_A)^2/3}\approx1.048\).

The standardized value for S1 is \((9.967-10.863)/1.048\approx-0.855\). The four standardized values are approximately \(-0.855,-0.855,0.656,1.053\). Their sum is approximately zero, allowing for rounding, and their sample standard deviation is approximately one. These are dimensionless values: the original log-CPM scale has been replaced by deviations measured in that feature's sample standard deviations.

Intensity Block: Transform and Filter on Its Own Scale

A log transformation is often suitable for strictly positive intensity measurements when effects are more plausibly multiplicative than additive and variability tends to increase with the mean. The assumption here is that the supplied values are positive, comparable measurements for all four subjects, and that log base 2 is an appropriate working scale. These assumptions should be checked against the assay and its processing; a logarithm cannot be applied directly to zero or negative values.

SubjectIntensity 1Intensity 2Intensity 3
S15121,0244,096
S21,0241,0248,192
S32,0481,0248,192
S44,0961,02416,384

Suppose a feature is retained if its log-scale sample standard deviation is greater than 0.1. This illustrative variability filter removes features that are constant or nearly constant in these subjects; it is not a test of biological relevance. The log2 values are 9, 10, 11, 12 for Intensity 1; 10, 10, 10, 10 for Intensity 2; and 12, 13, 13, 14 for Intensity 3.

Worked Example: Filtering and Scaling an Intensity Feature

Intensity 2 is constant after transformation, so its sample standard deviation is zero and it fails the variability rule. Intensity 1 has mean \((9+10+11+12)/4=10.5\). Its squared deviations sum to \(2.25+0.25+0.25+2.25=5\), so \(s_1=\sqrt{5/3}=1.291\). Its standardized values are approximately \(-1.162,-0.387,0.387,1.162\), and it passes the filter.

Intensity 3 has mean \((12+13+13+14)/4=13\). Its squared deviations sum to \(1+0+0+1=2\), so \(s_3=\sqrt{2/3}=0.8165\), which is greater than 0.1. Its standardized values are approximately \(-1.225,0,0,1.225\). It also passes. The retained intensity block therefore has two features, each centered and scaled independently; the constant feature is not divided by zero.

Pipeline Checks and Documentation

A preprocessing record should make it possible for another analyst to reproduce each resulting matrix. At minimum, record the subject identifiers and row order; the input scale and any prior processing; the transformation and its constants; the filtering criterion and features removed; and the centering and scaling formula. Also report resulting dimensions and concise summaries. For the hypothetical data, the count block goes from four genes to two retained genes, while the intensity block goes from three features to two. Each standardized retained feature has sample mean zero and sample standard deviation one, up to numerical rounding.

The following checks expose common failures before integration:

  • Match alignment: confirm that each row refers to the same subject across blocks. Matching sample counts alone does not prove that row order agrees.
  • Transformation domain: inspect for zeros, negative values, and missing entries before logging. Do not silently add an arbitrary offset to make invalid inputs loggable.
  • Filtering: count how many subjects meet the stated threshold for each feature, and report removals. A threshold applied to raw counts instead of normalized CPM can behave differently when library sizes differ.
  • Scale checks: after standardization, check per-feature means and sample standard deviations. A constant feature has \(s_j=0\) and cannot be standardized this way.
  • Distribution checks: inspect transformed distributions and sample-level summaries. A log does not guarantee normality, remove outliers, or correct batch effects.

The short derivation behind the standardized summaries is direct. Given \(z_{ij}=(y_{ij}-\bar{y}_j)/s_j\), the definition of the sample mean gives \(\sum_i(y_{ij}-\bar{y}_j)=0\), hence \(\bar{z}_j=0\). Also, because \(s_j^2=\sum_i(y_{ij}-\bar{y}_j)^2/(n-1)\), the standardized sample variance is

$$ \frac{\sum_i(z_{ij}-\bar{z}_j)^2}{n-1} = \frac{\sum_i(y_{ij}-\bar{y}_j)^2}{(n-1)s_j^2} =1. $$

This calculation requires \(s_j>0\). It establishes a property of the processed sample, not a population-level guarantee or a statement that all features have equal reliability.

What This Pipeline Does—and Does Not—Equalize

Library-size adjustment for counts, log transformation, feature filtering, and within-block standardization serve different purposes. CPM addresses a particular exposure difference; the log compresses the scale; filtering removes features under a stated rule; and centering and scaling put retained features on a common sample scale. The scaling step can prevent features with large numerical variance from dominating a distance merely because of their units, as discussed in the earlier material on feature scaling and Euclidean distance.

However, unit sample variance for every feature does not imply equal biological importance, equal measurement precision, or equal influence of the two blocks. The blocks still have different numbers and types of features, and their joint influence depends on how they are combined. That separate block-weighting decision should not be hidden inside a preprocessing pipeline. Likewise, a single CPM recipe may be inadequate when composition effects are substantial; a log transform may be inappropriate for some intensity distributions; and filtering based on the same small set of subjects can be unstable. Sensitivity checks using defensible alternative rules can reveal whether downstream conclusions depend on these choices.

Key takeaway: Keep the sequence and rationale explicit: adjust and transform each modality on a defensible scale, filter using documented criteria, then center and scale retained features within their own blocks. Verify matching and summaries before any later integration or weighting.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. A sample has 50 counts for a feature and a library size of 100,000. What is its CPM?
  2. Why can a feature with zero sample standard deviation not be standardized using the usual centered-and-scaled formula?
  3. For a feature with values 2, 4, and 6, calculate its sample mean and sample standard deviation.
  4. After standardizing every feature within each block, can one conclude that the two blocks have equal influence in a combined analysis? Why or why not?
  5. What matching check is needed before processing two blocks with the same number of rows?

Solutions. 1. \((50/100{,}000)\times1{,}000{,}000=500\) CPM. 2. The formula divides by \(s_j\), so \(s_j=0\) makes the division undefined; a constant feature contains no across-subject variation to scale. 3. The mean is \(4\); the squared deviations sum to \(4+0+4=8\), so the sample standard deviation is \(\sqrt{8/2}=2\). 4. No. Standardization gives retained features unit sample variance, but block influence also depends on feature counts, dependence, reliability, and the subsequent integration procedure. 5. Verify subject identifiers and their row order across blocks; equal row counts alone do not establish correspondence.

Clinical Biostats