Skip to content

Commit

Permalink
fixed spelling, cleaned up files, added new example data for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Qile0317 committed Aug 9, 2023
1 parent f027181 commit 057173a
Show file tree
Hide file tree
Showing 18 changed files with 92 additions and 54 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RoxygenNote: 7.2.3
biocViews: Software, ImmunoOncology, SingleCell, Classification, Annotation, Sequencing
Depends:
ggplot2,
R (>= 4.0)
R (>= 4.0),
Seurat
Imports:
stringdist,
Expand Down
23 changes: 21 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,29 @@
#'
NULL

#' A seurat object of 1000 single T cells derived
#' A seurat object of 100 single T cells derived
#' from 3 clear cell renal carcinoma patients.
#'
#' @description The object is compatible with `contig_list` and the TCR
#' sequencing data can be added with `combineExpression`.
#'
#' @name screp_example
#' @docType data
#'
#'
NULL

#' Processed subset of `contig_list`
#'
#' @description A list of 6 dataframes of T cell contigs outputted from the
#' `filtered_contig_annotation` files, but subsetted to about 92 valid T cells
#' which correspond to the same barcodes found in `screp_example`
#'
#' @usage data("combined_mini_contig_list")
#'
#' @format An R `list` of `data.frame` objects
#'
#' @docType data
#'
#' @seealso \code{\link{contig_list}}
#'
"combined_mini_contig_list"
11 changes: 5 additions & 6 deletions R/seuratFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#' clonotype information
#' @param addLabel This will add a label to the frequency header, allowing
#' the user to try multiple group.by variables or recalculate frequencies after
#' subseting the data.
#' subsetting the data.
#' @importFrom dplyr bind_rows %>% summarise
#' @importFrom rlang %||%
#' @importFrom SummarizedExperiment colData<- colData
Expand Down Expand Up @@ -147,11 +147,10 @@ combineExpression <- function(
}

warn_str <- "< 1% of barcodes match: Ensure the barcodes in
the Seurat object match the
barcodes in the combined immune receptor list from
scRepertoire - most common issue is the addition of the
prefixes corresponding to `samples` and 'ID' in the combineTCR/BCR()
functions"
the Seurat object match the barcodes in the combined immune receptor
list from scRepertoire - most common issue is the addition of the
prefixes corresponding to `samples` and 'ID' in the combineTCR/BCR()
functions"

