Skip to content

Commit

Permalink
troubleshooting bioc build check
Browse files Browse the repository at this point in the history
  • Loading branch information
ncborcherding committed Nov 5, 2024
1 parent ec1c89b commit 16d5de9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 40 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: immApex
Title: Tools for Adaptive Immune Receptor Sequence-Based Keras3 Modeling
Version: 1.0.3
Date: 2024-11-4
Version: 1.0.4
Date: 2024-11-5
Authors@R: c(
person(given = "Nick", family = "Borcherding", role = c("aut", "cre"), email = "[email protected]"))
Description: A set of tools to build tensorflow/keras3-based models in R from amino acid and nucleotide sequences focusing on adaptive immune receptors. The package includes pre-processing of sequences, unifying gene nomenclature usage, encoding sequences, and combining models. This package will serve as the basis of future immune receptor sequence functions/packages/models compatible with the scRepertoire ecosystem.
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# immApex VERSION 1.0.4

## UNDERLYING CHANGES
* Optional testthat variationalSequences() evaulate presence of Keras


# immApex VERSION 1.0.3

## UNDERLYING CHANGES
Expand Down
74 changes: 36 additions & 38 deletions tests/testthat/test-variationalSequences.R
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
# test script for variationalSequences.R - testcases are NOT comprehensive!

test_that("variationalSequences works", {

set.seed(42)
test_that("Test for valid input sequence length", {
expect_error(variationalSequences(input.sequences = character(0)),
"input.sequences must have at least one sequence.")
})

test_that("Test for valid encoder function", {
sequences <- c("CASGY", "CASDY", "CASTY")
expect_error(variationalSequences(input.sequences = sequences,
encoder.function = "invalidEncoder"),
"Invalid encoder provided.")
})

test_that("Test for valid optimizer", {
sequences <- c("CASGY", "CASDY", "CASTY")
expect_error(variationalSequences(input.sequences = sequences,
optimizer = "invalidOptimizer"),
"Please select a compatible optimizer function in the Keras R implementation.")
})

test_that("Test for correct output type", {
sequences <- getdata("generateSequences", "generateSequences_T1")[1:100]
result <- variationalSequences(input.sequences = sequences,
sequence.dictionary = amino.acids[1:20])
expect_true(is.vector(result))
})

test_that("Test for correct sequence generation", {
sequences <- getdata("generateSequences", "generateSequences_T1")[1:100]
number_of_sequences <- 5
result <- variationalSequences(input.sequences = sequences,
number.of.sequences = number_of_sequences)
expect_equal(length(result), number_of_sequences)
})

#TODO Test for Reproducibility

if(reticulate::py_module_available("keras")) {
set.seed(42)
test_that("Test for valid input sequence length", {
expect_error(variationalSequences(input.sequences = character(0)),
"input.sequences must have at least one sequence.")
})

test_that("Test for valid encoder function", {
sequences <- c("CASGY", "CASDY", "CASTY")
expect_error(variationalSequences(input.sequences = sequences,
encoder.function = "invalidEncoder"),
"Invalid encoder provided.")
})

test_that("Test for valid optimizer", {
sequences <- c("CASGY", "CASDY", "CASTY")
expect_error(variationalSequences(input.sequences = sequences,
optimizer = "invalidOptimizer"),
"Please select a compatible optimizer function in the Keras R implementation.")
})

test_that("Test for correct output type", {
sequences <- getdata("generateSequences", "generateSequences_T1")[1:100]
result <- variationalSequences(input.sequences = sequences,
sequence.dictionary = amino.acids[1:20])
expect_true(is.vector(result))
})

test_that("Test for correct sequence generation", {
sequences <- getdata("generateSequences", "generateSequences_T1")[1:100]
number_of_sequences <- 5
result <- variationalSequences(input.sequences = sequences,
number.of.sequences = number_of_sequences)
expect_equal(length(result), number_of_sequences)
})
}
})

0 comments on commit 16d5de9

Please sign in to comment.