Skip to content

Commit b17a469

Browse files
committed
Update vignette.Rmd
1 parent 29c37ef commit b17a469

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

vignettes/vignette.Rmd

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vignette: >
1616
---
1717

1818
```{r, echo=FALSE, results="hide", message=FALSE, warning=FALSE}
19-
knitr::opts_chunk$set(error=FALSE, message=FALSE, warning=FALSE)
19+
knitr::opts_chunk$set(error=FALSE, message=FALSE, warning=FALSE, tidy = FALSE)
2020
library(BiocStyle)
2121
library(scater)
2222
library(Seurat)
@@ -211,7 +211,8 @@ head(combined.BCR.clustered[[1]][, c("barcode", "CTstrict", "IGH", "cdr3_aa1")])
211211

212212
### Filtering and Cleaning Data
213213

214-
```combineBCR()``` includes several arguments to filter and clean the contig data during processing.
214+
215+
`combineBCR()` includes several arguments to filter and clean the contig data during processing.
215216
* `filterNonproductive = TRUE` (Default): Removes any contigs that are not classified as productive, ensuring that only functional receptor chains are included in the analysis.
216217
* `filterMulti = TRUE` (Default): For cells with more than one heavy or light chain detected, this automatically selects the chain with the highest UMI count (read abundance) and discards the others. This helps resolve cellular multiplets or technical artifacts.
217218

@@ -685,7 +686,7 @@ Key Parameters for `percenVJ()`:
685686
* `chain`: Specifies the immune receptor chain (e.g., **"TRB"**, **"TRA"**, **"IGH"**, **"IGL"**). This dictates which V and J gene segments are analyzed (e.g., **TRBV** and **TRBJ** for `chain` = "TRB")
686687

687688
```{r}
688-
percentVJ(combined.TCR,
689+
percentVJ(combined.TCR[1:2],
689690
chain = "TRB",
690691
summary.fun = "percent")
691692
```
@@ -985,7 +986,7 @@ clonalSizeDistribution(combined.TCR,
985986
method= "ward.D2")
986987
```
987988

988-
```clonalSizeDistribution()``` offers a sophisticated approach to modeling immune repertoire composition, distinguishing between the distribution of rare and expanded clones. By applying a spliced statistical model, it provides a more accurate representation of the repertoire's underlying clonal architecture, enabling robust comparisons and a deeper understanding of immune system dynamics.
989+
`clonalSizeDistribution()` offers a sophisticated approach to modeling immune repertoire composition, distinguishing between the distribution of rare and expanded clones. By applying a spliced statistical model, it provides a more accurate representation of the repertoire's underlying clonal architecture, enabling robust comparisons and a deeper understanding of immune system dynamics.
989990

990991
## clonalOverlap: Exploring Sequence Overlap
991992

@@ -1048,9 +1049,9 @@ To mitigate this issue, a common strategy is to exclude VDJ genes from the set o
10481049

10491050
### Functions to Exclude VDJ Genes
10501051

1051-
* ```quietVDJgenes()``` – Removes both TCR and BCR VDJ genes.
1052-
* ```quietTCRgenes()``` – Removes only TCR VDJ genes.
1053-
* ```quietBCRgenes()``` – Removes only BCR VDJ genes, but retains BCR VDJ pseudogenes in the variable features.
1052+
* `quietVDJgenes()` – Removes both TCR and BCR VDJ genes.
1053+
* `quietTCRgenes()` – Removes only TCR VDJ genes.
1054+
* `quietBCRgenes()` – Removes only BCR VDJ genes, but retains BCR VDJ pseudogenes in the variable features.
10541055

10551056
Let's first check the top 10 variable features in the scRep_example Seurat object before any removal:
10561057

@@ -1122,8 +1123,11 @@ scRep_example <- combineExpression(combined.TCR,
11221123
proportion = FALSE,
11231124
cloneSize=c(Single=1, Small=5, Medium=20, Large=100, Hyperexpanded=500))
11241125
1125-
Seurat::DimPlot(scRep_example, group.by = "cloneSize") +
1126-
scale_color_manual(values=rev(colorblind_vector[c(1,3,4,5,7)]))
1126+
# Bug in Seurat 5.3.1 no longer handles NA for DimPlot
1127+
# Will Update in Future Commits
1128+
1129+
# Seurat::DimPlot(scRep_example, group.by = "cloneSize") +
1130+
# scale_color_manual(values=rev(colorblind_vector[c(1,3,4,5,7)]))
11271131
```
11281132

11291133
### Combining both TCR and BCR
@@ -1243,10 +1247,13 @@ scRep_example <- highlightClones(scRep_example,
12431247
sequence = c("CAERGSGGSYIPTF_CASSDPSGRQGPRWDTQYF",
12441248
"CARKVRDSSYKLIF_CASSDSGYNEQFF"))
12451249
1246-
Seurat::DimPlot(scRep_example, group.by = "highlight") +
1247-
guides(color=guide_legend(nrow=3,byrow=TRUE)) +
1248-
ggplot2::theme(plot.title = element_blank(),
1249-
legend.position = "bottom")
1250+
# Bug in Seurat 5.3.1 no longer handles NA for DimPlot
1251+
# Will Update in Future Commits
1252+
1253+
# Seurat::DimPlot(scRep_example, group.by = "highlight") +
1254+
# guides(color=guide_legend(nrow=3,byrow=TRUE)) +
1255+
# ggplot2::theme(plot.title = element_blank(),
1256+
# legend.position = "bottom")
12501257
```
12511258

12521259
## clonalOccupy
@@ -1514,9 +1521,12 @@ scRep_example <- clonalCluster(scRep_example,
15141521
num_clusters <- length(unique(na.omit(scRep_example$TRA.Cluster)))
15151522
cluster_colors <- hcl.colors(n = num_clusters, palette = "inferno")
15161523
1517-
DimPlot(scRep_example, group.by = "TRA.Cluster") +
1518-
scale_color_manual(values = cluster_colors, na.value = "grey") +
1519-
NoLegend()
1524+
# Bug in Seurat 5.3.1 no longer handles NA for DimPlot
1525+
# Will Update in Future Commits
1526+
1527+
# DimPlot(scRep_example, group.by = "TRA.Cluster") +
1528+
# scale_color_manual(values = cluster_colors, na.value = "grey") +
1529+
# NoLegend()
15201530
```
15211531

15221532
### Returning an igraph Object:
@@ -1601,7 +1611,6 @@ graph_walktrap <- clonalCluster(combined.TCR[c(1,2)],
16011611
16021612
# Compare the number of clusters found
16031613
length(unique(V(graph_walktrap)$cluster))
1604-
16051614
```
16061615

16071616
Overall, `clonalCluster()` is a versatile function for defining and analyzing clonal relationships based on sequence similarity. It allows researchers to move beyond exact sequence matches, providing a more comprehensive understanding of clonal families. The ability to customize parameters like `threshold`, `chain` selection, and `group.by` ensures adaptability to diverse research questions. Furthermore, the option to export `igraph` objects or sparse adjacency matrices provides advanced users with the tools for in-depth network analysis.

0 commit comments

Comments
 (0)