Why Gene Size Can Bias Enrichment
A gene-level association score may summarize evidence from all variants assigned to a gene. If the score is the smallest variant p-value, the largest test statistic, or a sum of variant statistics, then genes with more tested variants have more opportunities to accumulate an extreme score. As a result, a pathway containing many large or densely tested genes can appear enriched even when its genes have no stronger underlying association than comparable genes outside the pathway.
“Gene size” has at least two related meanings. Genomic length is the span of a gene on the genome. Variant count is the number of variants actually tested or assigned to that gene. Length can affect how many variants fall within a gene, but the two are not interchangeable: coverage, variant filtering, imputation, allele frequency, and the mapping rule also influence the tested count. For bias adjustment, it is often useful to record both.
The concern carries into enrichment analysis. A competitive analysis asks whether scores for genes in a set differ from scores for genes outside it. If set membership is associated with gene size, and size is associated with the score, an apparent set difference may reflect unequal testing opportunity rather than a pathway-specific association pattern. A self-contained analysis asks whether genes within a set show evidence against a specified null; its interpretation can also be distorted if the gene-level scores are not calibrated comparably across genes.
How More Variants Produce More Extreme Scores
Suppose each of \(m\) variants in a gene has a valid null p-value, and the gene score is the smallest of those p-values. If the variant p-values are independent and uniform under the null, the probability that the minimum is at most \(t\) is
The independence assumption makes this a simple illustration, not a general description of variant data. Under it, the chance of at least one p-value below 0.05 is \(1-0.95^m\): about 0.401 for \(m=10\), and about 0.994 for \(m=100\). Thus the same “best” p-value is less surprising for a gene tested at many variants than for a gene tested at only a few.
Other aggregation rules can have size dependence too. For example, if a score is the sum of \(m\) variant statistics, its null expectation will generally increase with \(m\) unless the score is appropriately scaled or calibrated. Dividing by \(m\) may remove a simple increase in the mean, but it does not automatically give comparable uncertainty or account for dependence among variants. The specific gene-scoring rule therefore matters: size adjustment should be chosen for the score being analyzed, not applied as a generic afterthought.
Worked Example: Comparing Minimum P-Values Across Different Variant Counts
Suppose two hypothetical genes have minimum variant p-values \(p_{\min}=0.0012\) for Gene A, which had \(m=80\) variants tested, and \(p_{\min}=0.0090\) for Gene B, which had \(m=8\) variants tested. A simple family-wise Bonferroni adjustment for each gene is \(p_B=\min(1,mp_{\min})\).
For Gene A:
For Gene B:
The raw minimum p-value is smaller for Gene A, but its Bonferroni-adjusted value is larger. This illustrates how a more extreme minimum can result from more testing opportunities. Bonferroni adjustment controls the family-wise error rate when the individual p-values are valid, regardless of their dependence, though it can be conservative. These calculations are not a complete pathway test: they only illustrate a simple way to calibrate a within-gene minimum-p summary.
Adjustment Using Gene-Size Covariates
One direct approach is to model the gene-level score as a function of pathway membership and size covariates. Let \(Y_g\) be the score for gene \(g\), \(A_g=1\) if that gene belongs to the pathway and \(A_g=0\) otherwise, \(L_g\) its genomic length, and \(m_g\) its number of tested variants. A basic adjusted regression is
Here, \(\beta_A\) is the difference in expected score between pathway and non-pathway genes with the same modeled length and variant count. If larger \(Y_g\) means stronger association evidence, a positive \(\beta_A\) indicates higher scores for pathway genes after this adjustment. The coefficient is an adjusted association, not a causal effect of pathway membership. Its units are the units of \(Y_g\) per change from non-membership to membership.
The model requires more than entering two covariates into a regression. The score must be defined consistently across genes, and the relationship between score and size should be adequately represented by the chosen model. A log transformation can be useful when counts and lengths are strongly right-skewed, but it does not guarantee a linear relationship. Residual patterns or comparisons across size strata can reveal whether a linear term is inadequate. If length and variant count are strongly correlated, their separate coefficients may be imprecise; the analysis may need a simpler or otherwise justified representation of size.
Ordinary regression inference also relies on an appropriate error model. In particular, standard errors from a simple regression presume a suitable model for residual variation and independence across observations. Gene scores can be correlated when genes share genomic evidence; that dependence can affect uncertainty even if size adjustment improves comparability. A coefficient estimate alone does not verify these assumptions or guarantee calibrated p-values.
Worked Example: Interpreting a Size-Adjusted Membership Coefficient
Consider six hypothetical genes with a gene-level score \(Y_g\), where higher values indicate stronger evidence. For illustration, let \(A_g\) indicate pathway membership and let \(x_g\) be a centered size covariate that increases with gene size. The values are deliberately balanced so that both membership groups have the same distribution of \(x_g\).
| Gene | Pathway membership \(A_g\) | Size covariate \(x_g\) | Score \(Y_g\) |
|---|---|---|---|
| C1 | 0 | 0 | 2 |
| C2 | 0 | 1 | 3 |
| C3 | 0 | 2 | 4 |
| P1 | 1 | 0 | 3 |
| P2 | 1 | 1 | 5 |
| P3 | 1 | 2 | 7 |
Fit the illustrative model \(Y_g=\beta_0+\beta_A A_g+\gamma x_g+\varepsilon_g\). The mean score among pathway genes is \((3+5+7)/3=5\), and the mean among non-pathway genes is \((2+3+4)/3=3\). Because the two groups have the same mean size covariate, \(\bar{x}=1\), the membership indicator is balanced with respect to \(x\). In this balanced design, the fitted membership coefficient is the difference in group means:
Thus, in this toy model, pathway genes have scores averaging 2 units higher than non-pathway genes at the same modeled size. This is a coefficient interpretation, not evidence of statistical significance: six illustrative observations do not establish a reliable standard error or a general pathway effect. In a real analysis, the score units, the size adjustment, the model fit, and the uncertainty calculation all need to be reported.
Matched-Gene Comparisons
A second approach is to compare pathway genes with non-pathway genes that have similar lengths and tested-variant counts. For each pathway gene, choose one or more eligible comparison genes using size information, then compare their scores. A paired difference is \(D_i=Y_{P,i}-Y_{C,i}\), where \(Y_{P,i}\) is the pathway-gene score and \(Y_{C,i}\) is the matched comparison score. The mean paired difference summarizes the score contrast among these matched pairs.
Matching makes the comparison more explicit: each pathway gene is evaluated against genes with similar opportunities to accumulate evidence. It also changes the target of the comparison. The result describes pathway genes relative to the available non-pathway genes that could be matched, not necessarily relative to every gene in the genome. Matching does not by itself make the pathway and comparison groups exchangeable, nor does it remove unmeasured differences or dependence between scores. Matching variables, matching rules, unmatched genes, and the method used to quantify uncertainty should be reported.
Worked Example: Comparing Matched Genes
Suppose four hypothetical pathway genes are each matched to one non-pathway gene with similar genomic length and tested-variant count. Their scores use the same scale, on which larger values mean stronger evidence.
| Matched pair | Pathway score | Comparison score | Difference |
|---|---|---|---|
| 1 | 4.2 | 3.5 | 0.7 |
| 2 | 2.8 | 2.4 | 0.4 |
| 3 | 1.9 | 2.1 | -0.2 |
| 4 | 3.1 | 2.8 | 0.3 |
The mean difference is
In these four matched pairs, the pathway genes’ scores average 0.300 units higher than their matched comparison scores. This descriptive contrast is modest and includes one negative pair. It does not alone show that the pathway is enriched: an inferential conclusion requires a suitable uncertainty procedure, and the small example cannot support a reliable one. Matching on size makes the comparison fairer with respect to the matched variables, but does not prove that size is the only relevant difference.
Choosing and Checking an Adjustment
Covariate adjustment and matching address the same central concern in different ways. Regression can retain many genes and estimate a conditional contrast across the modeled size range. Matching creates direct comparisons but may discard genes without suitable matches and may describe a narrower population. Neither method repairs a gene score whose null distribution is fundamentally miscalibrated; when possible, calibrate the gene-level statistic itself for the number of variants tested before comparing genes.
A practical analysis should examine whether pathway membership is associated with gene length or variant count, and whether the gene score changes systematically with either measure. It should also check whether the pathway and comparison genes overlap in size. If nearly all pathway genes are much larger than all other genes, a regression coefficient relies on extrapolation rather than like-for-like comparison. A size-stratified summary or a matched analysis may make this lack of overlap more visible, but cannot create information where comparable genes are absent.
Gene length and variant count may also represent genuine biological characteristics of a pathway. Adjustment is not automatically “better” simply because it removes a size association. The question is whether the target is pathway enrichment beyond unequal testing opportunity. If so, adjustment is relevant; if the scientific question includes the pathway’s tendency to contain large genes, adjustment changes the estimand and should be described as such.
Common Mistakes
- Comparing minimum p-values as if every gene had the same number of tests. A gene with more variants has more opportunities for a small minimum. Calibrate or adjust for testing opportunity, or compare genes with similar variant counts.
- Using genomic length as a perfect substitute for tested-variant count. Length is only a proxy. Record and consider the actual number of tested variants when it is available.
- Assuming a size covariate guarantees valid inference. The score-size relationship may be nonlinear, the groups may lack size overlap, and standard errors may not reflect dependence among genes.
- Interpreting an adjusted coefficient as a causal effect. It is a conditional score contrast under the model, not evidence that pathway membership causes stronger association.
- Concluding that large genes are biologically unimportant after adjustment. Adjustment addresses comparability of statistical evidence; it does not decide the biological relevance of gene size.
Check Your Understanding
Use the definitions and examples above to check your reasoning.
- Under independent uniform null p-values, what is the probability that at least one of \(m\) tested variants has a p-value at most \(t\)?
- Why might genomic length and the number of tested variants differ for the same gene?
- In a regression of gene score on pathway membership and size covariates, what does the pathway-membership coefficient represent?
- What does matching pathway genes to non-pathway genes on length and variant count improve, and what does it not guarantee?
- Why can a size-adjusted analysis answer a different scientific question from an unadjusted analysis?