This function calculates pairwise TCR distances and stores them in a Seurat Object.

CalculateTcrDistances(
  inputData = NULL,
  organism = "human",
  chains = c("TRA", "TRB"),
  spikeInDataframe = NULL,
  minimumCloneSize = 2,
  calculateChainPairs = FALSE,
  debugMode = FALSE,
  verbose = FALSE,
  method = "tcrdist3"
)

Arguments

inputData

Either a seurat Object containing TCR information or a dataframe containing metadata

organism

Organism to use for reference segments. Default is 'human'.

chains

Vector of TCR chains to include in the analysis. Default is c("TRA", "TRB").

spikeInDataframe

An optional data frame containing additional CDR3s and gene segments to be included in the clustering, such as published clonotypes.

minimumCloneSize

Minimum number of clones per subject to include in the analysis. Default is 2.

calculateChainPairs

Boolean controlling whether to compute joint multi-chain distance matrices for observed chain combinations.

debugMode

Boolean that will result in more debugging information to be printed

verbose

Boolean controlling whether to print additional information about procesing

method

The method for clustering. Currently only tcrdist3 is supported

Examples

if (FALSE) { # \dontrun{
  # When providing a dataframe, a new seurat object will be returned:
  seuratObj_TCR <- CalculateTcrDistances(inputData = seuratObj@meta.data,
              chains = c("TRA", "TRB"),
              minimumCloneSize = 2,
              calculateChainPairs = FALSE,
              verbose = FALSE)

  # When providing a seuratObj, the original object will be returned, with the clustering results added as assays:
  seuratObj <- CalculateTcrDistances(inputData = seuratObj,
              chains = c("TRA", "TRB", "TRG", "TRD"),
              calculateChainPairs = TRUE,
              verbose = TRUE)

    spikeInDataframe <- data.frame(CloneNames = rep(1:3),
                                 TRA_V = c("TRAV1-2", "TRAV1-2", "TRAV1-2"),
                                 TRA_J = c("TRAJ33", "TRAJ20", "TRAJ33"),
                                 TRA = c("CAVRDSNYQLIW", "CAVSLQDYKLSF", "CAVRDSNYQLIW"),
                                 TRB_V = c("TRBV6-4", "TRBV6-4", "TRBV6-4"),
                                 TRB_J = c("TRBJ1-1", "TRBJ2-1", "TRBJ2-3"),
                                 TRB = c("CASSAAAAAAAAFF", "CASSVVVVVVVVQF", "CASSWWWWWWWWQY"))
} # }