Barcode Mismatch

Depending on the pipeline used to generate the single-cell object, there may be inherent mismatches in the barcodes in the single-cell object and the output of combineBCR() or combineTCR(). In particular, by default, Seurat will amend the suffix of the barcodes with _X, so the barcodes change like:

seurat-modified: ACGTACGTACGTACGT-1_1

scRepertoire uses the samples in combineTCR() or combineBCR() to add a prefix to the barcodes (using the samples and/or ID parameters):

scRepertoire-modified: Sample1_ACGTACGTACGTACGT-1

The easiest way to make these compatible is to rename the cell barcodes in the Seurat object by using the RenameCells() from the SeuratObject package.

cell.barcodes <- rownames(seuratObj[[]])
# removing the _1 at the end of the barcodes)
cell.barcodes <- stringr::str_split(cell.barcodes, "_", simplify = TRUE)[, 1]
# adding the prefix of the orig.ident to the barcodes, assuming that is the sample ids
cell.barcodes <- paste0(seuratObj$orig.ident, "_", cell.barcodes)
seuratObj <- RenameCells(seuratObj, new.names = cell.barcodes)

Adjusting Color Palettes

For all visualizations in scRepertoire, there are 2 ways to adjust the color scheme:

  • Change the palette parameter to the desired color scheme. This approach uses the built-in palettes of grDevices and we can access the list of color schemes using hcl.pals().
  • Add a ggplot layer with a new color scheme.
            chain = "both", 
            scale = TRUE, 
            palette = "Zissou 1")

            chain = "both", 
            scale = TRUE) + 
  scale_fill_manual(values = hcl.colors(8,"geyser"))

Adjusting Order of Plotting

The order of the group plotting (whether along an axis or in color) can be directly ordered using the parameter in functions. Here we can place a vector of strings that will set the exact plotting order. If using it is important to make sure your vectors match the strings exactly.

Alternatively, we can set = “alphanumeric”, if we would like the plots sorted in order of the variable.

clonalQuant(combined.TCR, cloneCall = "strict", chain = "both", scale = TRUE, = c("P17B",
    "P18B", "P19B", "P20B", "P17L", "P18L", "P19L", "P20L"))

Getting Data Used in Plots

Within each of the general analysis functions, there is the ability to export the data frame used to create the visualization. To get the exported values, use exportTable = TRUE. It will return the data frame used to make the graph instead of the visual output.

clonalQuant_output <- clonalQuant(combined.TCR, 
                                  scale = TRUE, 
                                  exportTable = TRUE)
##   contigs values total   scaled
## 1     745   P17B  2805 26.55971
## 2    2117   P17L  2893 73.17663
## 3    1254   P18B  1328 94.42771
## 4    1202   P18L  1278 94.05321
## 5    5544   P19B  6942 79.86171
## 6    1619   P19L  2747 58.93702
## 7    6087   P20B  8991 67.70103
## 8     192   P20L   201 95.52239

Citing scRepertoire

We are working on submitting the scRepertoire as a peer review article,

Bug Reports/New Features

Submit a GitHub issue - if possible please include a reproducible example. Alternatively, an example with the internal scRep_example and contig_list would be extremely helpful.