if (is_seurat_object(sc)) {
if (length(which(rownames(PreMeta) %in%
Expand Down
8 changes: 4 additions & 4 deletions R/startrac.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ StartracDiversity <- function(sc,
#' @slot pIndex.migr data.frame. Each line for a cluster; pairwise migration
#' index between the two locations indicated in the column name.
#' @slot pIndex.tran data.frame. Each line for a cluster; pairwise transition
#' index betwwen the two major clusters indicated by the row name and column name.
#' index between the two major clusters indicated by the row name and column name.
#' @slot cluster.sig.data data.frame. Each line for a cluster; contains the
#' p values of cluster indices.
#' @slot pIndex.sig.migr data.frame. Each line for a cluster; contains the
Expand All @@ -129,7 +129,7 @@ StartracDiversity <- function(sc,
#' @name Startrac
#' @rdname Startrac
#' @aliases Startrac-class
#' @return method definition for runing startrac
#' @return method definition for running startrac
Startrac <- setClass("Startrac",
slots = c(aid = "character",
cell.data = "data.frame",
Expand Down Expand Up @@ -527,7 +527,7 @@ mcol.entropy <- function(x)
return(H)
}

#' warpper function for Startrac analysis
#' wrapper function for Startrac analysis
#' @importFrom reshape2 dcast
#' @importFrom plyr ldply adply llply
#' @importFrom parallel makeCluster stopCluster
Expand All @@ -537,7 +537,7 @@ mcol.entropy <- function(x)
#' @param proj character. String used to annotate the project.
#' @param cores integer. number of core to be used. default: NULL.
#' @param n.perm integer. number of permutation will be performed. If NULL, no permutation. (default: NULL)
#' @param verbose logical. wheter return intermediate result (some Startrac objects)
#' @param verbose logical. whether return intermediate result (some Startrac objects)
#' @details run the Startrac pipeline
#' @keywords internal
#' @return an list contains data.frame elements "cluster.data","pIndex.migr" and "pIndex.tran"
Expand Down
2 changes: 1 addition & 1 deletion R/viz.R
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ makingLodes <- function(meta2, color, alpha, facet, set.axes) {
#' gene segments such as V, D, J, or C.
#' @param order Categorical variable to organize the x-axis, either "gene" or "variance"
#' @param scale Converts the individual count of genes to proportion using the total
#' respective reprtoire size
#' respective repertoire size
#' @param group.by The column header used for grouping.
#' @param split.by If using a single-cell object, the column header
#' to group the new list. NULL will return clusters.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Single-cell sequencing is an emerging technology in the field of immunology and oncology that allows researchers to couple RNA quantification and other modalities, like immune cell receptor profiling at the level of an individual cell. A number of workflows and software packages have been created to process and analyze single-cell transcriptomic data. These packages allow users to take the vast dimensionality of the data generated in single-cell-based experiments and distill the data into novel insights. Unlike the transcriptomic field, there is a lack of options for software that allow for single-cell immune receptor profiling. Enabling users to easily combine RNA and immune profiling, scRepertoire was built to process data derived from the 10x Genomics Chromium Immune Profiling for both T-cell receptor (TCR) and immunoglobulin (Ig) enrichment workflows and subsequently interacts with the popular Seurat R package.

### Applying Deep Learning to VDJ data
scRepertoire is compatible and integrated with the R packages [Trex](https://github.com/ncborcherding/Trex) for deep-learning-based autencoding of the T cell receptor and [Ibex](https://github.com/ncborcherding/Ibex) for the B cell receptor.
scRepertoire is compatible and integrated with the R packages [Trex](https://github.com/ncborcherding/Trex) for deep-learning-based autoencoding of the T cell receptor and [Ibex](https://github.com/ncborcherding/Ibex) for the B cell receptor.

### Wrapper Functions
scRepertoire v1.0.2 has the functionality of the [powerTCR](https://github.com/hillarykoch/powerTCR) approach to comparing clone size distribution, [please cite](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006571) the manuscript if using the ```clonesizeDistribution()``` function. In addition, we recently added the [Startrac](https://github.com/Japrin/STARTRAC) clonotype metrics, if using the ```StartracDiversity()``` please read and cite [the accompanying article](https://www.nature.com/articles/s41586-018-0694-x).
Expand Down Expand Up @@ -44,7 +44,7 @@ BiocManager::install("scRepertoire")

### Getting Data

Unfortunately, Github limits the size of individual files. In order to access the seurat object paired with scRepetoire please download the .rda from [here](https://drive.google.com/file/d/1Iv6t2BScpnLLrFWaWFUGwne3XzRAwMOc/view?usp=share_link).
Unfortunately, Github limits the size of individual files. In order to access the seurat object paired with scRepertoire please download the .rda from [here](https://drive.google.com/file/d/1Iv6t2BScpnLLrFWaWFUGwne3XzRAwMOc/view?usp=share_link).

### Learning To Use scRepertoire

Expand Down
Binary file added data/combined_mini_contig_list.rda
Binary file not shown.
Binary file modified data/screp_example.rda
Binary file not shown.
21 changes: 13 additions & 8 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
citHeader("To cite scRepertoire in publications use:")

citEntry(
entry = "Article",
title = "scRepertoire: An R-based toolkit for single-cell immune receptor analysis",
author = {Borcherding, Nicholas and Bormann, Nicholas L and Kraus, Gloria},
journal = "F1000Research",
volume = 9,
year = 2022,
publisher = Faculty of 1000 Ltd
url = https://doi.org/10.12688/f1000research.22139.2,
entry = "Article",
title = "scRepertoire: An R-based toolkit for single-cell immune receptor analysis",
author = personList(
as.person("Nicholas Borcherding"),
as.person("Nicholas L Bormann"),
as.person("Gloria Kraus")
),
journal = "F1000Research",
volume = "9",
year = "2022",
publisher = "Faculty of 1000 Ltd",
doi = "10.12688/f1000research.22139.2",
url = "https://doi.org/10.12688/f1000research.22139.2",
textVersion = "Borcherding N, Bormann NL and Kraus G. scRepertoire: An R-based toolkit for single-cell immune receptor analysis [version 2; peer review: 2 approved]. F1000Research 2020, 9:47 (https://doi.org/10.12688/f1000research.22139.2)"
)
13 changes: 3 additions & 10 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,8 @@ aa
airr
al
alluvialClonotypes
analyis
autencoding
barcode
barcodes
betwwen
changeNames
circlize
clonalNetwork
Expand Down Expand Up @@ -134,15 +131,10 @@ rda
registerDoParallel
removeMulti
removeNA
reprtoire
runing
scRepetoire
scater
seurat
startrac
stripBarcode
subseted
subseting
subtype
sys
tcr
Expand All @@ -152,5 +144,6 @@ transcriptomic
tsv
unqiue
unreturned
warpper
wheter
CMD
Codecov
coords
4 changes: 2 additions & 2 deletions man/Startrac.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/Startrac.run.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/combined_mini_contig_list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/screp_example.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/vizGenes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scRepertoire.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ AutoAppendNewline: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran --use-valgrind
3 changes: 2 additions & 1 deletion tests/testthat/test-viz.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ combined <- combineTCR(

single_contig <- combineTCR(contig_list[[1]])

single_contig_with__sample <- combineTCR(
single_contig_with_sample <- combineTCR(
contig_list[[1]], samples = "PX", ID = "P"
)
# TODO test more cases with single_contig

test_that("quantContig works", {
expect_doppelganger(
Expand Down
19 changes: 9 additions & 10 deletions vignettes/vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ vignette: >
---

```{r, echo=FALSE, results="hide", message=FALSE}
knitr::opts_chunk$set(error=FALSE, message=FALSE, warning=FALSE)
knitr::opts_chunk$set(error = FALSE, message = FALSE, warning = FALSE)
# to pass R CMD check, packages can be installed in the knitted environment
if (!require("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
library(BiocManager)
suppressPackageStartupMessages(invisible(base::library(BiocManager)))
quiet_bioc_load <- function(...) {
pkgs <- list(...)
for (pkg in pkgs) {
if (!require(pkg, character.only = TRUE, quietly = TRUE)) {
BiocManager::install(pkg)
}
suppressPackageStartupMessages(invisible(library(pkg, character.only = TRUE)))
}
pkgs <- list(...)
for (pkg in pkgs) {
if (base::require(pkg, character.only = TRUE, quietly = TRUE)) {next}
BiocManager::install(pkg)
suppressPackageStartupMessages(invisible(base::library(pkg, character.only = TRUE)))
}
}
quiet_bioc_load("BiocStyle", "scater")
Expand Down Expand Up @@ -760,7 +759,7 @@ sub_combined <- clusterTCR(combined[[2]],

From the excellent work by Lei Zhang, et al in [Lineage tracking reveals dynamic relationships of T cells in colorectal cancer](https://www.nature.com/articles/s41586-018-0694-x), the authors introduce new methods for looking at clonotypes by cellular origins and cluster identification. Their [startrac](https://github.com/Japrin/STARTRAC) software has been incorporated into scRepertoire. If you are using the output of this specific function, please cite their excellent work.

In order to use the ```StartracDiversity()``` function, you will need to include the product of the ```combinedSeurat()``` function. The second requirement is a column header in the meta data of the Seurat object that has tissue of origin. In the example data,**type** corresponds to the column "Type", which includes the "P" and "T" classifier. The indices can be subseted for a specific patient or examined overall using the **by** variable. Importantly, the function uses only the strict definition of clonotype of the VDJC genes and the CDR3 nucleotide sequence.
In order to use the ```StartracDiversity()``` function, you will need to include the product of the ```combinedSeurat()``` function. The second requirement is a column header in the meta data of the Seurat object that has tissue of origin. In the example data,**type** corresponds to the column "Type", which includes the "P" and "T" classifier. The indices can be subsetted for a specific patient or examined overall using the **by** variable. Importantly, the function uses only the strict definition of clonotype of the VDJC genes and the CDR3 nucleotide sequence.

*The indices output includes:*
+ expa - Clonal Expansion
Expand Down

0 comments on commit 057173a

Please sign in to comment.