Tutorials › Multi-Omics Data Integration › Mapping Subjects to Assays in Matched Studies

Study Designs for Integration · Tutorial 21 of 597

Mapping Subjects to Assays in Matched Studies

Build correspondence tables that preserve the links among subjects, collection events, specimens, aliquots, and assay records, and check that those links are verifiable.

Intermediate 10 min read

What You'll Learn

  • Distinguish subject, collection event, specimen, aliquot, and assay-record identifiers.
  • Choose a row unit that preserves repeated specimens and assay measurements.
  • Construct a correspondence table for matched molecular layers.
  • Check identifier uniqueness, link coverage, and consistency across source tables.
  • Recognize what a correspondence table can establish—and what it cannot.

Why correspondence is a design requirement

A matched study is only interpretable as matched when the records show which measurements belong together. A DNA-sequencing row and a protein-assay row may both be present in the study, but their coexistence does not establish that they came from the same person, collection visit, or tissue. Those links must be encoded and verifiable. A correspondence table makes the links explicit before integration or analysis.

The task is not simply to put a subject identifier beside every data row. A subject may contribute specimens at several visits, several tissue types, or multiple aliquots, and one specimen may generate more than one assay record. A useful table preserves these distinctions rather than flattening them into a single ambiguous “sample” label. This complements the earlier material on subjects, assays, and cohorts as design units and on matched and unmatched omics sampling.

Definition: A subject-to-assay correspondence table is a record of explicit links from each assay observation or assay input to its source aliquot or specimen and, ultimately, to the subject from whom it was collected. When relevant, it also records the collection event, such as visit, time point, tissue, or anatomical site. The table documents the sampling structure; it does not itself establish that the biological measurements are comparable or that an analysis is valid.

Choose the row unit before assembling the table

A correspondence table needs a declared row unit. A practical choice is one row per assay input or per distinct assay record, depending on the data source. If a specimen is split into two aliquots and each is measured, that choice may produce two rows. If the same aliquot is measured in two runs, it may produce two assay-record rows. These are not necessarily two independent biological samples: they may be technical replicates of the same source material.

Keep identifiers for different levels separate. A subject identifier names a person or other biological subject; a collection-event identifier distinguishes that subject’s sampling occasions; a specimen identifier names collected material; an aliquot identifier names a portion prepared from that material; and an assay-record identifier names a measurement input or run-level record. Assay type identifies the molecular layer or measurement method, not an individual observation. The precise levels needed depend on the study, but a link should not be represented by an identifier whose meaning changes across files.

Key definition: A link key is an identifier, or combination of identifiers, that joins records at a specified level. For example, a specimen identifier can connect a collection log to a specimen inventory, while an aliquot identifier can connect that inventory to an assay-input table. A key must be defined at the level it identifies and must be unique within the relevant table when it is used as a record key.

A core correspondence table commonly includes the following fields. Not every study needs every field, but omitted levels should be a deliberate design choice rather than an accidental loss of traceability.

  • subject_id: the study’s pseudonymous subject identifier;
  • collection_event_id and visit or collection time: the occasion on which material was obtained;
  • specimen_id: the collected material, with specimen type, tissue, or anatomical site where applicable;
  • aliquot_id: the portion of a specimen supplied to a particular assay;
  • assay_record_id and assay_type: the measurement record and its molecular layer or platform;
  • run_id or batch identifier, when measurements are recorded by run or batch;
  • replicate_type: for example, biological, extraction, or technical replicate, when such distinctions apply.

Representing matched links without collapsing repeated sampling

For a simple design with one collection event and one assay input per subject per layer, rows can show the corresponding inputs side by side. For more complex designs, a long table—one row per assay input or assay record—is usually safer: a subject can then have as many rows as the sampling and measurement structure requires. The correspondence can be formalized as a relation \(R\) whose rows contain the identifiers for an assay record and its linked biological source. The relation need not be one-to-one: one subject can map to many events, specimens, aliquots, and assay records.

$$ R = \{(\text{subject\_id},\ \text{collection\_event\_id},\ \text{specimen\_id},\ \text{aliquot\_id},\ \text{assay\_record\_id},\ \text{assay\_type})\} $$

The table should preserve keys that permit a reader to follow each row back through the source records. It should also distinguish a biological replicate from repeated measurement of the same material. Otherwise, a later analyst could mistake multiple technical records for multiple subjects or collection events. A wide layout can be convenient for a narrowly defined one-to-one matched set, but it is a poor default when the number of specimens or records differs across layers.

