VDJ_diversity: Calculates and plots common diversity and overlap measures...

View source: R/VDJ_diversity.R

VDJ_diversityR Documentation

Calculates and plots common diversity and overlap measures for repertoires and alike. Requires the vegan package

Description

Calculates and plots common diversity and overlap measures for repertoires and alike. Requires the vegan package

Usage

VDJ_diversity(
  VDJ,
  feature.columns,
  grouping.column,
  metric,
  VDJ.VJ.1chain,
  subsample.to.same.n
)

Arguments

VDJ

VDJ dataframe output from the VDJ_build function.

feature.columns

Character vector. One or more column names from the VDJ of which diversity or overlap metrics are calculated. if more than one column is provided (e.g. c("VDJ_cdr3s_aa","VJ_cdr3s_aa")) these columns will be pasted together before metric calculation.

grouping.column

Character. Column name of a column to group metrics by. This could be "sample_id" to calculate the metric for each sample. This column is required if metric = "simpson". If so, the simpson overlap index will be calculated pairwise for all combinations of elements in the grouping.column. Defaults to "none".

metric

Character. Diversity or overlap metric to calculate. Can be c("richness", "bergerparker", "simpson", "ginisimpson", "shannon", "shannonevenness", "jaccard"). Defaults to "shannon". If jaccard is selected, a heatmap with the pairwise comparisons between all groups is returned. If any of the others is selected, a dotplot is returned

VDJ.VJ.1chain

Boolean defaults to TRUE. Whether to filter out aberrant cells (more than 1 VDJ or VJ chain).

subsample.to.same.n

Boolean defaults to TRUE. Whether to subsample larger groups down to the size of the smallest group

Value

Returns a ggplot with the calculated metric for each group (if provided).

Examples


VDJ_diversity(VDJ = Platypus::small_vdj,
,feature.columns = c("VDJ_jgene"), grouping.column = "sample_id"
,metric = "jaccard")


Platypus documentation built on Oct. 18, 2024, 5:08 p.m.