Creates a tile chart showing the V gene usage for each chain position (TRA_1, TRA_2, TRB_1, TRB_2) across clonotypes at a given stringency level. Each tile is colored by V gene identity, making it easy to see which clones share V gene segments and which chains are present or absent.
Usage
plot_clone_composition(
ref_table,
top_n = 20,
sample_filter = NULL,
per_sample = FALSE,
combined = TRUE,
title = "Clonotype Chain Composition"
)Arguments
- ref_table
A reference table from
identify_clonotypesorassign_clonotypeoutput (e.g.,result$ref_tables$dual_chain_both_partial). Must contain columns: TRA_1, TRB_1.- top_n
Maximum number of clones to display. Clones are ranked by chain richness (number of non-NA chains). Remaining clones are excluded.
- sample_filter
Optional sample name to filter to. If
NULL, all samples are included. Ignored whenper_sample = TRUE.- per_sample
Logical. If
TRUE, create a separate plot for each unique sample in the reference table.- combined
Logical. If
TRUEandper_sample = TRUE, combine all per-sample plots into a single figure usingpatchwork. IfFALSE, return a named list of plots.- title
Plot title.