Performs ordination/dimensionality reduction for a species incidence matrix, depending on the species selected in the feature.columns parameter.

VDJ_ordination(
  VDJ,
  feature.columns,
  grouping.column,
  method,
  reduction.level,
  VDJ.VJ.1chain,
  umap.n.neighbours,
  tsne.perplexity
)

Arguments

VDJ

VDJ dataframe output from the VDJ_GEX_matrix function.

feature.columns

Character vector. One or more column names from the VDJ to indicate the unique species for the incidence/count matrix. 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 the ordination by. This could be "sample_id" to reduce across each sample. Indicative of 'sites' in a typical community data matrix/incidence matrix used in community ecology analyses (species by sites).

method

Character. The ordination method; choose from either: PCA - 'pca', t-SNE - 'tsne', UMAP - 'umap', PCOA/MDS - 'mds', DCA - 'dca'.

reduction.level

Character. Whether to reduce across groups ('groups'), features/sequences ('features'), or both ('both').

VDJ.VJ.1chain

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

umap.n.neighbours

Integer. Control the t-SNE perplexity when method = 'tsne'.

tsne.perplexity

Integrer. Defaults to 1

Value

Returns a ggplot with the ordination analysis performer across features, groups, or both

Examples


#PCA dimensionality reduction across samples for CDRH3
plot <- VDJ_ordination(VDJ = Platypus::small_vgm[[1]],
,feature.columns = c("VDJ_cdr3s_aa"), grouping.column = "sample_id"
,method = "pca", reduction.level = 'groups')