Worked Example: Linking Two Assays From the Same Collection

Suppose a hypothetical study collects blood from subjects S014 and S027 at visit V1. Each blood specimen is divided into a plasma aliquot for a protein assay and a cellular aliquot for an RNA assay. The intended match is at subject and visit: the two assay inputs for a subject must trace to that subject’s V1 collection, though they are different aliquots and specimen fractions.

subject_idevent_idspecimen_idaliquot_idassay_record_idassay_type
S014S014-V1SP101AL101-PPR201Protein
S014S014-V1SP101AL101-CRN301RNA
S027S027-V1SP102AL102-PPR202Protein
S027S027-V1SP102AL102-CRN302RNA

There are four assay-input records, two subjects, and two assay types. To check the intended matching, group records by subject_id and event_id. S014-V1 has one protein and one RNA record; S027-V1 also has one of each. The match is therefore supported at the subject-and-event level. The distinct aliquot identifiers show that the assays did not use the same physical aliquot. The table does not prove that either assay succeeded; that requires checking assay-level quality and status records.

Worked Example: Preserving Multiple Specimens per Subject

In a hypothetical longitudinal study, subject S031 provides a plasma specimen at baseline and another at week 8. Each specimen has one aliquot measured by the same metabolomics platform. These two records belong to one subject but different collection events.

subject_idevent_idcollection_timespecimen_idaliquot_idassay_record_idassay_type
S031E401BaselineSP401AL401MT501Metabolomics
S031E402Week 8SP402AL402MT502Metabolomics

The subject count is one, the collection-event count is two, and the assay-record count is two. These counts answer different questions. If the two rows were collapsed to one row per subject, the timing distinction would be lost. If the assay records were treated as two subjects, the study’s biological sample count would be overstated. The separate event, specimen, and assay identifiers preserve the structure needed to interpret each measurement.

Verification: keys, coverage, and consistency

A correspondence table is useful only if its links can be checked. Start by specifying which identifiers should be unique in each source table. For example, each assay_record_id should identify one assay record; each specimen_id should identify one specimen; an event_id should identify one collection event within a subject. If event identifiers are only unique within subjects, use the combination \((\text{subject\_id},\text{event\_id})\) as the event key. Do not assume a field is globally unique merely because values look different in a small extract.

Then check that every assay record has exactly one intended source link, unless the assay design explicitly permits otherwise. Check that each linked specimen exists in the specimen inventory, each specimen belongs to the stated subject and event, and each aliquot belongs to the stated specimen. Compare the assay-record identifiers in the correspondence table with those in the assay data: records present in one but absent in the other need an explanation, such as a failed run or a data export filter. A missing link is not the same as a missing molecular measurement; the two should be recorded separately.

A simple coverage summary can be defined for a layer \(a\) and a declared set \(S\) of eligible subjects. Let \(m_{ia}=1\) if subject \(i\) has at least one valid, linked assay record for layer \(a\) at the specified event or events, and \(m_{ia}=0\) otherwise. The layer’s subject-level link coverage is the number of eligible subjects with a valid link divided by the number of eligible subjects:

$$ \text{Coverage}_a = \frac{\sum_{i \in S} m_{ia}}{|S|} $$

The eligibility set and the event definition must be stated. Counting assay rows instead of subjects can inflate coverage when some subjects have repeated specimens or runs. Likewise, having a linked record does not imply that the measurement passed quality control or that the feature table contains observed values for every feature.

Worked Example: Auditing Link Coverage

Consider a hypothetical study with four eligible subjects, S1 through S4, at visit V1. The correspondence table contains one linked protein assay record for S1, S2, and S4; S3 has no protein record. S2 also has a second technical run. All listed records have valid subject, event, specimen, and aliquot links.

For subject-level coverage, count each eligible subject once. Thus \(m_{1a}=1\), \(m_{2a}=1\), \(m_{3a}=0\), and \(m_{4a}=1\). The numerator is \(1+1+0+1=3\), and the denominator is \(|S|=4\).

$$ \text{Coverage}_a = \frac{3}{4} = 0.75 = 75\% $$

The linked protein-assay coverage at V1 is 75% of eligible subjects. There are four assay records if S2’s second run is included, but four is not the coverage numerator: the numerator is three subjects. This calculation describes link coverage only. It does not certify that the assay records passed quality checks or that the three subjects have complete feature measurements.

