Why Represent Pathways With a Matrix?
A pathway database typically records membership as a collection of lists or pairs: a pathway identifier and a molecular entity assigned to it. Multi-omics models, however, need biological annotations to line up with the features whose effects or measurements the model represents. A feature-to-pathway matrix makes that alignment explicit. Each row refers to a model feature, each column refers to a pathway, and each entry records whether that feature belongs to that pathway.
The matrix is a structured encoding of knowledge, not a probability distribution and not a model by itself. Its meaning depends on the feature definition, the pathway source, and the identifier-mapping decisions used to construct it. In particular, pathway memberships can overlap: the same feature may have a nonzero entry in several pathway columns.
This convention is important because some databases or software use the transpose: pathways as rows and features as columns. Either convention can be used, but dimensions and interpretation must be stated, and a matrix must be transposed when passed to software that expects the other orientation. Here, \(B\) always has features in rows and pathways in columns.
Aligning Identifiers Before Building the Matrix
A pathway record may use a gene symbol, a stable gene identifier, a protein identifier, or another database-specific label. The model may use a different identifier system or a different feature level. Before filling entries of \(B\), define exactly what one model feature represents and map pathway records to that feature set. For example, a gene-level pathway annotation does not automatically identify which transcript-level measurements should receive that annotation; the mapping must follow the chosen model’s feature definition.
A defensible mapping process uses a documented identifier reference appropriate to the feature type and organism. It preserves the original identifiers and the mapped identifiers, records unmapped records, and checks whether any source identifier maps to more than one model feature. If a mapping is ambiguous, do not silently select one target or duplicate membership across targets. Resolve the ambiguity using an explicit rule, or leave it unresolved and report it. Likewise, do not treat a feature with no pathway record as a member of a pathway; it receives a row of zeros for the pathway set under consideration.
The construction assumes that the selected pathway records refer to the intended organism and the relevant feature level, that the identifier mapping is appropriate, and that the chosen pathway names identify distinct columns. A binary matrix also assumes that the task needs membership presence or absence: it does not encode evidence strength, direction of regulation, or the biological importance of a membership.
Worked Example: Mapping Records to Model Features
Suppose a hypothetical model has five gene-level features, identified by stable IDs \(G101\), \(G205\), \(G330\), \(G410\), and \(G999\). A pathway source uses symbols. A documented lookup maps symbol \(A\) to \(G101\), \(B\) to \(G205\), \(C\) to \(G330\), and \(D\) to \(G410\). In this hypothetical example, the source records are: pathway \(P_\alpha\) contains \(A\) and \(B\); \(P_\beta\) contains \(B\) and \(C\); and \(P_\gamma\) contains \(D\).
After mapping, the model features are the rows and the three selected pathways are the columns. Feature \(G999\) has no matching membership record, so it is retained as a model feature with zeros in these columns.
For example, the second row is \((1,1,0)\) because \(G205\), mapped from symbol \(B\), appears in \(P_\alpha\) and \(P_\beta\) but not \(P_\gamma\). The matrix has five rows and three columns, matching the five model features and three chosen pathways. \(G999\)'s zero row means only that it has no recorded membership in this selected pathway set; it does not establish that the feature is biologically irrelevant.
Overlapping Memberships and What the Products Count
Overlapping memberships are represented directly, not by assigning each feature to just one pathway. For an incidence matrix, the sum of row \(j\) is the number of selected pathways containing feature \(f_j\), and the sum of column \(k\) is the number of model features recorded in pathway \(p_k\). These counts help check the encoding, although their values depend on the selected feature and pathway sets.
The products \(B^\mathsf{T}B\) and \(BB^\mathsf{T}\) have useful counting interpretations. For pathways \(p_k\) and \(p_\ell\), the \((k,\ell)\) entry of \(B^\mathsf{T}B\) counts the model features that belong to both. For features \(f_j\) and \(f_r\), the \((j,r)\) entry of \(BB^\mathsf{T}\) counts the selected pathways shared by those features. These are counts induced by the binary memberships; they are not probabilities or normalized similarities.
To see why the first interpretation holds, matrix multiplication gives the \((k,\ell)\) entry as a sum over feature rows. Each product in the sum equals one exactly when that feature belongs to both pathways.
Thus the diagonal entry \((B^\mathsf{T}B)_{kk}\) is the number of model features in pathway \(p_k\), because \(B_{jk}^2=B_{jk}\) for binary entries. An off-diagonal entry is the overlap count. The same reasoning applied to rows gives the feature-pair interpretation of \(BB^\mathsf{T}\).
Worked Example: Counting Shared Pathway Members
Consider four hypothetical features and three pathways, with memberships shown below. Each feature belongs to one or two pathways.
The pathway membership counts are the column sums: \(P_1\) contains two features, \(P_2\) contains two, and \(P_3\) contains two. For the overlap matrix, each diagonal is therefore 2. Pathways \(P_1\) and \(P_2\) share feature \(f_2\); \(P_2\) and \(P_3\) share \(f_3\); \(P_1\) and \(P_3\) share none. Hence
For instance, the \((1,2)\) entry is \(1\cdot0+1\cdot1+0\cdot1+0\cdot0=1\), while the \((1,3)\) entry is \(1\cdot0+1\cdot0+0\cdot1+0\cdot1=0\). The row sums of \(B\) are \(1,2,2,1\): they show that \(f_2\) and \(f_3\) have overlapping memberships, rather than being forced into a single pathway. No pathway overlap has been normalized in this calculation.
Choosing the Matrix That Matches the Model
The row index must correspond to the feature index used by the model component that will receive pathway information. If the model has separate transcript, protein, and metabolite features, a single matrix is appropriate only if its rows span that combined feature set and the pathway database supports the required mappings for each feature type. Otherwise, construct a separate matrix for each layer, with explicit row order, and retain the layer labels. A gene annotation should not be assigned to a metabolite merely because the two have a related biological role.
If a model uses a subset of features, construct or subset the matrix using that exact ordered feature list. Reordering the rows without applying the same reordering to the model’s feature vector misaligns the annotation, even when the dimensions still match. The same principle applies to columns: pathway labels must remain attached to their columns whenever a pathway subset is selected or reordered.
For a binary incidence matrix, row-normalizing a feature with multiple memberships changes the entries from membership indicators into fractional allocations. For example, replacing two ones in a row by two values of \(1/2\) preserves a row sum of one but no longer says that the feature is a member of each pathway with an indicator value of one. Such a transformation may be useful for a specifically defined model input, but it is a different encoding and should be named and justified as such. The incidence matrix itself should not be silently normalized.
Worked Example: Comparing Binary and Row-Normalized Encodings
Use the four-feature matrix from the preceding example. Feature \(f_2\) belongs to both \(P_1\) and \(P_2\), so its incidence row is \((1,1,0)\). If the intended input instead allocates a total row weight of one equally across that feature’s two memberships, the transformed row is \((1/2,1/2,0)\). Feature \(f_1\), which belongs only to \(P_1\), remains \((1,0,0)\).
For the transformed row, the sum is \(1/2+1/2+0=1\); for the original incidence row, it is \(1+1+0=2\). The first representation records two memberships; the second assigns a total unit allocation across those memberships. They answer different questions. Unless the model’s definition calls for that allocation, keep the original binary entries and preserve the overlapping memberships.
This calculation also illustrates why normalizing columns instead would make a different change: it would scale memberships according to pathway size rather than distribute each feature’s total weight across its pathways. Neither operation follows automatically from the meaning of pathway membership.
Diagnostics, Alternatives, and Limitations
Before using the matrix, check both its bookkeeping and its biological interpretation. Confirm that its dimensions are \(m \times K\), that row and column labels are unique and ordered as expected, and that each nonzero entry can be traced to a mapped source record. Review unmatched identifiers, ambiguous mappings, duplicate source records, all-zero rows, and all-zero columns. All-zero rows can be legitimate, but may also reveal a failed identifier conversion. A pathway column with no members in the model’s feature set may be outside the analysis’s effective coverage.
Also inspect the distribution of row and column sums. An unexpectedly large row sum can indicate duplicated or overly broad mappings; an unexpectedly large pathway column can reflect a broad pathway definition or an identifier problem. These checks flag issues for review; they do not prove that the underlying biology is wrong. Keep the source, version, organism, mapping procedure, selected pathways, and exclusions with the matrix so the representation can be reproduced.
A long table of feature–pathway pairs is often preferable for storing or auditing records: it keeps each membership explicit and is convenient when the matrix is sparse. The incidence matrix is often more convenient for calculations that require a fixed feature order and pathway columns. The two formats can encode the same binary memberships if the same mapping and feature universe are used. Neither format repairs incorrect annotations or resolves identifier ambiguity.
A binary matrix also has deliberate limits. It does not express confidence in a membership, activation or inhibition, pathway direction, or causal influence. It cannot show whether two pathways are biologically independent, and a zero means “no recorded membership in this selected database representation,” not necessarily “not involved.” The earlier material on network and kernel fusion concerns similarity representations; a feature-to-pathway incidence matrix instead encodes annotated feature membership. Confusing these objects changes what the entries mean.
Common Mistakes
- Forcing disjoint membership. Wrong reasoning: each feature must be assigned to one pathway so every row has at most one one. Correction: pathways can overlap; retain all supported memberships in the row.
- Assuming an absent record proves biological absence. Wrong reasoning: a zero means the feature is not involved in that pathway. Correction: it means the selected source and mapping provide no recorded membership for that feature and pathway.
- Ignoring feature order. Wrong reasoning: matching matrix dimensions guarantees alignment. Correction: verify row labels and their order against the model’s feature index, and verify pathway labels against column order.
- Silently resolving ambiguous identifiers. Wrong reasoning: choose a plausible target or copy the record to every target. Correction: document and apply an explicit resolution rule, or leave the record unresolved.
- Calling an incidence matrix a prior distribution. Wrong reasoning: entries of zero and one are probabilities that a feature belongs to a pathway. Correction: they are membership indicators; a probability model requires additional specification.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A feature belongs to pathways \(P_1\) and \(P_3\), but not \(P_2\). What is its row in a binary feature-to-pathway matrix whose columns are ordered \(P_1,P_2,P_3\)?
- For two pathway columns \(k\) and \(\ell\), what does \((B^\mathsf{T}B)_{k\ell}\) count?
- A pathway source identifier maps ambiguously to two model features. Why is silently copying the membership to both rows problematic?
- Suppose a feature has no recorded membership in the selected pathway set. What does its all-zero row establish, and what does it not establish?
- A matrix has six feature rows and four pathway columns. The model’s feature vector has the same six entries but in a different order. Is the matrix aligned? What check is needed?
Solutions. (1) The row is \((1,0,1)\), because columns follow the stated pathway order. (2) It counts features recorded in both pathways; for \(k=\ell\), it counts features in that pathway. (3) Copying creates two memberships without evidence that the source record applies to both model features and can inflate pathway counts. Resolve the mapping with a documented rule or leave it unresolved. (4) It establishes that no membership was recorded for that feature in the selected, mapped pathway set. It does not establish biological non-involvement. (5) No. Compare the row labels and order directly with the model’s feature index, and reorder one representation consistently before use.