Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Representing Chromatin Accessibility Counts

CITE-seq, ATAC and Multiome Data · Tutorial 601 of 700

Representing Chromatin Accessibility Counts

Learn how ATAC-seq feature granularity and count encoding shape cell distances, and how to preserve interpretable, paired representations for downstream joint analyses.

Advanced 11 min read

What You'll Learn

  • Distinguish fragment counts, binary peak indicators, and broader region-by-cell features.
  • Calculate Euclidean and Jaccard distances and explain what each emphasizes.
  • See why binarizing counts can remove depth and magnitude information.
  • Assess how merging peaks into regions changes cell-to-cell similarity.
  • Identify representation choices that can distort paired multimodal analyses.

Why the Representation Matters

An ATAC-seq experiment produces fragment observations at genomic coordinates, but most analyses compare cells using a feature matrix. The choice of features and entries determines what “similar accessibility” means: two cells may be close when their counts are compared, far apart when their accessible peaks are treated as sets, or indistinguishable after nearby peaks are aggregated. These are not merely alternative file formats. They encode different information and induce different distances.

This tutorial compares three choices: fragment counts assigned to peaks, binary peak-by-cell indicators, and measurements aggregated over broader genomic regions. The phrase “region-by-cell” describes a matrix whose rows are genomic regions and columns are cells; a peak-by-cell matrix is also region-by-cell in that broad sense. The substantive distinction is usually the resolution and definition of the genomic features, and whether each entry is a count or a binary indicator.

Definition: Let \(X_{ij}\) denote an ATAC feature value for feature \(i\) and cell \(j\). A fragment-count matrix records the number of fragments assigned to each defined feature in each cell. A binary peak-by-cell matrix records \(B_{ij}=1\) if at least one fragment is assigned to peak \(i\) in cell \(j\), and \(B_{ij}=0\) otherwise. A region-by-cell matrix uses a specified set of genomic regions as its rows; its entries may be counts or binary indicators, depending on the analysis.

A fragment-count matrix is not the list of individual fragments: it is a summary of them after assigning fragments to a feature catalog. The result depends on how fragments are defined and counted, including choices about paired-end reads, duplicate handling, cell-barcode filtering, and overlap rules. A binary matrix discards the distinction between one and many assigned fragments. A broader-region matrix changes the feature catalog, for example by summing counts across several nearby peaks or across fixed genomic intervals.

Comparisons require a consistent definition. If one cell’s counts use a different peak catalog, fragment-counting rule, or barcode set from another’s, a difference between matrix entries may reflect processing rather than accessibility. Similarly, a binary entry of zero means “no fragment assigned under this assay and processing rule,” not proof that the chromatin is biologically closed.

How the Choices Change Distances

For two cells represented by feature vectors \(x\) and \(y\), Euclidean distance is \(d_E(x,y)=\sqrt{\sum_i(x_i-y_i)^2}\). It responds to both the features that differ and the magnitudes of their entries. If the vectors are binary, the squared Euclidean distance is simply the number of features present in exactly one of the two cells. For binary vectors, Jaccard distance instead compares the sets of detected features: it is one minus the size of their intersection divided by the size of their union. Jaccard distance ignores joint absences, which can be numerous in sparse ATAC data.

These definitions do not make one distance universally preferable. Euclidean distance on counts is sensitive to count magnitude and can be strongly affected by differences in total fragments. Jaccard distance on binary features focuses on overlap among detected features, but it discards how many fragments support each detection. Distances on broader regions reflect accessibility at that coarser resolution: separate nearby peak patterns can become identical if they fall within the same region.

Worked Example: Counts Preserve Magnitude That Binarization Removes

Suppose three peaks are measured in two hypothetical cells. The fragment-count vectors are \(x=(4,0,2)\) and \(y=(8,0,4)\), where entries are counts assigned to peaks \(p_1,p_2,p_3\), respectively.

Count-based Euclidean distance. Substitution gives \(d_E(x,y)=\sqrt{(4-8)^2+(0-0)^2+(2-4)^2}=\sqrt{16+0+4}=\sqrt{20}=4.472\) counts in this feature-vector scale. The cells have the same relative pattern, but cell \(y\) has twice the counts at each detected peak, so their count vectors are not identical.