Short justification: why the links must be explicit

Suppose an analysis needs to pair two assay records at the same subject and event. If the correspondence table contains a verified subject-event key for each record, the analyst can join records on that key and inspect whether each pair is unique. If only subject identifiers are available, two records from different visits can be joined as if they were a match. If only assay-row order is available, the match depends on an unstated ordering that can change when files are sorted or filtered. Explicit keys therefore make the intended match reproducible and testable; they do not guarantee that the underlying labels were entered correctly, so source checks remain necessary.

Diagnostics, alternatives, and limitations

Useful warning signs include repeated values in a field expected to be unique, assay records with no source specimen, specimens linked to different subjects in different files, and unexpectedly large row counts after a join. A join on a non-unique key can multiply records: if one subject has two events in one table and three records in another, joining only on subject can produce six combinations, not three verified matches. Check row counts before and after joins and inspect the keys responsible for any increase. Also compare the table’s declared event, tissue, and specimen definitions with collection documentation.

There are several reasonable storage choices, but they serve different purposes:

RepresentationUseful whenMain risk
Long correspondence table, one row per assay input or recordSubjects contribute repeated events, specimens, aliquots, or runsRequires careful definition of the row unit and record key
Wide table, one row per subject-event with layer-specific columnsThere is a clear one-to-one input per layer at the chosen levelRepeated inputs may require arbitrary suffixes or be collapsed
Separate linked tables for subjects, events, specimens, aliquots, and assaysThere are many records or several source systemsLinks are harder to inspect unless keys and join rules are documented

A long table is often easiest to audit, while a set of linked tables can reduce repeated metadata in larger data systems. A wide table is convenient for some downstream tasks, but should be constructed from verified links rather than used as the only record of a complex sampling design. Regardless of format, document key definitions, allowable missing identifiers, and the meaning of replicate labels.

Correspondence records establish provenance and sampling structure, not biological equivalence. Two assays linked to the same subject may use different tissues, collection times, or aliquots; whether those are an appropriate match depends on the scientific question. A link also cannot resolve uncertain identity, repair an incorrectly recorded identifier, or show that a feature was detected. Where identifiers are missing or ambiguous, mark the link as unresolved rather than silently inferring it from row order or apparent similarity. Subject identifiers should be pseudonymous in analysis files, with access to any re-identification key governed separately.

Common mistake: “Both assay files have one row per person, so row 12 in each file must be the same subject.” Row order is not a link key and can change after sorting, filtering, or export. Join records using documented subject and event identifiers, then verify specimen and aliquot links where needed. If those identifiers are absent, the match is not established by the data as presented.

The central limitation is that a correspondence table can make a design auditable without making it complete. It may reveal that a layer lacks records for some subjects or events, but choosing how to plan a complete-pair study is a separate design decision. Nor should technical repeats be counted as extra subjects: correspondence is the evidence needed to distinguish repeated measurement from repeated biological sampling.

Check Your Understanding

Answer using the stated row units and identifiers. Brief solutions follow the questions.

  1. A subject contributes a specimen at baseline and another at week 4. Which identifiers are needed to preserve the distinction if both are assayed?
  2. Three assay records belong to one subject: two runs use the same aliquot, and a third uses a different aliquot from the same specimen. How many subjects, specimens, aliquots, and assay records are represented?
  3. Four eligible subjects have valid links for an assay layer, but one subject has two linked runs. If all four subjects are represented, what is subject-level link coverage?
  4. Why is joining two assay tables by subject identifier alone potentially wrong in a repeated-visit study?
  5. What should be done when an assay record has no verifiable specimen link?

Solutions. (1) Retain the subject identifier, distinct collection-event or visit identifier, specimen identifier, and assay-record identifier; include aliquot identifiers if the inputs differ. (2) One subject, one specimen, two aliquots, and three assay records. The two runs from one aliquot remain distinct records but do not create additional biological subjects or aliquots. (3) Coverage is \(4/4=100\%\), because each eligible subject is counted once, regardless of the extra run. (4) The subject may have records from multiple visits, so a subject-only join can pair measurements from different events or multiply rows. Join on the documented subject-event key and verify the intended source links. (5) Mark the link as unresolved or missing and investigate the source records; do not infer it from row order or silently assign a specimen.

Clinical Biostats