Skip to content

Commit

Permalink
Adding spelling check and testthat
Browse files Browse the repository at this point in the history
  • Loading branch information
ncborcherding committed Jan 17, 2024
1 parent 85bf06e commit 96865a2
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 11 deletions.
9 changes: 7 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Date: 2023-9-15
Authors@R: c(
person(given = "Nick", family = "Borcherding", role = c("aut", "cre"), email = "ncborch@gmail.com"))
Description: Implementation of the Ibex algorithm for single-cell embedding based on BCR sequences. The package includes a standalone function to encode BCR sequence information by amino acid properties or sequence order using tensorflow-based autoencoder. In addition, the package interacts with SingleCellExperiment or Seurat data objects.
License: MIT
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
LazyDataCompression: xz
Expand Down Expand Up @@ -35,5 +35,10 @@ Suggests:
viridis,
patchwork,
ggplot2,
harmony
harmony,
spelling,
testthat (>= 3.0.0)
VignetteBuilder: knitr
Language: en-US
URL: /~https://github.com/ncborcherding/Ibex/
BugReports: /~https://github.com/ncborcherding/Ibex/issues
2 changes: 1 addition & 1 deletion R/CoNGAfy.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' clonotype group.
#' @param features Selected genes for the reduction DEFAULT: null will return all genes
#' @param assay The name of the assay or assays to return.
#' @param meta.carry Variables to carry over from the meta data of thje single-cell object
#' @param meta.carry Variables to carry over from the meta data of the single-cell object
#'
#' @export
#' @importFrom SeuratObject CreateSeuratObject CreateAssayObject
Expand Down
4 changes: 2 additions & 2 deletions R/ibex_example.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' A seurat object of 315 single B cells in
#' human tonisls
#' A seurat object of 370 single B cells in
#' multisystem inflammatory syndrome
#' @name ibex_example
#' @docType data
#'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ seuratObj <- RunUMAP(seuratObj, reduction = "Ibex", reduction.key = "Ibex_")

If using Seurat package, the Ibex embedding information and gene expression PCA can be used to find the [Weighted Nearest Neighbors](https://pubmed.ncbi.nlm.nih.gov/34062119/). Before applying the WNN approach, best practice would be to remove the BCR-related genes from the list of variable genes and rerunning the PCA analysis.

### Recaluclate PCA without BCR genes with queitBCRgenes() function in Ibex.
### Recalculate PCA without BCR genes with quietBCRgenes() function in Ibex.
```r
seuratObj <- quietBCRgenes(seuratObj)
seuratObj <- RunPCA(seuratObj)
Expand Down
56 changes: 56 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
ADT
AE
Atchley
Autoencoded
Autoencoder
BCR
BCRs
BLOSUM
Biorxiv
CMD
COVID
CoNGA
Codecov
Experiemt
Ig
KF
Kidera
OHE
Satija's
SingleCell
SingleCellExperiment
TCR
Trex
UMAP
VAE
WNN
aaReduction
autoencoded
autoencoder
autoencoders
cdr
clonality
clonotype
clonotypes
combineBCR
customizable
distReduction
geomteric
github
https
keras
multisystem
ncbi
nih
nlm
preprint
pubmed
quietBCRgenes
runIbex
scRepertoire
scran
seurat
tSNE
tensorflow
variational
vectorize
2 changes: 1 addition & 1 deletion man/CoNGAfy.Rd

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

8 changes: 4 additions & 4 deletions man/ibex_example.Rd

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

Binary file added tests/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/spelling.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if(requireNamespace('spelling', quietly = TRUE))
spelling::spell_check_test(vignettes = TRUE, error = FALSE,
skip_on_cran = TRUE)
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/tests.html
# * https://testthat.r-lib.org/reference/test_package.html#special-files

library(testthat)
library(Ibex)

test_check("Ibex")
3 changes: 3 additions & 0 deletions tests/testthat/helper-testingFunctions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
getdata <- function(dir, name) {
readRDS(paste("testdata/", dir, "/", name, ".rds", sep = "")) # could move testdata 1 dir lvl up nstead
}
43 changes: 43 additions & 0 deletions tests/testthat/test-runIbex.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# test script for runTrex.R - testcases are NOT comprehensive!

test_that("runIbex works with seurat objects", {
data("ibex_example")
set.seed(42)

ibex_example <- runIbex(ibex_example,
chains = "Heavy",
method = "encoder",
encoder.model = "VAE",
encoder.input = "AF",
reduction.name = "Heavy_VAE_AF")

expect_equal(
ibex_example@reductions$Heavy_VAE_AF@cell.embeddings,
getdata("runIbex", "runIbex_Heavy_VAE_AF_reduction")
)

ibex_example <- runIbex(ibex_example,
chains = "Light",
method = "encoder",
encoder.model = "AE",
encoder.input = "KF",
reduction.name = "Light_AE_KF")

expect_equal(
ibex_example@reductions$Light_AE_KF@cell.embeddings,
getdata("runIbex", "runIbex_Light_AE_KF_reduction")
)

ibex_example <- runIbex(ibex_example,
chains = "Heavy",
method = "encoder",
encoder.model = "VAE",
encoder.input = "OHE",
reduction.name = "Heavy_VAE_OHE")

expect_equal(
ibex_example@reductions$Heavy_VAE_OHE@cell.embeddings,
getdata("runIbex", "runIbex_Heavy_VAE_OHE_reduction")
)

})
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 96865a2

Please sign in to comment.