Binary representation. Thresholding each entry at greater than zero gives \(b_x=(1,0,1)\) and \(b_y=(1,0,1)\). Their binary Euclidean distance is \(\sqrt{(1-1)^2+(0-0)^2+(1-1)^2}=0\). Their Jaccard distance is also \(1-2/2=0\), because both cells have the same two detected peaks. Thus, binarization removes the difference in observed count magnitude. It may reduce sensitivity to depth, but it also discards potentially meaningful support information.

This calculation alone does not establish that one cell has greater biological accessibility. Differences in library size, sampling, and technical processing can contribute to count magnitude. The distance is a property of these observed representations, not a causal or depth-adjusted measure of biological state.

The relation between binary Euclidean distance and set difference follows directly. Let \(A\) and \(C\) be the sets of features with value one in two binary vectors. For each feature, \((B_{iA}-B_{iC})^2\) is one exactly when that feature belongs to one set but not both, and is zero otherwise. Therefore,

$$ d_E^2(B_A,B_C)=\sum_i(B_{iA}-B_{iC})^2 =|A\setminus C|+|C\setminus A| =|A\mathbin{\triangle}C|. $$

So binary Euclidean distance counts features in the symmetric difference. Jaccard distance uses the same disagreement features but divides by the union size: \(d_J(A,C)=|A\mathbin{\triangle}C|/|A\cup C|\), when the union is nonempty. This normalization can make overlap comparisons less dependent on the total number of detected features. If both cells have no detected features, the union is empty and the Jaccard distance is undefined unless an explicit convention is adopted; that case should be handled and reported rather than silently treated as an ordinary comparison.

Worked Example: Binary Peak Overlap and Jaccard Distance

Consider two hypothetical cells with detected peak sets \(A=\{p_1,p_3\}\) and \(C=\{p_2,p_3\}\). Across the three-peak catalog, their binary vectors are \((1,0,1)\) and \((0,1,1)\).

Binary Euclidean distance. \(\sqrt{(1-0)^2+(0-1)^2+(1-1)^2}=\sqrt{1+1+0}=\sqrt{2}=1.414\). This is the square root of two peaks detected in exactly one of the cells.

Jaccard distance. The intersection is \(\{p_3\}\), of size one, and the union is \(\{p_1,p_2,p_3\}\), of size three. Hence \(d_J(A,C)=1-|A\cap C|/|A\cup C|=1-1/3=2/3=0.6667\).

The values \(1.414\) and \(0.6667\) are on different scales and should not be compared numerically as if they measured the same quantity. Both indicate a partial overlap, but Euclidean distance counts mismatches while Jaccard distance expresses the mismatches as a fraction of the union.

Changing the Genomic Resolution

A region-by-cell representation changes which genomic distinctions can be seen. Suppose a region is formed by grouping a specified set of peaks. A count-valued regional entry can be defined by summing the assigned counts over those peaks; a binary regional entry can be defined as one if any grouped peak is detected. Those rules are not equivalent: summing counts preserves the number of assigned fragments, whereas the binary rule records only whether the region had any detection.

The grouping rule must be explicit. “Region” might mean a merged interval, a fixed-width genomic bin, or another predefined unit. Different choices can combine biologically distinct peaks or split a signal across bins. The representation also depends on whether fragments crossing region boundaries are assigned once, assigned to every overlapping interval, or handled by another declared rule.

Worked Example: Aggregating Peaks Can Erase a Cell Difference

Suppose four hypothetical peaks are grouped into two regions: \(R_1\) contains \(p_1,p_2\), and \(R_2\) contains \(p_3,p_4\). Two cells have peak-count vectors \(x=(1,0,0,0)\) and \(y=(0,1,0,0)\).

At peak resolution. Their Euclidean distance is \(\sqrt{(1-0)^2+(0-1)^2+(0-0)^2+(0-0)^2}=\sqrt{2}=1.414\) counts.

After regional summation. The region-count vectors are \(x_R=(1+0,0+0)=(1,0)\) and \(y_R=(0+1,0+0)=(1,0)\). Their regional Euclidean distance is \(\sqrt{(1-1)^2+(0-0)^2}=0\). The cells differ in which peak in \(R_1\) is detected, but not in the total count assigned to \(R_1\).

If the regional entries were binary indicators for any detection, both cells would instead have \((1,0)\) as well. This example shows that aggregation is a substantive resolution choice: it can stabilize comparisons to small peak-level shifts, but it can also conceal peak-specific differences.

Choosing a Representation for Joint Analysis

