diff --git a/DESCRIPTION b/DESCRIPTION
index 2e928971..0e9e3e64 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,20 +1,21 @@
Package: scRepertoire
Title: A toolkit for single-cell immune receptor profiling
-Version: 2.0.4
+Version: 2.0.5
Authors@R: c(
person(given = "Nick", family = "Borcherding", role = c("aut", "cre"), email = "ncborch@gmail.com"),
- person(given = "Qile", family = "Yang", role = c("aut"), email = "qile0317@gmail.com"),
+ person(given = "Qile", family = "Yang", role = c("aut"), email = "qile.yang@berkeley.edu"),
person(given = "Ksenia", family = "Safina", role = c("aut"), email = "safina@broadinstitute.org"))
Description: scRepertoire is a toolkit for processing and analyzing single-cell T-cell receptor (TCR) and immunoglobulin (Ig). The scRepertoire framework supports use of 10x, AIRR, BD, MiXCR, Omniscope, TRUST4, and WAT3R single-cell formats. The functionality includes basic clonal analyses, repertoire summaries, distance-based clustering and interaction with the popular Seurat and SingleCellExperiment/Bioconductor R workflows.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
-RoxygenNote: 7.3.1
+RoxygenNote: 7.3.2
biocViews: Software, ImmunoOncology, SingleCell, Classification, Annotation, Sequencing
Depends:
- ggplot2,
- R (>= 4.0)
+ ggplot2,
+ R (>= 4.0)
Imports:
+ assertthat,
cubature,
dplyr,
evmix,
@@ -60,5 +61,5 @@ Config/testthat/edition: 3
Language: en-US
LinkingTo:
Rcpp
-URL: https://www.borch.dev/uploads/screpertoire/
+URL: https://www.borch.dev/uploads/scRepertoire/
BugReports: https://github.com/ncborcherding/scRepertoire/issues
diff --git a/NAMESPACE b/NAMESPACE
index 0fbeaaed..32ff5a24 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -45,6 +45,9 @@ importFrom(SingleCellExperiment,reducedDim)
importFrom(SummarizedExperiment,"colData<-")
importFrom(SummarizedExperiment,colData)
importFrom(VGAM,dpareto)
+importFrom(assertthat,assert_that)
+importFrom(assertthat,is.flag)
+importFrom(assertthat,is.string)
importFrom(cubature,adaptIntegrate)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
diff --git a/NEWS.md b/NEWS.md
index 6ae16242..d26d4443 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,10 @@
+# scRepertoire VERSION 2.0.5
+
+## UNDERLYING CHANGES
+* added type checks using assertthat
+* updated conditional statements in constructConDFAndparseTCR.cpp
+* Fixed issue in ```clonalQuant()``` and factor-based **group.by** variable
+
# scRepertoire VERSION 2.0.4
## UNDERLYING CHANGES
@@ -8,7 +15,10 @@
* ```clonalCompare()``` now retains the original clonal info if using **relabel.clones**
* Add Dandelion support in to ```loadContigs()``` and testthat
* Fixed issue with ```positionalProperty()``` assumption that the clones will all have 20 amino acids.
+* Fixed issue with ```positionalProperty()``` and removing non-amino acids.
* Fixed IGH/K/L mistaking gene issue in ```vizGenes()```
+* Add error message for NULL results in ```clonalCluster()``` with **export.graph = TRUE**
+* Fixed issue with "full.clones" missing in ```combineExpression()``` when using 1 chain
# scRepertoire VERSION 2.0.3
diff --git a/R/clonalCluster.R b/R/clonalCluster.R
index 2b4af6f7..3253a1a7 100644
--- a/R/clonalCluster.R
+++ b/R/clonalCluster.R
@@ -130,23 +130,28 @@ clonalCluster <- function(input.data,
#Returning the igraph object if exportGraph = TRUE
if(exportGraph) {
- cluster <- do.call(igraph::union, output.list)
- vertex <- names(V(cluster))
- data_df <- unique(data.frame(
- id = vertex
- ))
- data_df <- merge(data_df, graph.variables, by = 1)
- cluster <- set_vertex_attr(cluster,
- name = "size",
- index = data_df$id,
- value = data_df[,2])
- if(ncol(data_df) == 3) { #add grouping variable
+ if(length(is.null(output.list)) == length(output.list)) {
+ stop("No clusters detected with current parameters.")
+ } else {
+ output.list <- output.list[lapply(output.list,length)>0]
+ cluster <- do.call(igraph::union, output.list)
+ vertex <- names(V(cluster))
+ data_df <- unique(data.frame(
+ id = vertex
+ ))
+ data_df <- merge(data_df, graph.variables, by = 1)
cluster <- set_vertex_attr(cluster,
- name = "group",
+ name = "size",
index = data_df$id,
- value = data_df[,3])
+ value = data_df[,2])
+ if(ncol(data_df) == 3) { #add grouping variable
+ cluster <- set_vertex_attr(cluster,
+ name = "group",
+ index = data_df$id,
+ value = data_df[,3])
+ }
+ return(cluster)
}
- return(cluster)
}
cluster.list <- lapply(seq_len(length(output.list)), function(x) {
diff --git a/R/clonalQuant.R b/R/clonalQuant.R
index a40d16b8..683dace6 100644
--- a/R/clonalQuant.R
+++ b/R/clonalQuant.R
@@ -73,7 +73,7 @@ clonalQuant <- function(input.data,
mat[i,3] <- length(na.omit(input.data[[i]][,cloneCall]))
if (!is.null(group.by)) {
location <- which(colnames(input.data[[i]]) == group.by)
- mat[i,4] <- input.data[[i]][1,location]
+ mat[i,4] <- as.vector(input.data[[i]][1,location])
}
}
if (scale) {
diff --git a/R/combineContigs.R b/R/combineContigs.R
index 6248f6b9..955bb702 100644
--- a/R/combineContigs.R
+++ b/R/combineContigs.R
@@ -47,6 +47,7 @@ utils::globalVariables(c(
#' nonproductive chains if the variable exists in the contig data. Default
#' is set to TRUE to remove nonproductive contigs.
#'
+#' @importFrom assertthat assert_that is.flag
#' @export
#' @concept Loading_and_Processing_Contigs
#' @return List of clones for individual cell barcodes
@@ -58,6 +59,14 @@ combineTCR <- function(input.data,
removeMulti = FALSE,
filterMulti = FALSE,
filterNonproductive = TRUE) {
+
+ # rudimentary input checking
+ assert_that(is.character(samples) || is.null(samples))
+ assert_that(is.character(ID) || is.null(ID))
+ assert_that(is.flag(removeNA))
+ assert_that(is.flag(removeMulti))
+ assert_that(is.flag(filterMulti))
+
input.data <- .checkList(input.data)
input.data <- .checkContigs(input.data)
out <- NULL
@@ -185,6 +194,7 @@ combineTCR <- function(input.data,
#' nonproductive chains if the variable exists in the contig data. Default
#' is set to TRUE to remove nonproductive contigs.
#' @importFrom dplyr %>% mutate
+#' @importFrom assertthat assert_that is.flag
#' @export
#' @concept Loading_and_Processing_Contigs
#' @return List of clones for individual cell barcodes
@@ -200,6 +210,16 @@ combineBCR <- function(input.data,
if(is.null(samples)) {
stop("combineBCR() requires the samples paramter for the calculation of edit distance.")
}
+
+ # rudimentary input checking
+ assert_that(is.character(samples) || is.null(samples))
+ assert_that(is.character(ID) || is.null(ID))
+ assert_that(is.flag(call.related.clones))
+ assert_that(is.numeric(threshold))
+ assert_that(is.flag(removeNA))
+ assert_that(is.flag(removeMulti))
+ assert_that(is.flag(filterMulti))
+
input.data <- .checkList(input.data)
input.data <- .checkContigs(input.data)
out <- NULL
diff --git a/R/combineExpression.R b/R/combineExpression.R
index afcfebe4..5b7d6e66 100644
--- a/R/combineExpression.R
+++ b/R/combineExpression.R
@@ -49,11 +49,12 @@
#' @importFrom rlang %||% sym :=
#' @importFrom SummarizedExperiment colData<- colData
#' @importFrom S4Vectors DataFrame
+#' @importFrom assertthat assert_that is.string is.flag
#' @export
#' @concept SC_Functions
#' @return Single-cell object with clone information added to meta data
#' information
-#'
+#'
combineExpression <- function(input.data,
sc.data,
cloneCall ="strict",
@@ -64,6 +65,17 @@ combineExpression <- function(input.data,
cloneSize = c(Rare = 1e-4,Small = 0.001,Medium = 0.01,Large = 0.1,Hyperexpanded = 1),
addLabel = FALSE) {
call_time <- Sys.time()
+
+ # rudimentary type checking
+ assert_that(isAnyValidProductOfCombineContigs(input.data))
+ assert_that(is_seurat_or_se_object(sc.data))
+ assert_that(is.string(cloneCall))
+ assert_that(is.string(chain))
+ assert_that(is.string(group.by) || is.null(group.by))
+ assert_that(is.flag(proportion))
+ assert_that(is.flag(filterNA))
+ assert_that(is_named_numeric(cloneSize))
+ assert_that(is.flag(addLabel))
options( dplyr.summarise.inform = FALSE )
if (!proportion && any(cloneSize < 1)) {
@@ -76,8 +88,9 @@ combineExpression <- function(input.data,
#Retain the full clone information
full.clone <- lapply(input.data, function(x) {
x[,c("barcode", cloneCall)]
- full.clone <- bind_rows(full.clone)
+
})
+ full.clone <- bind_rows(full.clone)
for(i in seq_along(input.data)) {
input.data[[i]] <- .off.the.chain(input.data[[i]], chain, cloneCall)
}
@@ -179,7 +192,7 @@ combineExpression <- function(input.data,
clone_sym <- sym(cloneCall)
PreMeta <- PreMeta %>%
left_join(full.clone, by = "barcode", suffix = c("", ".from_full_clones")) %>%
- mutate(!!column_sym := coalesce(!!sym(paste0(cloneCall, ".from_full_clones")), !!column_sym)) %>%
+ mutate(!!clone_sym := coalesce(!!sym(paste0(cloneCall, ".from_full_clones")), !!clone_sym)) %>%
select(-all_of(paste0(cloneCall, ".from_full_clones")))
}
barcodes <- PreMeta$barcode
@@ -226,14 +239,4 @@ combineExpression <- function(input.data,
return(sc.data)
}
-
.warn_str <- "< 1% of barcodes match: Ensure the barcodes in the single-cell object match the barcodes in the combined immune receptor output from scRepertoire. If getting this error, please check https://www.borch.dev/uploads/screpertoire/articles/faq."
-
-
-
-
-
-
-
-
-
diff --git a/R/positionalProperty.R b/R/positionalProperty.R
index 522dc1f2..9b930ba1 100644
--- a/R/positionalProperty.R
+++ b/R/positionalProperty.R
@@ -47,6 +47,7 @@
#' @export
#' @concept Summarize_Repertoire
#' @return ggplot of line graph of diversity by position
+#' @author Florian Bach, Nick Borcherding
positionalProperty <- function(input.data,
chain = "TRB",
@@ -83,6 +84,8 @@ positionalProperty <- function(input.data,
#Getting AA Counts
aa.count.list <- .aa.counter(input.data, cloneCall, aa.length)
+ aa.count.list <- lapply(aa.count.list, function(x)subset(x, x$AA %in% c("A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V")))
+
#Calculating properties and melting data
lapply(seq_along(aa.count.list), function(x) {
lapply(seq_len(nrow(aa.count.list[[x]]))[-1], function(y) {
diff --git a/R/typecheck.R b/R/typecheck.R
new file mode 100644
index 00000000..16bc922f
--- /dev/null
+++ b/R/typecheck.R
@@ -0,0 +1,56 @@
+# scRepertoire objects
+
+isCombineContigsOutput <- function(obj) {
+ is.list(obj) && all(sapply(obj, is.data.frame))
+}
+assertthat::on_failure(isCombineContigsOutput) <- function(call, env) {
+ paste0(deparse(call$obj), " is not an output of combineTCR or combineBCR")
+}
+
+isListOfTwoCombineContigsOutputs <- function(obj) {
+ is.list(obj) && length(obj) == 2 && all(sapply(obj, isCombineContigsOutput))
+}
+assertthat::on_failure(isListOfTwoCombineContigsOutputs) <- function(call, env) {
+ paste0(
+ deparse(call$obj),
+ " is not a list of two outputs of combineTCR and combineBCR"
+ )
+}
+
+isAnyValidProductOfCombineContigs <- function(obj) {
+ isCombineContigsOutput(obj) || isListOfTwoCombineContigsOutputs(obj)
+}
+assertthat::on_failure(isAnyValidProductOfCombineContigs) <- function(call, env) {
+ paste0(
+ deparse(call$obj),
+ " is not a valid output of combineTCR or combineBCR, nor a list of them"
+ )
+}
+
+# bio objects
+
+is_seurat_object <- function(obj) inherits(obj, "Seurat")
+assertthat::on_failure(is_seurat_object) <- function(call, env) {
+ paste0(deparse(call$obj), " is not a Seurat object")
+}
+
+is_se_object <- function(obj) inherits(obj, "SummarizedExperiment")
+assertthat::on_failure(is_se_object) <- function(call, env) {
+ paste0(deparse(call$obj), " is not a SummarizedExperiment object")
+}
+
+is_seurat_or_se_object <- function(obj) {
+ is_seurat_object(obj) || is_se_object(obj)
+}
+assertthat::on_failure(is_seurat_or_se_object) <- function(call, env) {
+ paste0(deparse(call$obj), " is not a Seurat or SummarizedExperiment object")
+}
+
+# general objects
+
+is_named_numeric <- function(obj) {
+ is.numeric(obj) && !is.null(names(obj))
+}
+assertthat::on_failure(is_named_numeric) <- function(call, env) {
+ paste0(deparse(call$obj), " is not a named numeric vector")
+}
diff --git a/R/utils.R b/R/utils.R
index ac71154c..9adaa929 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -1,10 +1,5 @@
-# readability functions
+# readability functions with appropriate assertthat fail messages
"%!in%" <- Negate("%in%")
-is_seurat_object <- function(obj) inherits(obj, "Seurat")
-is_se_object <- function(obj) inherits(obj, "SummarizedExperiment")
-is_seurat_or_se_object <- function(obj) {
- is_seurat_object(obj) || is_se_object(obj)
-}
#'@importFrom stringr str_sort
.ordering.function <- function(vector,
@@ -148,7 +143,7 @@ is_seurat_or_se_object <- function(obj) {
.checkList <- function(df) {
df <- tryCatch(
{
- if (!inherits(df, "list")) {
+ if (!inherits(df, "list")) {
df <- list(df)
}
df
@@ -629,7 +624,12 @@ is_df_or_list_of_df <- function(x) {
edge.list <- do.call(rbind, edge.list)
if(exportGraph) {
- graph <- graph_from_edgelist(as.matrix(edge.list)[,c(1,2)])
+ if(!is.null(edge.list)) {
+ graph <- graph_from_edgelist(as.matrix(edge.list)[,c(1,2)])
+
+ } else {
+ graph <- NULL
+ }
return(graph)
}
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 782a0aff..484a579b 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -47,6 +47,8 @@ navbar:
- text: Quantifying Clonal Bias
href: articles/Clonal_Bias.html
- text: '-------'
+ - text: Making Deep Learning Models with immApex
+ href: articles/immApex.html
- text: Combining Deep Learning and TCRs with Trex
href: articles/Trex.html
- text: Combining Deep Learning and BCRs with Ibex
diff --git a/inst/pkgdown.yml b/inst/pkgdown.yml
index a314a62a..84ebdfa5 100644
--- a/inst/pkgdown.yml
+++ b/inst/pkgdown.yml
@@ -1,5 +1,5 @@
pandoc: 3.1.1
-pkgdown: 2.0.9
+pkgdown: 2.0.7
pkgdown_sha: ~
articles:
Attaching_SC: Attaching_SC.html
@@ -18,8 +18,9 @@ articles:
Running_Escape: Running_Escape.html
SC_Visualizations: SC_Visualizations.html
Trex: Trex.html
+ immApex: immApex.html
vignette: vignette.html
-last_built: 2024-05-17T17:28Z
+last_built: 2024-07-15T18:40Z
urls:
reference: https://www.borch.dev/uploads/scRepertoire/reference
article: https://www.borch.dev/uploads/scRepertoire/articles
diff --git a/man/positionalProperty.Rd b/man/positionalProperty.Rd
index fc0de99a..787c33c3 100644
--- a/man/positionalProperty.Rd
+++ b/man/positionalProperty.Rd
@@ -67,4 +67,7 @@ positionalProperty(combined,
method = "Atchley",
aa.length = 20)
}
+\author{
+Florian Bach, Nick Borcherding
+}
\concept{Summarize_Repertoire}
diff --git a/man/scRepertoire-package.Rd b/man/scRepertoire-package.Rd
index dd9ccefc..a13d4304 100644
--- a/man/scRepertoire-package.Rd
+++ b/man/scRepertoire-package.Rd
@@ -11,7 +11,7 @@ scRepertoire is a toolkit for processing and analyzing single-cell T-cell recept
\seealso{
Useful links:
\itemize{
- \item \url{https://www.borch.dev/uploads/screpertoire/}
+ \item \url{https://www.borch.dev/uploads/scRepertoire/}
\item Report bugs at \url{https://github.com/ncborcherding/scRepertoire/issues}
}
@@ -21,7 +21,7 @@ Useful links:
Authors:
\itemize{
- \item Qile Yang \email{qile0317@gmail.com}
+ \item Qile Yang \email{qile.yang@berkeley.edu}
\item Ksenia Safina \email{safina@broadinstitute.org}
}
diff --git a/src/constructConDfAndparseTCR.cpp b/src/constructConDfAndparseTCR.cpp
index d54d4599..9e977b6a 100644
--- a/src/constructConDfAndparseTCR.cpp
+++ b/src/constructConDfAndparseTCR.cpp
@@ -73,6 +73,8 @@ class TcrParser {
handleTcr1(y, index);
} else if (chainType == "TRB" || chainType == "TRD") {
handleTcr2(y, index);
+ } else {
+ Rcpp::stop("Invalid chain type: " + chainType + " for barcode: " + conDf[0][y]);
}
}
}
diff --git a/tests/testthat/_snaps/positionalProperty/positionalentropy-kidera-plot.svg b/tests/testthat/_snaps/positionalProperty/positionalentropy-kidera-plot.svg
index 7d2bd8a1..de5e27cf 100644
--- a/tests/testthat/_snaps/positionalProperty/positionalentropy-kidera-plot.svg
+++ b/tests/testthat/_snaps/positionalProperty/positionalentropy-kidera-plot.svg
@@ -27,198 +27,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2150,46 +2070,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-pos1
-pos2
-pos3
-pos4
-pos5
-pos6
-pos7
-pos8
-pos9
-pos10
-pos11
-pos12
-pos13
-pos14
-pos15
-pos16
-pos17
-pos18
-pos19
-pos20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+pos1
+pos2
+pos3
+pos4
+pos5
+pos6
+pos7
+pos8
+pos9
+pos10
+pos11
+pos12
+pos13
+pos14
+pos15
+pos16
+pos17
+pos18
+pos19
-2
-1
diff --git a/tests/testthat/_snaps/positionalProperty/positionalentropy-stscales-plot.svg b/tests/testthat/_snaps/positionalProperty/positionalentropy-stscales-plot.svg
index 5f3dbd8f..c836e161 100644
--- a/tests/testthat/_snaps/positionalProperty/positionalentropy-stscales-plot.svg
+++ b/tests/testthat/_snaps/positionalProperty/positionalentropy-stscales-plot.svg
@@ -27,198 +27,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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+pos7
+pos8
+pos9
+pos10
+pos11
+pos12
+pos13
+pos14
+pos15
+pos16
+pos17
+pos18
+pos19
-2
-1
diff --git a/tests/testthat/_snaps/positionalProperty/positionalentropy-tra-plot.svg b/tests/testthat/_snaps/positionalProperty/positionalentropy-tra-plot.svg
index 44eed91b..41b030f8 100644
--- a/tests/testthat/_snaps/positionalProperty/positionalentropy-tra-plot.svg
+++ b/tests/testthat/_snaps/positionalProperty/positionalentropy-tra-plot.svg
@@ -27,198 +27,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -229,198 +221,190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,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-pos1
-pos2
-pos3
-pos4
-pos5
-pos6
-pos7
-pos8
-pos9
-pos10
-pos11
-pos12
-pos13
-pos14
-pos15
-pos16
-pos17
-pos18
-pos19
-pos20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+pos1
+pos2
+pos3
+pos4
+pos5
+pos6
+pos7
+pos8
+pos9
+pos10
+pos11
+pos12
+pos13
+pos14
+pos15
+pos16
+pos17
+pos18
+pos19
-5.0
-2.5
diff --git a/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-order-plot.svg b/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-order-plot.svg
index e1a77cd4..2ea00b81 100644
--- a/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-order-plot.svg
+++ b/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-order-plot.svg
@@ -27,198 +27,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1085,46 +1045,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-pos1
-pos2
-pos3
-pos4
-pos5
-pos6
-pos7
-pos8
-pos9
-pos10
-pos11
-pos12
-pos13
-pos14
-pos15
-pos16
-pos17
-pos18
-pos19
-pos20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+pos1
+pos2
+pos3
+pos4
+pos5
+pos6
+pos7
+pos8
+pos9
+pos10
+pos11
+pos12
+pos13
+pos14
+pos15
+pos16
+pos17
+pos18
+pos19
-4
-2
diff --git a/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-plot.svg b/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-plot.svg
index 5ae2e2cd..a58b2fe0 100644
--- a/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-plot.svg
+++ b/tests/testthat/_snaps/positionalProperty/positionalentropy-trb-plot.svg
@@ -27,198 +27,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1085,46 +1045,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-pos1
-pos2
-pos3
-pos4
-pos5
-pos6
-pos7
-pos8
-pos9
-pos10
-pos11
-pos12
-pos13
-pos14
-pos15
-pos16
-pos17
-pos18
-pos19
-pos20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+pos1
+pos2
+pos3
+pos4
+pos5
+pos6
+pos7
+pos8
+pos9
+pos10
+pos11
+pos12
+pos13
+pos14
+pos15
+pos16
+pos17
+pos18
+pos19
-4
-2
diff --git a/tests/testthat/_snaps/positionalProperty/positionalentropy-tscales-plot.svg b/tests/testthat/_snaps/positionalProperty/positionalentropy-tscales-plot.svg
index 12af8e0a..6d754794 100644
--- a/tests/testthat/_snaps/positionalProperty/positionalentropy-tscales-plot.svg
+++ b/tests/testthat/_snaps/positionalProperty/positionalentropy-tscales-plot.svg
@@ -27,198 +27,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1085,46 +1045,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-pos1
-pos2
-pos3
-pos4
-pos5
-pos6
-pos7
-pos8
-pos9
-pos10
-pos11
-pos12
-pos13
-pos14
-pos15
-pos16
-pos17
-pos18
-pos19
-pos20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+pos1
+pos2
+pos3
+pos4
+pos5
+pos6
+pos7
+pos8
+pos9
+pos10
+pos11
+pos12
+pos13
+pos14
+pos15
+pos16
+pos17
+pos18
+pos19
-9
-6
diff --git a/tests/testthat/_snaps/positionalProperty/positionalentropy-vhse-plot.svg b/tests/testthat/_snaps/positionalProperty/positionalentropy-vhse-plot.svg
index 9a2e5173..3176eb9d 100644
--- a/tests/testthat/_snaps/positionalProperty/positionalentropy-vhse-plot.svg
+++ b/tests/testthat/_snaps/positionalProperty/positionalentropy-vhse-plot.svg
@@ -27,198 +27,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -229,198 +221,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1724,46 +1660,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-pos1
-pos2
-pos3
-pos4
-pos5
-pos6
-pos7
-pos8
-pos9
-pos10
-pos11
-pos12
-pos13
-pos14
-pos15
-pos16
-pos17
-pos18
-pos19
-pos20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+pos1
+pos2
+pos3
+pos4
+pos5
+pos6
+pos7
+pos8
+pos9
+pos10
+pos11
+pos12
+pos13
+pos14
+pos15
+pos16
+pos17
+pos18
+pos19
-1
0
diff --git a/tests/testthat/test-alluvialClones.R b/tests/testthat/test-alluvialClones.R
index 619a9464..42584b76 100644
--- a/tests/testthat/test-alluvialClones.R
+++ b/tests/testthat/test-alluvialClones.R
@@ -34,10 +34,10 @@ test_that("alluvialClones works", {
expect_doppelganger(
"alluvialClones_alpha_plot",
- alluvialClones(test_obj,
+ suppressWarnings(alluvialClones(test_obj,
cloneCall = "aa",
y.axes = c("Type", "ident"),
- alpha = "Patient")
+ alpha = "Patient"))
)
expect_doppelganger(
diff --git a/tests/testthat/test-clonalNetwork.R b/tests/testthat/test-clonalNetwork.R
index ffce6f1b..015a0a6c 100644
--- a/tests/testthat/test-clonalNetwork.R
+++ b/tests/testthat/test-clonalNetwork.R
@@ -1,7 +1,5 @@
# test script for clonalNetwork.R - testcases are NOT comprehensive!
-# library(ggraph) # Qile: I believe libraries shouldn't need to be loaded in scripts? Correct me if im wrong.
-
test_that("clonalNetwork works", {
library(ggraph)
data("scRep_example")
diff --git a/vignettes/articles/immApex.Rmd b/vignettes/articles/immApex.Rmd
new file mode 100644
index 00000000..6464590f
--- /dev/null
+++ b/vignettes/articles/immApex.Rmd
@@ -0,0 +1,551 @@
+---
+title: "Making Deep Learning Models with immApex"
+date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`'
+output: rmarkdown::html_vignette
+theme: united
+df_print: kable
+vignette: >
+ %\VignetteIndexEntry{Making Deep Learning Models with immApex}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+
+
+```{r setup, include=FALSE}
+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(immApex))
+suppressMessages(library(keras))
+suppressMessages(library(ggplot2))
+suppressMessages(library(viridis))
+suppressMessages(library(dplyr))
+```
+
+# Getting Started
+
+**immApex** is meant to serve as an API for deep-learning models based on immune receptor sequencing. These functions extract or generate amino acid or nucleotide sequences and prepare them for deep learning tasks through [Keras](https://tensorflow.rstudio.com/guides/keras/basics). **immApex** is the underlying structure for the BCR models in [Ibex](https://github.com/ncborcherding/Ibex) and TCR models in [Trex](https://github.com/ncborcherding/Trex). It should be noted, although the tools here are created for immune receptor sequences, they will work more generally for nucleotide or amino acid sequences.
+
+More information is available at the [immApex GitHub Repo](https://github.com/ncborcherding/immApex).
+
+# Getting and Manipulating Sequences
+
+## generateSequences
+
+Generating synthetic sequences is a quick way to start testing the model code. ```generateSequences()``` can also generate realistic noise for generative adversarial networks.
+
+Parameters for ```generateSequences()```
+
+* **prefix.motif** Add a defined sequence to the start of the generated sequences.
+* **suffix.motif** Add a defined sequence to the end of the generated sequences
+number.of.sequences Number of sequences to generate
+* **min.length** Minimum length of the final sequence (will be adjusted if incongruent with prefix.motif/suffix.motif)
+* **max.length** Maximum length of the final sequence
+* **sequence.dictionary** The letters to use in sequence generation (default are all amino acids)
+
+```{r tidy = FALSE}
+sequences <- generateSequences(prefix.motif = "CAS",
+ suffix.motif = "YF",
+ number.of.sequences = 1000,
+ min.length = 8,
+ max.length = 16)
+head(sequences)
+```
+
+If we want to generate nucleotide sequences instead of amino acids, we just need to change the **sequence.dictionary**.
+
+```{r tidy = FALSE}
+nucleotide.sequences <- generateSequences(number.of.sequences = 1000,
+ min.length = 8,
+ max.length = 16,
+ sequence.dictionary = c("A", "C", "T", "G"))
+head(nucleotide.sequences)
+```
+
+## variationalSequences
+
+In addition to making random sequences with ```generateSequences()```, we can also use generative deep learning to simulate similar, de novo sequences with ```variationalSequences()```. ```variationalSequences()``` uses a variational autoencoder that allows for sampling and generation of sequences similar to the input sequences.
+
+It should be noted that the success of this approach is highly dependent on the number of sequences used as input and the hyperparameters of the model. As such, ```variationalSequences()``` has a number of arguments to modify to allow for optimization.
+
+Parameters for ```variationalSequences()``
+
+* **input.sequences** The amino acid or nucleotide sequences to use
+* **encoder.function** The method to prepare the sequencing information - **"onehotEncoder"** or **"propertyEncoder"**
+* **aa.method.to.use** The method or approach to use for the conversion, see ```propertyEncoder()```
+* **number.of.sequences** Number of sequences to generate
+* **encoder.hidden.dim** A vector of the neurons to use in the hidden layers for the encoder portion of the model
+* **decoder.hidden.dim** A vector of the neurons to use in the hidden layers for the decoder portion of the model. If NULL assumes symmetric autoencoder
+* **latent.dim** The size of the latent dimensions
+* **batch.size** The batch size to use for VAE training
+* **epochs** The number of epochs to use in VAE training
+* **learning.rate** The learning rate to use in VAE training
+* **epsilon.std** The epsilon to use in VAE training
+* **call.threshold** The relative strictness of sequence calling with higher values being more stringent
+* **activation.function** The activation for the dense connected layers
+* **optimizer** The optimizer to use in VAE training
+* **disable.eager.execution** Disable the eager execution parameter for tensorflow.
+* **sequence.dictionary** The letters to use in sequence mutation (default are all amino acids)
+
+```{r}
+variational.sequences <- variationalSequences(sequences,
+ encoder = "onehotEncoder",
+ number.of.sequences = 100,
+ encoder.hidden.dim = c(256, 128),
+ latent.dim = 16,
+ batch.size = 16,
+ call.threshold = 0.1)
+head(variational.sequences)
+```
+## mutateSequences
+
+A common approach is to mutate sequences randomly or at specific intervals. This can be particularly helpful if we have fewer sequences or want to test a model for accuracy given new, altered sequences. mutateSequences() allows us to tune the type of mutation, where along the sequences to introduce the mutation and the overall number of mutations.
+
+Parameters for ```mutateSequences()```
+
+* **input.sequences** The amino acid or nucleotide sequences to use
+* **n.sequences** The number of mutated sequences to return per input.sequence
+* **mutation.rate** The rate of mutations introduced into sequences
+* **position.start** The starting position to mutate along the sequence. Default NULL will start the random mutations at position 1.
+* **position.end** The ending position to mutate along the sequence. Default NULL will end the random mutations at the last position.
+* **sequence.dictionary** The letters to use in sequence mutation (default are all amino acids)
+
+```{r tidy = FALSE}
+mutated.sequences <- mutateSequences(sequences,
+ n.sequence = 1,
+ position.start = 3,
+ position.end = 8)
+head(sequences)
+head(mutated.sequences)
+```
+
+## formatGenes
+
+Immune receptor nomenclature can be highly variable across sequencing platforms. When preparing data for models, we can use ```formatGenes() `` to universalize the gene formats into IMGT nomenclature.
+
+Parameters for ```formatGenes()```
+
+* **input.data** Data frame of sequencing data or scRepertoire outputs
+* **region** Sequence gene loci to access - 'v', 'd', 'j', 'c' or a combination using c('v', 'd', 'j')
+* **technology** The sequencing technology employed - 'TenX', "Adaptive', 'AIRR', or 'Omniscope'.
+* **species** One or two word designation of species. Currently supporting: "human", "mouse", "rat", "rabbit", "rhesus monkey", "sheep", "pig", "platypus", "alpaca", "dog", "chicken", and "ferret"
+* **simplify.format** If applicable, remove the allelic designation (TRUE) or retain all information (FALSE)
+
+Here, we will use the built-in example from Adaptive Biotechnologies and reformat and simplify the **v** region. ```formatGenes()``` will add 2 columns to the end of the data frame per region selected - 1) **v_IMGT** will be the formatted gene calls and 2) **v_IMGT.check** is a binary for if the formatted region appears in the IMGT database. In the example below, "TRBV2-1" is not recognized as a designation within IMGT.
+
+```{r tidy = FALSE}
+Adaptive_example <- formatGenes(immapex_example.data[["Adaptive"]],
+ region = "v",
+ technology = "Adaptive",
+ simplify.format = TRUE)
+
+head(Adaptive_example[,c("aminoAcid","vGeneName", "v_IMGT", "v_IMGT.check")])
+```
+
+## getIMGT
+
+Depending on the sequencing technology and the version, we might want to expand the length of our sequence embedding approach. The first step in the process is pulling the reference sequences from the ImMunoGeneTics (IMGT) system using ```getIMGT()```. More information for IMGT can be found at [imgt.org](https://www.imgt.org/).
+
+Parameters for ```getIMGT()```
+
+* **species** One or two word designation of species. Currently supporting: "human", "mouse", "rat", "rabbit", "rhesus monkey", "sheep", "pig", "platypus", "alpaca", "dog", "chicken", and "ferret"
+* **chain** Sequence chain to access
+* **frame** Designation for "all", "inframe" or "inframe+gap"
+* **region** Sequence gene loci to access
+* **sequence.type** Type of sequence - "aa" for amino acid or "nt" for nucleotide
+
+Here, we will use the ```getIMGT()``` function to get the amino acid sequences for the TRBV region to get all the sequences by V gene allele.
+
+```{r tidy = FALSE}
+TRBV_aa <- getIMGT(species = "human",
+ chain = "TRB",
+ frame = "inframe",
+ region = "v",
+ sequence.type = "aa")
+
+TRBV_aa[[1]][1]
+```
+
+## inferCDR
+
+We can now use ```inferCDR()``` to add additional sequence elements to our example data using the outputs of ```formatGenes()``` and ```getIMGT()```. Here, we will use the function to isolate the complementarity-determining regions (CDR) 1 and 2. If the gene nomenclature does not match the IMGT the result will be NA for the given sequences. Likewise, if the IMGT nomenclature has been simplified, the first allelic match will be used for sequence extraction.
+
+Parameters for ```inferCDR```
+
+* **input.data** Data frame of sequencing data or output from formatGenes().
+* **reference** IMGT sequences from ```getIMGT()```
+* **technology** The sequencing technology employed - 'TenX', "Adaptive', 'AIRR', or 'Omniscope'
+* **sequence.type** Type of sequence - "aa" for amino acid or "nt" for nucleotide
+* **sequences** The specific regions of the CDR loop to get from the data.
+
+```{r tidy = FALSE}
+Adaptive_example <- inferCDR(Adaptive_example,
+ chain = "TRB",
+ reference = TRBV_aa,
+ technology = "Adaptive",
+ sequence.type = "aa",
+ sequences = c("CDR1", "CDR2"))
+
+Adaptive_example[200:210,c("CDR1_IMGT", "CDR2_IMGT")]
+```
+
+# Encoders
+
+## onehotEncoder
+
+One hot encoding of amino acid or nucleotide sequences is a common method for transforming sequences into numeric matrices compatible with Keras (or other workflows).
+
+Parameters for ```onehotEncoder()```
+
+* **input.sequences** The amino acid or nucleotide sequences to use
+* **max.length** Additional length to pad, NULL will pad sequences to the max length of input.sequences
+* **convert.to.matrix** Return a matrix (**TRUE**) or a 3D array (**FALSE**)
+* **sequence.dictionary** The letters to use in encoding (default are all amino acids + NA value)
+
+```{r tidy = FALSE}
+sequence.matrix <- onehotEncoder(input.sequences = c(sequences, mutated.sequences),
+ convert.to.matrix = TRUE)
+head(sequence.matrix[,1:20])
+```
+
+## propertyEncoder
+
+An alternative to one hot encoding is transforming the sequences into an array/matrix of numerical values using amino acid properties.
+
+These properties are largely based on dimensional reduction strategies, but it is essential to know the assumptions for each approach (links to original work below). **Important to note: ** this encoding strategy is specific for amino acids.
+
+**method.to.use**
+
+* atchleyFactors - [citation](https://pubmed.ncbi.nlm.nih.gov/15851683/)
+* crucianiProperties - [citation](https://analyticalsciencejournals.onlinelibrary.wiley.com/doi/abs/10.1002/cem.856)
+* FASGAI - [citation](https://pubmed.ncbi.nlm.nih.gov/18318694/)
+* kideraFactors - [citation](https://link.springer.com/article/10.1007/BF01025492)
+* MSWHIM - [citation](https://pubs.acs.org/doi/10.1021/ci980211b)
+* ProtFP - [citation](https://pubmed.ncbi.nlm.nih.gov/24059694/)
+* stScales - [citation](https://pubmed.ncbi.nlm.nih.gov/19373543/)
+* tScales - [citation](https://www.sciencedirect.com/science/article/abs/pii/S0022286006006314)
+* VHSE - [citation](https://pubmed.ncbi.nlm.nih.gov/15895431/)
+* zScales - [citation](https://pubmed.ncbi.nlm.nih.gov/9651153/)
+
+
+```{r tidy = FALSE}
+property.matrix <- propertyEncoder(input.sequences = c(sequences, mutated.sequences),
+ method.to.use = "FASGAI",
+ convert.to.matrix = TRUE)
+
+head(property.matrix[,1:20])
+```
+
+```propertyEncoder()``` also allows us to use multiple approaches simultaneously by setting **method.to.use** as a vector.
+
+```{r tidy = FALSE}
+mulit.property.matrix <- propertyEncoder(input.sequences = c(sequences, mutated.sequences),
+ method.to.use = c("atchleyFactors", "kideraFactors"),
+ convert.to.matrix = TRUE)
+
+head(mulit.property.matrix[,1:20])
+```
+
+If, instead, we would like to get the set of summarized values across all amino acid residues for a given **method.to.use**, we can use **summary.function** and select "median", "mean", "sum", variance ("vars"), or Median Absolute Deviation ("mads").
+
+```{r tidy = FALSE}
+median.property.matrix <- propertyEncoder(input.sequences = c(sequences, mutated.sequences),
+ method.to.use = "crucianiProperties",
+ summary.function = "median")
+
+head(median.property.matrix[,1:3])
+```
+
+## geometricEncoder
+
+One approach to encode amino acid sequences is geometric isometry, such as [GIANA](https://pubmed.ncbi.nlm.nih.gov/34349111/).
+
+Parameters for ```geometricEncoder()```
+
+* **method.to.use** Select the following substitution matrices: "BLOSUM45", "BLOSUM50", "BLOSUM62", "BLOSUM80", "BLOSUM100", "PAM30", "PAM40", "PAM70", "PAM120", or "PAM250"
+* **theta** The angle in which to create the rotation matrix
+
+```{r tidy = FALSE}
+geometric.matrix <- geometricEncoder(sequences,
+ method.to.use = "BLOSUM62",
+ theta = pi/3)
+head(geometric.matrix)
+```
+
+## tokenizeSequences
+
+Another approach to transforming a sequence into numerical values is tokenizing it into numbers. This is a common approach for recurrent neural networks where one letter corresponds to a single integer. In addition, we can add a start and stop tokens to our original sequences to differentiate between the beginning and end of the sequences.
+
+Parameters for ```tokenizeSequences()```
+
+* **add.startstop** Add start and stop tokens to the sequence
+* **start.token** The character to use for the start token
+* **stop.token** The character to use for the stop token
+* **max.length** Additional length to pad, NULL will pad sequences to the max length of input.sequences
+* **convert.to.matrix** Return a matrix (**TRUE**) or a vector (**FALSE**)
+
+```{r tidy = FALSE}
+token.matrix <- tokenizeSequences(input.sequences = c(sequences, mutated.sequences),
+ add.startstop = TRUE,
+ start.token = "!",
+ stop.token = "^",
+ convert.to.matrix = TRUE)
+head(token.matrix[,1:18])
+```
+
+## probabilityMatrix
+
+Another method for encoding a group of sequences is to calculate the positional probability of sequences using ```probabilityMatrixs()```. This function could represent a collection of antigen-specific sequences or even work on embedding a total repertoire.
+
+```{r tidy = FALSE}
+ppm.matrix <- probabilityMatrix(sequences)
+head(ppm.matrix)
+```
+
+In addition, ```probabilityMatrix()``` can convert the positional probability matrix into a positional weight matrix using log-likelihood using the argument **convert.PWM** = TRUE. We can provide a set of background frequencies for the amino acids with **background.frequencies** or leave this blank to assume a uniform distribution for all amino acids. Here, we are going to use an example background.
+
+```{r tidy = FALSE}
+set.seed(42)
+back.freq <- sample(1:1000, 20)
+back.freq <- back.freq/sum(back.freq)
+
+pwm.matrix <- probabilityMatrix(sequences,
+ max.length = 20,
+ convert.PWM = TRUE,
+ background.frequencies = back.freq)
+head(pwm.matrix)
+```
+
+## adjacencyMatrix
+
+Similar to the positional probability, we can also summarize a given set of sequences by the frequency of adjacency for a given set of amino acid or nucleotide residues using ```adjacencyMatrix()```. For this function, a matrix of n x n (defined by the length of **sequence.dictionary**) is created and the number of times a residue is adjacent to one another is calculated. We can **normalize** the values using the total number of residues evaluated.
+
+```{r tidy = FALSE}
+adj.matrix <- adjacencyMatrix(sequences,
+ normalize = FALSE)
+adj.matrix
+```
+
+# Extracting Sequences
+
+## sequenceDecoder
+
+We have a function called ```sequenceDecoder()``` that extracts sequences from one-hot or property-encoded matrices or arrays. This function can be applied to any generative approach to sequence generation.
+
+Parameters for ```sequenceDecoder()```
+
+* **sequence.matrix** The encoded sequences to decode in an array or matrix
+* **encoder** The method to prepare the sequencing information - "onehotEncoder" or "propertyEncoder"
+* **aa.method.to.use** The method or approach to use for the conversion corresponding to the input to ```propertyEncoder()```. This will be ignored if **encoder** = "onehotEncoder"
+* **call.threshold** The relative strictness of sequence calling with higher values being more stringent
+
+```{r}
+property.matrix <- propertyEncoder(input.sequences = c(sequences, mutated.sequences),
+ method.to.use = "FASGAI",
+ convert.to.matrix = TRUE)
+
+property.sequences <- sequenceDecoder(property.matrix,
+ encoder = "propertyEncoder",
+ aa.method.to.use = "FASGAI",
+ call.threshold = 1)
+head(sequences)
+head(property.sequences)
+```
+
+A similar approach can be applied when using matrices or arrays derived from one-hot encoding:
+
+```{r}
+sequence.matrix <- onehotEncoder(input.sequences = c(sequences, mutated.sequences),
+ convert.to.matrix = TRUE)
+
+OHE.sequences <- sequenceDecoder(sequence.matrix,
+ encoder = "onehotEncoder")
+
+head(OHE.sequences)
+```
+
+# Training a Model
+
+## Autoencoder
+
+For the vignette - we will use an autoencoder for sequence embedding. The code below is based on the [Trex](https://github.com/ncborcherding/Trex) R package. The overall structure of the autoencoder is the same. However, some of the parameters are modified for the sake of the vignette. We will use the **sequence.matrix** we generated above from the ```onehotEncoder()```.
+
+The steps to train the model include:
+
+1. Subsetting sequences
+2. Defining parameters for the model
+3. Forming the autoencoder structure - encoder and decoder
+4. Fitting the model
+
+```{r tidy = FALSE}
+#Sampling to make Training/Valid Data
+set.seed(42)
+num_sequences <- nrow(sequence.matrix)
+indices <- 1:num_sequences
+train_indices <- sample(indices, size = floor(0.8 * num_sequences))
+val_indices <- setdiff(indices, train_indices)
+
+x_train <- sequence.matrix[train_indices,]
+x_val <- sequence.matrix[val_indices,]
+
+# Parameters
+input_shape <- dim(x_train)[2]
+epochs <- 20
+batch_size <- 128
+encoding_dim <- 40
+hidden_dim1 <- 256 # Hidden layer 1 size
+hidden_dim2 <- 128 # Hidden layer 2 size
+
+es = callback_early_stopping(monitor = "val_loss",
+ min_delta = 0,
+ patience = 4,
+ verbose = 1,
+ mode = "min")
+
+# Define the Model
+input_seq <- layer_input(shape = c(input_shape))
+
+# Encoder Layers
+encoded <- input_seq %>%
+ layer_dense(units = hidden_dim1, name = "e.1") %>%
+ layer_batch_normalization(name = "bn.1") %>%
+ layer_activation('leaky_relu', name = "act.1") %>%
+ layer_dense(units = hidden_dim2, name = "e.2") %>%
+ layer_batch_normalization(name = "bn.2") %>%
+ layer_activation('leaky_relu', name = "act.2") %>%
+ layer_dense(units = encoding_dim, activation = 'selu', name = "latent")
+
+# Decoder Layers
+decoded <- encoded %>%
+ layer_dense(units = hidden_dim2, name = "d.2") %>%
+ layer_batch_normalization(name = "bn.3") %>%
+ layer_activation('leaky_relu', name = "act.3") %>%
+ layer_dense(units = hidden_dim1, name = "d.1") %>%
+ layer_batch_normalization(name = "bn.4") %>%
+ layer_activation('leaky_relu', name = "act.4") %>%
+ layer_dense(units = input_shape, activation = 'sigmoid')
+
+# Autoencoder Model
+autoencoder <- keras_model(input_seq, decoded)
+autoencoder %>% keras::compile(optimizer = optimizer_adam(learning_rate = 0.0001),
+ loss = "mse")
+
+# Train the model
+history <- autoencoder %>% fit(x = x_train,
+ y = x_train,
+ validation_data = list(x_val, x_val),
+ epochs = epochs,
+ batch_size = batch_size,
+ shuffle = TRUE,
+ callbacks = es,
+ verbose = 0)
+
+plot(history) +
+ scale_color_viridis(option = "B", discrete = TRUE) +
+ scale_fill_manual(values = c("black","black")) +
+ theme_classic()
+```
+
+## Classifier
+
+We can also build classifiers directly using deep or shallow neural networks. Building deep classifiers requires more data than classical machine learning methods, like random forests, so the vignette may not be ideal.
+
+The first step is to generate distinct types of sequences using ```generateSequences()``` and ```onehotEncoder()``` to prepare the data for the model.
+
+```{r tidy = FALSE}
+class1.sequences <- generateSequences(prefix.motif = "CAS",
+ suffix.motif = "YF",
+ number.of.sequences = 10000,
+ min.length = 8,
+ max.length = 16)
+
+class2.sequences <- generateSequences(prefix.motif = "CASF",
+ suffix.motif = "YF",
+ number.of.sequences = 10000,
+ min.length = 8,
+ max.length = 16)
+
+labels <- as.numeric(c(rep(0, 10000), rep(1, 10000)))
+
+classifier.matrix <- onehotEncoder(input.sequences = c(class1.sequences, class2.sequences),
+ convert.to.matrix = TRUE)
+```
+
+Next, we will define and train the Keras classifier model using artificial sequences. We will use a simple convolutional neural network with 2 layers and then a single neuron that will classify the sequences into class 1 or class 2 (here, the labels are 0 and 1).
+
+```{r tidy = FALSE}
+#Input shape will be 1D as we are using a matrix
+input.shape <- dim(classifier.matrix)[2]
+
+#Simple model structure
+classifier.model <- keras_model_sequential() %>%
+ layer_dense(units = 128, activation = "relu",
+ input_shape = c(input.shape)) %>%
+ layer_dense(units = 32, activation = "relu") %>%
+ layer_dense(units = 1, activation = "sigmoid")
+
+classifier.model %>% compile(
+ optimizer = optimizer_adam(learning_rate = 0.00001),
+ loss = "binary_crossentropy",
+ metrics = c("accuracy")
+)
+
+#Seperating data and labels
+set.seed(42)
+val_indices <- sample(nrow(classifier.matrix), 10000*0.2)
+x_val <- classifier.matrix[val_indices,]
+x_train <- classifier.matrix[-val_indices,]
+
+val_labels <- labels[val_indices]
+train_labels <- labels[-val_indices]
+
+#Training the classifier.model
+history <- classifier.model %>% fit(x_train,
+ train_labels,
+ epochs = 20,
+ batch_size = 32,
+ validation_data = list(x_val, val_labels),
+ verbose = 0
+)
+
+plot(history) +
+ scale_color_viridis(option = "B", discrete = TRUE) +
+ scale_fill_manual(values = c("black","black")) +
+ theme_classic()
+```
+
+Here, we can achieve a validation accuracy of 98.25%, which is impressive. But to contextualize, we used ```generateSequences()``` and distinct motifs - "CAS" vs "CASF" to create our 2 classes of sequences. Using sequences from experimental data will likely result in lower accuracy or require greater model complexity.
+
+***
+# Conclusion
+
+This has been a general overview of the capabilities of immApex for processing immune receptor sequences and making deep learning models. If you have any questions, comments, or suggestions, feel free to visit the [GitHub repository](https://github.com/ncborcherding/immApex).
+
+## Session Info
+
+```{r}
+sessionInfo()
+```
+