Why Filter Before Integration?
An omics block may contain thousands of features, but not every feature provides usable information for every analysis. Some are detected in very few samples, barely vary across the study, or have poor technical reproducibility. Retaining such features can add noise, increase computational burden, and make downstream summaries harder to interpret. Filtering is a way to exclude features that fail prespecified criteria for prevalence, variability, or measurement quality.
The goal is not to keep only features that appear biologically interesting. A feature can be low prevalence or low variance and still matter scientifically, particularly if it is relevant to a rare subgroup or a specific hypothesis. Filtering should therefore be based on the assay, study purpose, and data quality—not on an assumption that every retained feature is biologically important. This tutorial treats filtering separately within each omics block because detection and reliability have different meanings across assays.
Prevalence, Variance, and Measurement Quality
Detection prevalence is the fraction of eligible samples in which a feature is detected according to an assay-specific definition. For feature \(j\), let \(d_{ij}=1\) if feature \(j\) is detected in sample \(i\), and \(d_{ij}=0\) otherwise. Its prevalence is \(\hat{p}_j=(1/n)\sum_{i=1}^{n}d_{ij}\). A prevalence rule retains the feature when \(\hat{p}_j\) is at least a chosen threshold \(\tau\).
The detection definition must match the assay and the handling of zeros, limits of detection, and missing values. A recorded zero may represent a genuine zero, a nondetection, or a value substituted for a measurement below a detection limit. These cases are not interchangeable. In particular, a missing measurement should not automatically be counted as a nondetection unless that is justified by the assay and data-processing protocol. The earlier material on zeros and detection limits is relevant when deciding what the indicator \(d_{ij}\) means.
A variance filter retains features whose measured values vary enough across eligible samples to pass a cutoff. For a feature with \(m_j\) observed values \(x_{1j},\ldots,x_{m_jj}\), its sample variance is \(s_j^2=\sum_{i=1}^{m_j}(x_{ij}-\bar{x}_j)^2/(m_j-1)\), where \(\bar{x}_j\) is the mean of those observed values. This calculation is meaningful only when at least two values are observed. Variance depends on the measurement scale, so the transformation and scale on which it is calculated must be stated. A variance cutoff has squared units; it is not a universal constant applicable to every block.
A measurement-quality filter uses technical information to exclude unreliable measurements or features. Possible criteria include the fraction of failed quality-control checks, signal-to-noise criteria, or variability among technical replicates. The criterion must be appropriate to the instrument and assay. For example, a coefficient of variation (CV), defined as the standard deviation divided by the mean and expressed as a percentage, can summarize relative replicate variability when measurements are positive and the mean is meaningfully above zero. CV is not appropriate on every transformed scale.
Choosing and Applying a Rule
A common unsupervised rule is to retain feature \(j\) if its prevalence is at least \(\tau\), its variance is at least \(v_{\min}\), and its quality measure meets a specified limit. Requiring all conditions is an intersection rule: failure of any one condition excludes the feature. This is not the only reasonable rule, but it is easy to audit because each feature’s reason for exclusion can be recorded.
Prevalence thresholds have a discrete consequence. Since the number of detections is an integer, the requirement \(\hat{p}_j\geq\tau\) is equivalent to \(\sum_i d_{ij}\geq\lceil n\tau\rceil\), where \(\lceil a\rceil\) is the smallest integer at least \(a\). This follows by multiplying both sides of \((\sum_i d_{ij})/n\geq\tau\) by \(n\), then taking the smallest integer count that can satisfy the resulting inequality. Thus, a small change in \(\tau\) can change the required count by one and alter retention.
Apply the rule separately within each block, using criteria that make scientific and technical sense for that assay. If samples are paired across blocks, use the intended analysis sample set consistently or clearly state any block-specific exclusions. Do not calculate a variance across samples whose measurements are not comparable because of assay processing or an inappropriate mixture of conditions. Filtering is not a substitute for resolving a serious design or measurement problem.
Identify the samples used for filtering in each block and determine how detections, zeros, and missing values are represented.
Choose prevalence, variance, and quality measures with cutoffs appropriate to the assay, transformation, and study purpose.
Record which features pass each criterion and the reason each excluded feature failed.
Compare retained counts and identities under plausible alternative cutoffs before finalizing the feature set.
Worked Example: Converting a Prevalence Cutoff to a Count
Suppose a hypothetical metabolomics block contains 10 eligible samples. Detection means that a measured value is above the assay’s prespecified detection limit. The rule requires detection prevalence of at least \(\tau=0.70\). Feature A is detected in 8 samples, and Feature B is detected in 6.
The minimum detection count is \(\lceil n\tau\rceil=\lceil10(0.70)\rceil=\lceil7\rceil=7\). Equivalently, Feature A has \(\hat{p}_A=8/10=0.80\), so it passes. Feature B has \(\hat{p}_B=6/10=0.60\), so it fails.
If the cutoff is relaxed to 0.60, the minimum count becomes \(\lceil10(0.60)\rceil=6\), and Feature B passes. If the cutoff is raised to 0.80, the minimum count is 8, so Feature A still passes but a feature detected in 7 samples would no longer pass. The example shows why the cutoff and its implied integer count should both be reported.
Worked Example: Applying a Variance Filter
Consider a hypothetical feature measured on the same transformed scale in five eligible samples, with values \(2,3,3,4,8\) units. Suppose the prespecified rule retains a feature when its sample variance is at least \(v_{\min}=4.0\) squared units, and the feature has enough observed values for the calculation.
The sample mean is \(\bar{x}=(2+3+3+4+8)/5=20/5=4\) units. The sum of squared deviations is \((2-4)^2+(3-4)^2+(3-4)^2+(4-4)^2+(8-4)^2=4+1+1+0+16=22\) squared units. Therefore, \(s^2=22/(5-1)=5.5\) squared units.
Because \(5.5\geq4.0\), the feature passes this variance rule. The conclusion is conditional on the stated scale and sample set: the same feature could have a different variance after a different transformation or with a different set of samples. The cutoff is a filtering choice, not a test of whether the feature has a statistically significant biological effect.
Worked Example: Combining Quality and Prevalence Criteria
A hypothetical assay has 12 eligible study samples and three technical quality-control replicates per feature. A rule retains a feature only if it is detected in at least 9 of the 12 study samples and its CV among positive-scale quality-control measurements is no more than 10%. Feature C is detected in 10 study samples; its QC replicate measurements are 92, 100, and 108 intensity units. Feature D is detected in 11 study samples; its QC replicates are 42.5, 50.0, and 57.5 intensity units.
The prevalence threshold is \(9/12=0.75\). Feature C has prevalence \(10/12=0.8333\), and Feature D has prevalence \(11/12=0.9167\); both pass prevalence. For Feature C, the QC mean is \((92+100+108)/3=100\) units. Its sample standard deviation is \(\sqrt{[(92-100)^2+(100-100)^2+(108-100)^2]/2}=\sqrt{128/2}=8\) units, so its CV is \((8/100)\times100\%=8\%\). It passes the quality criterion.
For Feature D, the QC mean is \((42.5+50.0+57.5)/3=50.0\) units. Its sample standard deviation is \(\sqrt{[(-7.5)^2+0^2+(7.5)^2]/2}=\sqrt{112.5/2}=7.5\) units, so its CV is \((7.5/50.0)\times100\%=15\%\). It fails the quality criterion. Under the stated all-criteria rule, Feature C is retained and Feature D is excluded, despite D’s higher study-sample prevalence.
Threshold Sensitivity, Diagnostics, and Alternatives
A filtering result should be checked, not treated as automatic. For each block, report the initial feature count, the count passing each criterion, the final retained count, and the number excluded for each reason. Compare the final feature set under a small range of plausible cutoffs. A retention table or plot can reveal whether a minor threshold adjustment causes a large change in the number of retained features. When many features lie just above or below a cutoff, membership may be sensitive even if the total count changes little.
Also inspect whether detection or exclusion is concentrated in particular groups, batches, or sample types. A feature may appear low-prevalence because it is detected only in one scientifically relevant subgroup. Conversely, high overall prevalence can conceal failed detection in a subset of samples. If detection is associated with a technical batch, a prevalence filter may remove features because of batch-specific measurement failure rather than biological irrelevance. These patterns are diagnostic signals to investigate, not reasons to change a threshold after seeing a desired result.
Several alternatives answer different questions. A prevalence filter is useful when measurements are too sparse for reliable downstream use; a variance filter removes near-constant features on the specified scale; a quality filter addresses technical reliability. These criteria can be combined, but none is a substitute for the others. Selecting features by association with an outcome is supervised feature selection, not an unsupervised low-information filter. If prediction performance is evaluated by cross-validation, any outcome-informed selection—and any data-derived filtering rule—must be estimated using the training data in each split and then applied to the held-out data. Otherwise, information from the held-out observations can leak into model development.
Filtering has limits. A fixed variance threshold is scale-dependent, can be strongly influenced by outliers, and may discard useful features with small but reproducible changes. A prevalence threshold can exclude rare features relevant to a targeted biological question. Quality-control replicates may not represent all sources of variation in study samples. No single cutoff is universally optimal, and filtering cannot correct poor measurement, inappropriate sample matching, or confounding. Preserve a record of the criteria and consider sensitivity to reasonable alternatives.
Common Pitfall
A common mistake is to treat every recorded zero as a failed detection and then apply one prevalence cutoff across all blocks. The reasoning is that zero means “not measured,” so low nonzero frequency must indicate an uninformative feature. The correction is to establish what zero represents for each assay before defining detection. A zero may be a genuine measured value, a censored value, or a placeholder for missingness; these meanings imply different prevalence calculations. Likewise, a cutoff appropriate for one assay does not automatically transfer to another.
Another mistake is to describe a feature that fails a filter as biologically irrelevant. Filtering establishes only that the feature did not meet the specified operational criterion in the analyzed data. It does not prove the feature has no biological role or no association with an outcome.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- In a block with 18 eligible samples, how many detections are required to meet a prevalence threshold of 0.75?
- A feature has sample variance 2.4 squared units and a stated variance cutoff of 3.0 squared units. Does it pass that criterion? What important context should accompany this result?
- Why might a feature detected in only a small fraction of all samples still deserve attention?
- In a prediction study using cross-validation, why can selecting features using the full data set before creating folds produce optimistic performance estimates?
Solutions. (1) The required count is \(\lceil18(0.75)\rceil=\lceil13.5\rceil=14\) detections. (2) It does not pass because \(2.4<3.0\). The variance scale, eligible sample set, and prespecified cutoff should be stated; the result alone does not establish biological irrelevance. (3) The feature may be genuinely rare, or detection may be concentrated in a scientifically important subgroup. Its assay-specific detection meaning should be checked before exclusion. (4) Full-data selection uses information from observations that later appear in held-out folds. The held-out data are then no longer independent of feature selection, which can make performance appear better than it would be on new data. Feature selection and other data-derived rules should be fitted within each training fold.