For joint analysis with RNA, protein, or another modality, the ATAC matrix must remain traceable to the correct cells. Rows should refer to well-defined genomic features, columns to cell identities, and any transformations or filtering should preserve that mapping. A paired assay does not make the modalities interchangeable: an RNA count and an ATAC fragment count arise from different measurement processes and have different feature meanings.

A sensible representation depends on the question. Count-valued features preserve more information about observed support, but raw counts can make distance comparisons sensitive to depth. Binary features emphasize whether a peak was detected, but two cells with very different counts can become identical. Broader regions may provide a more stable coarse summary, but only if the loss of peak-level detail is acceptable. In each case, document the feature catalog, counting or thresholding rule, and treatment of empty or missing features.

When computing a distance, check that its inputs match the intended interpretation. Euclidean distance on count vectors is meaningful as a geometric comparison of those entries, but high-total-count cells may dominate it. Binary Jaccard distance avoids counting shared absences as overlap, but sparse data can still produce unstable comparisons when very few features are detected. A distance on aggregated regions answers a coarser question than one on individual peaks. No distance calculation alone resolves these design choices.

1
Specify the features.
State the peak or region catalog and the genomic interval definitions used for each row.
2
Specify the encoding.
Say whether each entry is a fragment count, a binary detection, or an aggregation, and define its assignment rule.
3
Match the distance to the question.
Decide whether magnitude, detection overlap, or broader regional similarity is the intended signal; describe the resulting distance accordingly.
4
Check data quality and pairing.
Inspect library sizes, sparsity, empty cells, feature distributions, and cell identifiers before using the representation in joint analysis.

Diagnostics, Alternatives, and Common Mistakes

Useful checks include the distribution of total fragment counts per cell, the number of detected features per cell, the fraction of zero entries, and whether a small number of features dominate the count scale. Compare distance patterns with library size and processing batch: if cells group mainly by those quantities, the representation may be emphasizing technical variation. Check for cells with no detected features, inconsistent feature catalogs, duplicated or overlapping intervals, and cell-order mismatches between modalities.

These checks diagnose potential problems; they do not prove that a particular distance is biologically appropriate. A count-based comparison, a binary overlap measure, and a broader-region comparison are alternatives because they preserve different information. They should be chosen and interpreted in terms of the question, rather than selected only because one yields a visually appealing grouping. Transformations designed specifically for sparse ATAC data and methods for balancing modalities require additional choices beyond the raw representations described here.

  • Mistake: treating raw counts as depth-free. “The count distance is larger, so the cells must differ more biologically” ignores that greater sequencing depth can increase counts. Check library size and state what the distance measures.
  • Mistake: treating binarization as harmless normalization. Two cells with counts \((1,0)\) and \((100,0)\) both become \((1,0)\). Binarization removes magnitude, not merely a nuisance scale.
  • Mistake: assuming broader regions preserve peak-level information. As the aggregation example shows, distinct peak patterns can produce the same regional vector. Choose the resolution that matches the scientific question.
  • Mistake: interpreting a zero as biological closure. A zero is no assigned observation under the stated assay and processing pipeline; finite sampling and technical factors can also produce it.
Key takeaway: An ATAC feature matrix is defined by both its genomic rows and its entry rule. Counts retain magnitude, binary indicators retain detection status, and broader regions trade peak-level resolution for aggregation. Distances and joint analyses inherit those choices.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. Two cells have count vectors \((3,0,1)\) and \((6,0,2)\). What are their binary vectors, and what information is lost?
  2. For detected peak sets \(A=\{p_1,p_2,p_4\}\) and \(C=\{p_2,p_3\}\), calculate their Jaccard distance.
  3. Why can summing counts over grouped peaks make two cells have distance zero even when their peak-level vectors differ?
  4. Name two checks that would help assess whether raw count distances are dominated by technical rather than biological variation.

Solutions. 1. Both binary vectors are \((1,0,1)\), so binarization loses the difference in count magnitude: the second vector has twice the counts at its detected peaks. 2. The intersection has size one, \(\{p_2\}\), and the union has size four, \(\{p_1,p_2,p_3,p_4\}\); therefore \(d_J=1-1/4=0.75\). 3. Aggregation sums entries within each region, so different allocations across peaks can yield identical regional totals; identical regional vectors have Euclidean distance zero. 4. Check the relationship between distance and total fragments per cell, and inspect whether cells group by sequencing batch; also examine detected-feature counts and the count distribution across features.

Clinical Biostats