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:
original: ACGTACGTACGTACGT-1
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):
original: ACGTACGTACGTACGT-1
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)
For all visualizations in scRepertoire, there are 2 ways to adjust the color scheme:
hcl.pals()
.clonalQuant(combined.TCR,
cloneCall="strict",
chain = "both",
scale = TRUE,
palette = "Zissou 1")
clonalQuant(combined.TCR,
cloneCall="strict",
chain = "both",
scale = TRUE) +
scale_fill_manual(values = hcl.colors(8,"geyser"))
The order of the group plotting (whether along an axis or in color) can be directly ordered using the order.by parameter in functions. Here we can place a vector of strings that will set the exact plotting order. If using order.by it is important to make sure your vectors match the group.by strings exactly.
Alternatively, we can set order.by = “alphanumeric”, if we would like the plots sorted in order of the group.by variable.
clonalQuant(combined.TCR, cloneCall = "strict", chain = "both", scale = TRUE, order.by = c("P17B",
"P18B", "P19B", "P20B", "P17L", "P18L", "P19L", "P20L"))
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,
cloneCall="strict",
scale = TRUE,
exportTable = TRUE)
clonalQuant_output
## 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
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.