canonicalize_cell {CellaRepertorium} | R Documentation |
Using filtering in contig_filter_args
and sorting in tie_break_keys
and order
find a
single, canonical contig to represent each cell
Fields in contig_fields
will be copied over to the cell_tbl
.
canonicalize_cell( ccdb, contig_filter_args = TRUE, tie_break_keys = c("umis", "reads"), contig_fields = tie_break_keys, order = 1, overwrite = TRUE )
ccdb |
|
contig_filter_args |
an expression passed to |
tie_break_keys |
(optional) |
contig_fields |
Optional fields from |
order |
The rank order of the contig, based on |
overwrite |
|
ContigCellDB()
with some number of clusters/contigs/cells but with "canonical" values copied into cell_tbl
# Report beta chain with highest umi-count, breaking ties with reads data(ccdb_ex) beta = canonicalize_cell(ccdb_ex, chain == 'TRB', tie_break_keys = c('umis', 'reads'), contig_fields = c('umis', 'reads', 'chain', 'v_gene', 'd_gene', 'j_gene')) head(beta$cell_tbl) # Stable: only adds fields to `cell_tbl` stopifnot(dplyr::all_equal(beta$cell_tbl[ccdb_ex$cell_pk], ccdb_ex$cell_tbl[ccdb_ex$cell_pk], ignore_row_order = TRUE)) #Report cdr3 with highest UMI count, but only when > 5 UMIs support it umi5 = canonicalize_cell(ccdb_ex, umis > 5, tie_break_keys = c('umis', 'reads'), contig_fields = c('umis', 'cdr3')) stopifnot(all(umi5$cell_tbl$umis > 5, na.rm = TRUE))