Skip to contents

Quantify the paired usage of V(D)J segments across two chains. For example, calc_gene_pairs() can calculate the frequency that different TRA and TRB V segments appear together.

Usage

calc_gene_pairs(
  input,
  data_col,
  chains,
  cluster_col = NULL,
  chain_col = global$chain_col,
  sep = global$sep
)

Arguments

input

Object containing V(D)J data. If a data.frame is provided, the cell barcodes should be stored as row names.

data_col

meta.data column containing V(D)J genes identified for each clonotype.

chains

Chains to use for calculating usage of different gene pairs. This should be a character vector containing the two chains to use for calculations, e.g. c("IGH", "IGK").

cluster_col

meta.data column containing cell clusters to use when calculating gene usage

chain_col

meta.data column containing chains for each cell

sep

Separator used for storing per cell V(D)J data

Value

data.frame containing gene pair summary

Examples

# Calculate the frequency of different V genes for IGH and IGK chains
calc_gene_pairs(
  vdj_sce,
  data_col    = "v_gene",
  chains      = c("IGH", "IGK"),
  cluster_col = "orig.ident"
)
#> # A tibble: 378 × 7
#>    IGH      IGK        orig.ident n_cells  freq   pct shared
#>    <chr>    <chr>      <chr>        <dbl> <int> <dbl> <lgl> 
#>  1 None     IGKV5-43   avid_2          33    21 63.6  TRUE  
#>  2 None     IGKV5-43   avid_1          27    10 37.0  TRUE  
#>  3 None     IGKV3-4    avid_1          27     2  7.41 FALSE 
#>  4 None     IGKV8-24   avid_1          27     2  7.41 FALSE 
#>  5 None     IGKV17-127 avid_2          33     2  6.06 FALSE 
#>  6 None     IGKV6-23   avid_2          33     2  6.06 FALSE 
#>  7 IGHV1-26 IGKV12-44  avid_1          27     1  3.70 FALSE 
#>  8 IGHV1-78 IGKV12-44  avid_1          27     1  3.70 FALSE 
#>  9 IGHV1-82 IGKV3-7    avid_1          27     1  3.70 FALSE 
#> 10 IGHV10-1 None       avid_1          27     1  3.70 FALSE 
#> # ℹ 368 more rows