calc_gene_usage: Calculate V(D)J segment usage

View source: R/calc-gene-usage.R

calc_gene_usageR Documentation

Calculate V(D)J segment usage

Description

Quantify the usage of different V(D)J segments for each cell cluster. The usage of two V(D)J segments can also be calculated for a single chain. For example, calc_gene_usage() can calculate the frequency that different heavy chain V and J segments appear together.

Usage

calc_gene_usage(
  input,
  data_cols,
  cluster_col = NULL,
  chain = NULL,
  chain_col = global$chain_col,
  prefix = paste0(data_cols[1], "_"),
  return_df = FALSE,
  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_cols

meta.data column(s) containing V(D)J genes identified for each clonotype. If multiple columns are provided, paired usage of genes will be calculated.

cluster_col

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

chain

Chain(s) to use for calculating gene usage. Set to NULL to include all chains.

chain_col

meta.data column containing chains for each cell

prefix

Prefix to add to new columns

return_df

Return results as a data.frame. If FALSE, results will be added to the input object.

sep

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

Value

data.frame containing gene usage summary

See Also

plot_gene_usage(), calc_gene_pairs(), plot_gene_pairs()

Examples

# Calculate V(D)J segment usage for all cells
calc_gene_usage(
  vdj_sce,
  data_cols = "v_gene"
)

# Calculate gene usage separately for cell clusters
calc_gene_usage(
  vdj_sce,
  data_cols = "v_gene",
  cluster_col = "orig.ident"
)

# Calculate gene usage for a specific chain(s)
calc_gene_usage(
  vdj_sce,
  data_cols = "v_gene",
  chain = c("IGK", "IGL")
)

# Calculate paired usage of V(D)J segments
calc_gene_usage(
  vdj_sce,
  data_cols = c("v_gene", "j_gene"),
)


rnabioco/djvdj documentation built on Oct. 24, 2023, 7:33 p.m.