From a2cbf1dbd34a9b19af69b658668b7d60916581fd Mon Sep 17 00:00:00 2001 From: Travers Date: Fri, 3 May 2024 00:57:24 -0700 Subject: [PATCH] suggests/tests fix --- ChangeLog | 3 +++ DESCRIPTION | 4 ++-- Makefile | 4 ++-- tests/test_RadixForest.R | 9 +++++++++ tests/test_RadixTree.R | 8 ++++++++ tests/test_pairwise.R | 11 +++++++++++ 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cc616f..9159a26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Version 0.2.8 (2024-05-03) + * Conditionally run tests if required packages are installed + Version 0.2.7 (2024-01-25) * Add Ankerl unordered_dense conditional on C++17 support * Add `pwalign` package to suggests field which is responsible for pairwiseAlignment in the biostrings package in BioC 3.19 diff --git a/DESCRIPTION b/DESCRIPTION index 1b9fe18..e057677 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: seqtrie Title: Radix Tree and Trie-Based String Distances -Version: 0.2.7 -Date: 2024-04-30 +Version: 0.2.8 +Date: 2024-05-03 Authors@R: c( person("Travers", "Ching", email = "traversc@gmail.com", role = c("aut", "cre", "cph")), person("Martin", "Moene", role = c("ctb", "cph"), comment = "span-lite C++ library"), diff --git a/Makefile b/Makefile index 6b86447..8450271 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,10 @@ BUILD := $(PACKAGE)_$(VERSION).tar.gz .PHONY: doc build install test vignette $(BUILD) check: $(BUILD) - R CMD check --as-cran $< + export _R_CHECK_FORCE_SUGGESTS_=false && R CMD check --as-cran $< check-no-vignette: $(BUILD) - R CMD check --as-cran --no-build-vignettes --ignore-vignettes --no-manual $< + export _R_CHECK_FORCE_SUGGESTS_=false && R CMD check --as-cran --no-build-vignettes --ignore-vignettes --no-manual $< check-cran: $(BUILD) diff --git a/tests/test_RadixForest.R b/tests/test_RadixForest.R index 3c5218c..b76e402 100755 --- a/tests/test_RadixForest.R +++ b/tests/test_RadixForest.R @@ -2,6 +2,13 @@ # 1) That insertion and deletion produce the correct results with random strings # 2) That search (hamming, levenshtein and anchored) produce the same results as the internal `dist_matrix` and `dist_pairwise` functions +if(requireNamespace("seqtrie", quietly=TRUE) && + requireNamespace("stringi", quietly=TRUE) && + requireNamespace("stringdist", quietly=TRUE) && + requireNamespace("dplyr", quietly=TRUE) +) { + + library(seqtrie) library(stringdist) library(stringi) @@ -152,3 +159,5 @@ for(. in 1:NITER) { stopifnot(identical(results_frac, sd_frac)) }) } + +} diff --git a/tests/test_RadixTree.R b/tests/test_RadixTree.R index afeafd9..dad5db6 100755 --- a/tests/test_RadixTree.R +++ b/tests/test_RadixTree.R @@ -2,6 +2,12 @@ # 1) That insertion and deletion produce the correct results with random strings # 2) That search (hamming, levenshtein and anchored) produce the same results as the internal `dist_matrix` and `dist_pairwise` functions +if(requireNamespace("seqtrie", quietly=TRUE) && + requireNamespace("stringi", quietly=TRUE) && + requireNamespace("stringdist", quietly=TRUE) && + requireNamespace("dplyr", quietly=TRUE) +) { + library(seqtrie) library(stringdist) library(stringi) @@ -294,3 +300,5 @@ for(. in 1:NITER) { }) } + +} diff --git a/tests/test_pairwise.R b/tests/test_pairwise.R index 89e4ed0..ff17cc9 100755 --- a/tests/test_pairwise.R +++ b/tests/test_pairwise.R @@ -2,6 +2,15 @@ # These two functions are simple dynamic programming algorithms for computing pairwise distances and are themselves used to validate # the RadixTree imeplementation (see test_radix_tree.R) +if(requireNamespace("seqtrie", quietly=TRUE) && + requireNamespace("stringi", quietly=TRUE) && + requireNamespace("stringdist", quietly=TRUE) && + requireNamespace("Biostrings", quietly=TRUE) && + requireNamespace("dplyr", quietly=TRUE) && + # pwalign is only required for Biostrings >= 2.72.0 in R 4.4+ + ( (packageVersion("Biostrings") < "2.72.0") || requireNamespace("pwalign", quietly=TRUE) ) +) { + library(seqtrie) library(stringi) library(stringdist) @@ -261,3 +270,5 @@ for(. in 1:NITER) { stopifnot(all(results_seqtrie == results_biostrings)) }) } + +}