Skip to content
PointillViz
PointillViz

© 2026 PointillViz

Categorical Chords

by PointillViz community tools

Explore spatial contacts or shared membership between categorical annotations with count-weighted ribbons and enrichment colors.

Verifiedv1.0.0
  • cell types
  • categorical
  • chord
  • chord
  • matrix
  • table
  • summary
Card artwork of Categorical Chords.

Readme

Answers the question: Which categorical groups occur together more or less often than expected?

The tool compares categorical annotations such as cell types, clusters, or spatial niches. It offers two analysis modes:

  • Spatial contacts counts pairs of cells from the same section that lie within the selected radius.
  • Annotation relationships compares two categorical annotations assigned to the same cells, without using spatial coordinates.

For each pair of groups A and B, the tool compares the observed count O(A,B) with the expected count E(A,B):

The expectation is calculated from the group frequencies within each section. In annotation mode, E(A,B)=n(A)n(B)/N. In spatial-contact mode, it represents the number of A-to-B pairs expected if the group labels were randomly redistributed over the observed cell positions. A score of 0 indicates agreement with the expectation; positive values indicate enrichment and negative values depletion.

Chord. Each sector represents one group. Ribbon width shows the observed number of cells or spatial pairs connecting two groups, while ribbon color shows their log2(O/E) score: orange indicates enrichment and blue depletion. The display limits affect only the chord diagram, which shows the most abundant groups and best-supported relationships.

Matrix. Both axes list the selected groups, and each square shows the corresponding log2(O/E) score. The matrix retains all group combinations, including those omitted from the chord diagram.

Table. Each row represents one group pair. Count gives the observed number of cells or spatial pairs, Expected gives the expected count, and log2 O/E shows the enrichment or depletion.

Parameters

ParameterTypeDefaultWhat it does
Relationshipmode select, 2 options Spatial contacts Selects whether to analyze spatial contacts between different cells or relationships between two annotations on the same cells.
Grouping annotationfield categorical_field — Selects the categorical annotation used for the groups. In annotation mode, this is the first of the two annotations.
Second annotationother_field categorical_field optional Selects the second annotation compared on the same cells. Used only for Annotation relationships.
Contact radiusradius float, 1–1,000 60 Sets the maximum distance between two cells for them to count as a spatial contact, in dataset coordinate units. Used only for Spatial contacts.
Minimum ribbon supportmin_count int, 1–1,000 1 Shows a ribbon only when the relationship contains at least this many observed cells or spatial pairs.
Maximum sectorsmax_nodes int, 4–60 20 Limits how many groups appear around the chord diagram to the most abundant ones.
Maximum ribbonsmax_links int, 1–500 80 Sets the maximum number of relationships shown, keeping those with the highest observed counts.
Include within-group contactsself_links bool off Includes spatial contacts between cells belonging to the same group. Used only for Spatial contacts.

Outputs

  • chordreturns a chord diagram
  • matrixreturns a heatmap
  • tablereturns a table
  • summarywrites a summary

Tool check

The nine gates this version passed when it was published.

Verified

Passed 9 of 9 gates

  1. bundle pass
  2. manifest pass
  3. entry pass
  4. imports pass, advisory
  5. fixture pass
  6. result pass
  7. determinism pass
  8. edge pass
  9. no_mutation pass
  1. bundle pass

    4 files, 5.0 kB packed and 11.9 kB unpacked, plugin.json at the root.

  2. manifest pass

    categorical-chords 1.0.0 by PointillViz community tools; entry tool.py, outputs chord, matrix, table, summary, 180 s and 4096 MB budget.

  3. entry pass

    tool.py imported in 0.40 s and defines run(ds, params).

  4. imports advisory pass

    1 Python file, importing backend, numpy, scipy; no network, subprocess, filesystem-write, dynamic-exec or environment use found.

  5. fixture pass

    ran on the 600-cell fixture in 0.47 s of its 180 s budget, returning summary, table, matrix, chord.

  6. result pass

    returned the declared outputs: summary, table, matrix, chord.

  7. determinism pass

    two runs with identical parameters produced byte-identical results (3.9 kB of JSON).

  8. edge pass

    at the minimum corner (max_links=1, max_nodes=4, radius=1.0) it refused in words rather than crashing: No relationships pass these controls. Reduce minimum support, increase radius for contacts, or include self-links. (code: no_links); at the maximum corner (max_links=500, max_nodes=60, min_count=1000, mode='annotations', radius=1000.0, self_links=True) it refused in words rather than crashing: No relationships pass these controls. Reduce minimum support, increase radius for contacts, or include self-links. (code: no_links).

  9. no_mutation pass

    the fixture dataset's 4 files are byte-identical after every run (plugin_cache/, where ds.knn caches, is excluded by design).

Passed every required gate when this version was published. That is a statement about the gates, not about whether the code is safe to run.

Versions

  1. v1.0.0 latest

More tools