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 quietVDJgenes()
function removes both TCR and BCR genes from the variable features of a Seurat object.
screp_example <- quietVDJgenes(screp_example)
In addition to quietVDJgenes()
, there is also T and B cell specific functions quietTCRgene()
and quietBCRgenes()
that will remove the respective lineage-specific receptor genes from the variable gene list.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.