Cluster TCR distance assays in a single Seurat/tcr object and write compact tables to disk. This function expects the user to have already subsetted their data (no grouping column). It supports single-chain assays and multi-chain (paired) assays. For single-chain assays the output table has columns: chain, v_gene, j_gene, CDR3, Cluster, Cluster_Size_Threshold, Clustering_Method, ... For paired assays (two chains) the output table is written with columns: chain_1, v_gene_1, j_gene_1, CDR3_1, chain_2, v_gene_2, j_gene_2, CDR3_2, Cluster, ...

RunTcrClustering(
  seuratObj_TCR = NULL,
  chainsToCluster = NULL,
  clusteringMethod = "DIANA",
  dianaHeight = 20,
  clusterSizeThreshold = 2,
  verbose = TRUE
)

Arguments

seuratObj_TCR

Seurat object produced by RunTcrdist3 (contains distance assays and metadata). If NULL, provide metadata and distance_matrices instead.

chainsToCluster

Character vector of assay names to cluster. If NULL, all assays in seuratObj_TCR will be processed.

clusteringMethod

"DIANA" or "Leiden". Default = "DIANA". If "Leiden", ClusterTcrs() is used.

dianaHeight

DIANA cut height (used when clusteringMethod == "DIANA"). Default = 20.

clusterSizeThreshold

Minimum cluster size to keep (clusters below set to 0). Default = 2.

verbose

Logical. Print progress. Default = TRUE.

Value

A seurat_TCR object with the cluster assignments stored in the metadata