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)) data("contig_list") combined.TCR <- combineTCR(contig_list, samples = c("P17B", "P17L", "P18B", "P18L", "P19B","P19L", "P20B", "P20L"))
What if there are more variables to add than just sample and ID? We can add them by using the addVariable()
function. All we need is the variable.name of the variable you'd like to add and the specific character or numeric values (variables). As an example, here we add the Type in which the samples were processed and sequenced.
combined.TCR <- addVariable(combined.TCR, variable.name = "Type", variables = rep(c("B", "L"), 4)) head(combined.TCR[[1]])
Likewise, we can remove specific list elements after combineTCR()
using the subsetClones()
function. In order to subset, we need to identify the vector we would like to use for subsetting (name) and the variable values to subset (variables). Below, we isolate just the 2 sequencing results from P18L and P18B.
subset1 <- subsetClones(combined.TCR, name = "sample", variables = c("P18L", "P18B")) head(subset1[[1]])
Alternatively, we can also just select the list elements after combineTCR()
or combineBCR()
.
subset2 <- combined.TCR[c(3,4)] head(subset2[[1]])
After assigning the clone by barcode, we can export the paired clonotypes using exportClones()
to save for later use or to use in other pipelines.
format
write.file
dir
directory location to save the csv
file.name
the csv file name
exportClones(combined, write.file = TRUE, dir = "~/Documents/MyExperiment/Sample1/" file.name = "clones.csv")
The annotateInvariant()
function enables the identification of mucosal-associated invariant T (MAIT) cells and invariant natural killer T (iNKT) cells in single-cell sequencing datasets. These specialized T-cell subsets are defined by their characteristic TCR usage, making them distinguishable within single-cell immune profiling data. The function extracts TCR chain information from the provided single-cell dataset and evaluates it against known invariant TCR criteria for either MAIT or iNKT cells. Each cell is assigned a score indicating the presence (1) or absence (0) of the specified invariant T-cell population.
combineTCR()
or combineExpression()
.combined <- annotateInvariant(combined, type = "MAIT", species = "human") combined <- annotateInvariant(combined, type = "iNKT", species = "human")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.