all_times <- list() # store the time for each chunk knitr::knit_hooks$set(time_it = local({ now <- NULL function(before, options) { if (before) { now <<- Sys.time() } else { res <- difftime(Sys.time(), now, units = "secs") all_times[[options$label]] <<- res } } })) knitr::opts_chunk$set( tidy = TRUE, tidy.opts = list(width.cutoff = 95), message = FALSE, warning = FALSE, time_it = TRUE ) suppressMessages(library(scRepertoire)) suppressMessages(library(Seurat)) data("contig_list") combined.TCR <- combineTCR(contig_list, samples = c("P17B", "P17L", "P18B", "P18L", "P19B","P19L", "P20B", "P20L")) scRep_example <- readRDS("scRep_example_full.rds") scRep_example <- combineExpression(combined.TCR, scRep_example, cloneCall="gene", group.by = "sample") #Adding patient information scRep_example$Patient <- substr(scRep_example$orig.ident, 1,3) #Adding type information scRep_example$Type <- substr(scRep_example$orig.ident, 4,4) #Defining colors colorblind_vector <- hcl.colors(n=7, palette = "inferno", fixup = TRUE)
From the excellent work by Lei Zhang, et al., the authors introduce new methods for looking at clones by cellular origins and cluster identification. Their STARTRAC software has been adapted to work with scRepertoire and please read and cite their excellent work.
In order to use the StartracDiversity()
function, you will need to include the product of the combinedExpression()
function. The second requirement is a column header in the meta data of the Seurat object that has tissue of origin. In the example data, type corresponds to the column "Type", which includes the "P" and "T" classifiers. The indices can be subsetted for a specific patient or examined overall using the by variable. Importantly, the function uses only the strict definition of a clone of the VDJC genes and the CDR3 nucleotide sequence.
The indices output includes:
StartracDiversity(scRep_example, type = "Type", group.by = "Patient")
A new metric proposed by Massimo et al, clonalBias()
, like STARTRAC is a clonal metric that seeks to quantify how individual clones are skewed towards a specific cellular compartment or cluster.
split.by
group.by
min.expand
clonalBias(scRep_example, cloneCall = "aa", split.by = "Patient", group.by = "seurat_clusters", n.boots = 10, min.expand =5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.