From 13fba72b316f35c7feccf74f839975b167dfa700 Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Sun, 11 Feb 2024 09:59:20 +0100 Subject: [PATCH 1/8] V0.7.6 getting closer to CRAN --- DESCRIPTION | 2 +- R/beta_div_test.R | 5 ++++- R/dada_phyloseq.R | 2 +- R/plot_functions.R | 9 ++++++--- README.Rmd | 4 +++- README.md | 4 +++- cran-comments.md | 2 +- man/adonis_pq.Rd | 3 ++- man/ancombc_pq.Rd | 2 ++ man/ggbetween_pq.Rd | 2 ++ man/multitax_bar_pq.Rd | 2 ++ man/tsne_pq.Rd | 3 ++- man/venn_pq.Rd | 3 ++- tests/testthat/test_figures_beta_div.R | 4 +++- tests/testthat/test_figures_misc.R | 1 + tests/testthat/test_phyloseq_class.R | 5 ++--- tests/testthat/test_subset.R | 4 ++++ 17 files changed, 41 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bfb1f28f..7e436ca6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: MiscMetabar Type: Package Title: Miscellaneous Functions for Metabarcoding Analysis -Version: 0.7.5 +Version: 0.7.6 Authors@R: person("Adrien", "Taudière", email = "adrien.taudiere@zaclys.net", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0003-1088-1182")) Description: The MiscMetabar package aims to facilitate the description, transformation, exploration, and reproducibility of metabarcoding analysis. Mainly build on the top of phyloseq, dada2 R packages. MiscMetabar help to build reproducible and robust bioinformatic pipeline in R. MiscMetabar make ecological analysis of alpha and beta-diversity simple and powerful by integrating a large number of analysis, some of them from other R packages. diff --git a/R/beta_div_test.R b/R/beta_div_test.R index 31fdf3f9..acd3de37 100644 --- a/R/beta_div_test.R +++ b/R/beta_div_test.R @@ -124,9 +124,10 @@ graph_test_pq <- function(physeq, #' @examples #' data(enterotype) #' adonis_pq(enterotype, "SeqTech*Enterotype", na_remove = TRUE) -#' adonis_pq(enterotype, "SeqTech") +#' \donttest{ #' adonis_pq(enterotype, "SeqTech", dist_method = "jaccard") #' adonis_pq(enterotype, "SeqTech", dist_method = "robust.aitchison") +#' } #' @export #' @author Adrien Taudière #' @details @@ -562,6 +563,7 @@ multipatt_pq <- function(physeq, #' @export #' #' @examples +#' \donttest{ #' res_height <- ancombc_pq( #' data_fungi_mini, #' fact = "Height", @@ -591,6 +593,7 @@ multipatt_pq <- function(physeq, #' tax_level = "Family", #' verbose = TRUE #' ) +#' } #' @author Adrien Taudière #' @details #' This function is mainly a wrapper of the work of others. diff --git a/R/dada_phyloseq.R b/R/dada_phyloseq.R index 761d9278..aca87b1a 100644 --- a/R/dada_phyloseq.R +++ b/R/dada_phyloseq.R @@ -1403,7 +1403,7 @@ subset_samples_pq <- function(physeq, condition) { if (length(condition) != nsamples(physeq)) { stop("Length of condition is different from the number of samples.") } - if (is.null(sample_data(physeq))) { + if (is.null(physeq@sam_data)) { message("Nothing subset. No sample_data in physeq.\n") return(physeq) } else { diff --git a/R/plot_functions.R b/R/plot_functions.R index 71c6d577..53c29d69 100644 --- a/R/plot_functions.R +++ b/R/plot_functions.R @@ -760,7 +760,7 @@ sankey_pq <- #' Please use print_values = FALSE if you want to add ggplot function #' (cf example). #' -#' @examples +#' @examplesIf tolower(Sys.info()[["sysname"]]) != "windows" #' data("enterotype") #' venn_pq(enterotype, fact = "SeqTech") #' venn_pq(enterotype, fact = "ClinicalStatus") @@ -1440,10 +1440,12 @@ hill_pq <- #' #' @export #' @examples +#' \donttest{ #' p <- ggbetween_pq(data_fungi, variable = "Time", p.adjust.method = "BH") #' p[[1]] #' ggbetween_pq(data_fungi, variable = "Height", one_plot = TRUE) #' ggbetween_pq(data_fungi, variable = "Height", one_plot = TRUE, rarefy_by_sample = TRUE) +#' } #' @author Adrien Taudière #' @details This function is mainly a wrapper of the work of others. #' Please make a reference to `ggstatsplot::ggbetweenstats()` if you @@ -2391,10 +2393,12 @@ plot_tax_pq <- #' @examples #' data(data_fungi_sp_known) #' multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", "Time") +#' \donttest{ #' multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order") #' multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", #' nb_seq = FALSE, log10trans = FALSE #' ) +#' } multitax_bar_pq <- function(physeq, lvl1, lvl2, @@ -2498,8 +2502,7 @@ multitax_bar_pq <- function(physeq, #' See ?Rtsne::Rtsne() for more information #' @export #' -#' @examples -#' +#' @examplesIf tolower(Sys.info()[["sysname"]]) != "windows" #' res_tsne <- tsne_pq(data_fungi) tsne_pq <- function(physeq, diff --git a/README.Rmd b/README.Rmd index 5e5dc6f9..f907b664 100644 --- a/README.Rmd +++ b/README.Rmd @@ -7,7 +7,7 @@ bibliography: paper/bibliography.bib ![R](https://img.shields.io/badge/r-%23276DC3.svg?style=for-the-badge&logo=r&logoColor=white) DOI [![codecov](https://codecov.io/gh/adrientaudiere/MiscMetabar/graph/badge.svg?token=NXFRSIKYC0)](https://app.codecov.io/gh/adrientaudiere/MiscMetabar) -[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/adrientaudiere/MiscMetabar/blob/master/CODE_OF_CONDUCT.md) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![CodeFactor](https://www.codefactor.io/repository/github/adrientaudiere/miscmetabar/badge/master)](https://www.codefactor.io/repository/github/adrientaudiere/miscmetabar/overview/master) [![R-CMD-check](https://github.com/adrientaudiere/MiscMetabar/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/adrientaudiere/MiscMetabar/actions/workflows/R-CMD-check.yaml) @@ -126,6 +126,8 @@ Here is a list of functions with some limitations or not working at all on windo - [tax_datatable()] - [track_wkflow()] - [track_wkflow_samples()] +- [tsne_pq()] +- [venn_pq()] MiscMetabar is developed under Linux and the vast majority of functions may works on Unix system, but its functionning is not test under iOS. diff --git a/README.md b/README.md index 8b4ef435..8f3f3b22 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ DOI [![codecov](https://codecov.io/gh/adrientaudiere/MiscMetabar/graph/badge.svg?token=NXFRSIKYC0)](https://app.codecov.io/gh/adrientaudiere/MiscMetabar) [![Contributor -Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md) +Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/adrientaudiere/MiscMetabar/blob/master/CODE_OF_CONDUCT.md) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![CodeFactor](https://www.codefactor.io/repository/github/adrientaudiere/miscmetabar/badge/master)](https://www.codefactor.io/repository/github/adrientaudiere/miscmetabar/overview/master) @@ -177,6 +177,8 @@ on windows OS: - \[tax_datatable()\] - \[track_wkflow()\] - \[track_wkflow_samples()\] +- \[tsne_pq()\] +- \[venn_pq()\] MiscMetabar is developed under Linux and the vast majority of functions may works on Unix system, but its functionning is not test under iOS. diff --git a/cran-comments.md b/cran-comments.md index dc666e4f..b3b233da 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -5,5 +5,5 @@ * This is a First release. - Examples with CPU (user + system) or elapsed time > 5s --> Answer: This is an intrinsic problem with metabarcoding analyses that deal with large datasets. I've often reduced the datasets for the examples, but occasionally the use of quite large dataset is necessary. The functions ancombc_pq() and build_phytree_pq() relies on already time-consuming functions from other packages. The total example run time is 166s on my computer, which appears to be reasonable given the high number of examples in this package. +-> Answer: This is an intrinsic problem with metabarcoding analyses that deal with large datasets. I've often reduced the datasets for the examples, but occasionally the use of quite large dataset is necessary. The functions ancombc_pq() and build_phytree_pq() rely on already time-consuming functions from other packages. The total example run time is 166s on my computer, which appears to be reasonable given the high number of examples in this package. diff --git a/man/adonis_pq.Rd b/man/adonis_pq.Rd index 38c1c5ed..3c79696c 100644 --- a/man/adonis_pq.Rd +++ b/man/adonis_pq.Rd @@ -67,10 +67,11 @@ use this function. \examples{ data(enterotype) adonis_pq(enterotype, "SeqTech*Enterotype", na_remove = TRUE) -adonis_pq(enterotype, "SeqTech") +\donttest{ adonis_pq(enterotype, "SeqTech", dist_method = "jaccard") adonis_pq(enterotype, "SeqTech", dist_method = "robust.aitchison") } +} \author{ Adrien Taudière } diff --git a/man/ancombc_pq.Rd b/man/ancombc_pq.Rd index 8eb6aa53..2a15bdc7 100644 --- a/man/ancombc_pq.Rd +++ b/man/ancombc_pq.Rd @@ -35,6 +35,7 @@ Please make a reference to \code{ANCOMBC::ancombc2()} if you use this function. } \examples{ +\donttest{ res_height <- ancombc_pq( data_fungi_mini, fact = "Height", @@ -65,6 +66,7 @@ res_time <- ancombc_pq( verbose = TRUE ) } +} \author{ Adrien Taudière } diff --git a/man/ggbetween_pq.Rd b/man/ggbetween_pq.Rd index 6974abfa..e95ddf3b 100644 --- a/man/ggbetween_pq.Rd +++ b/man/ggbetween_pq.Rd @@ -50,11 +50,13 @@ Please make a reference to \code{ggstatsplot::ggbetweenstats()} if you use this function. } \examples{ +\donttest{ p <- ggbetween_pq(data_fungi, variable = "Time", p.adjust.method = "BH") p[[1]] ggbetween_pq(data_fungi, variable = "Height", one_plot = TRUE) ggbetween_pq(data_fungi, variable = "Height", one_plot = TRUE, rarefy_by_sample = TRUE) } +} \author{ Adrien Taudière } diff --git a/man/multitax_bar_pq.Rd b/man/multitax_bar_pq.Rd index 8d7627b9..f5f60cc1 100644 --- a/man/multitax_bar_pq.Rd +++ b/man/multitax_bar_pq.Rd @@ -49,11 +49,13 @@ in lvl1 \examples{ data(data_fungi_sp_known) multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", "Time") +\donttest{ multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order") multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", nb_seq = FALSE, log10trans = FALSE ) } +} \author{ Adrien Taudière } diff --git a/man/tsne_pq.Rd b/man/tsne_pq.Rd index 9196cc99..7732be70 100644 --- a/man/tsne_pq.Rd +++ b/man/tsne_pq.Rd @@ -28,6 +28,7 @@ See ?Rtsne::Rtsne() for more information Compute tSNE position of samples from a phyloseq object } \examples{ - +\dontshow{if (tolower(Sys.info()[["sysname"]]) != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} res_tsne <- tsne_pq(data_fungi) +\dontshow{\}) # examplesIf} } diff --git a/man/venn_pq.Rd b/man/venn_pq.Rd index 4108ec42..38c7bcf1 100644 --- a/man/venn_pq.Rd +++ b/man/venn_pq.Rd @@ -32,6 +32,7 @@ modalities of the argument \code{factor} \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} } \examples{ +\dontshow{if (tolower(Sys.info()[["sysname"]]) != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data("enterotype") venn_pq(enterotype, fact = "SeqTech") venn_pq(enterotype, fact = "ClinicalStatus") @@ -40,7 +41,7 @@ venn_pq(enterotype, fact = "ClinicalStatus", print_values = FALSE) + scale_fill_hue() venn_pq(enterotype, fact = "ClinicalStatus", print_values = FALSE) + scale_fill_hue() - +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[venneuler]{venneuler}} diff --git a/tests/testthat/test_figures_beta_div.R b/tests/testthat/test_figures_beta_div.R index 71adbd69..963e75ff 100644 --- a/tests/testthat/test_figures_beta_div.R +++ b/tests/testthat/test_figures_beta_div.R @@ -76,6 +76,7 @@ test_that("graph_test_pq works", { merge_sample_by = "Tree_name" )) expect_error(graph_test_pq(data_fungi_mini, fact = "Height")) + expect_message(graph_test_pq(data_fungi_mini, fact = "Height", na_remove = TRUE)) expect_error(graph_test_pq(enterotype, fact = "Enterotype")) expect_error(graph_test_pq(data_fungi_mini, fact = "tRREE_name")) }) @@ -193,6 +194,7 @@ test_that("sankey_pq works with data_fungi_mini dataset", { }) test_that("venn_pq works with data_fungi_mini dataset", { + skip_on_os("windows") library("grid") expect_silent(venn_pq(data_fungi_mini, "Height")) expect_silent(suppressMessages(venn_pq( @@ -406,4 +408,4 @@ test_that("multipatt_pq works with data_fungi_mini dataset", { expect_s3_class(res_time$ss_tab, "data.frame") expect_equal(dim(res_time$res), c(12, 15)) -}) +}) \ No newline at end of file diff --git a/tests/testthat/test_figures_misc.R b/tests/testthat/test_figures_misc.R index a3c2ac5f..e3ccf360 100644 --- a/tests/testthat/test_figures_misc.R +++ b/tests/testthat/test_figures_misc.R @@ -7,6 +7,7 @@ GP_archae <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archa data_basidio <- subset_taxa(data_fungi, Phylum == "Basidiomycota") test_that("tsne_pq works with data_fungi_mini dataset", { + skip_on_os("windows") expect_silent(suppressMessages(res_tsne <- tsne_pq(data_fungi_mini))) expect_s3_class(res_tsne, "Rtsne") expect_silent(suppressMessages(res_tsne <- tsne_pq(data_fungi_mini, dims = 3, perplexity = 25))) diff --git a/tests/testthat/test_phyloseq_class.R b/tests/testthat/test_phyloseq_class.R index 02fd6d50..a06ff274 100644 --- a/tests/testthat/test_phyloseq_class.R +++ b/tests/testthat/test_phyloseq_class.R @@ -62,10 +62,9 @@ test_that("add_dna_to_phyloseq works fine", { }) -df <- data_fungi_mini -df <- unclass(data_fungi_mini) test_that("verify_pq works fine", { - expect_error(verify_pq(df), "The physeq argument is not a valid phyloseq object.") + expect_error(verify_pq(unclass(data_fungi_mini)), "The physeq argument is not a valid phyloseq object.") + expect_silent(verify_pq(data_fungi_mini, verbose = TRUE)) }) data_fungi_with__P <- data_fungi_mini diff --git a/tests/testthat/test_subset.R b/tests/testthat/test_subset.R index 25f9fea6..2e4c7660 100644 --- a/tests/testthat/test_subset.R +++ b/tests/testthat/test_subset.R @@ -16,4 +16,8 @@ test_that("subset_samples_pq works fine", { expect_s4_class(subset_samples_pq(data_fungi, data_fungi@sam_data[["Height"]] == "Low"), "phyloseq") expect_s4_class(subset_samples_pq(data_fungi, cond_samp), "phyloseq") expect_error(subset_samples_pq(data_fungi, data_fungi@tax_table[, "Phylum"] == "Ascomycota")) + data_fungi2 <- data_fungi + data_fungi2@sam_data <- NULL + expect_message(subset_samples_pq(data_fungi2, cond_samp)) + expect_s4_class(suppressMessages(subset_samples_pq(data_fungi2, cond_samp)), "phyloseq") }) From 3038ac53a883e8fd76fc7790a61a77513f0530d2 Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Sun, 11 Feb 2024 12:24:16 +0100 Subject: [PATCH 2/8] V0.7.6 getting closer to CRAN --- tests/testthat/test_phyloseq_class.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test_phyloseq_class.R b/tests/testthat/test_phyloseq_class.R index a06ff274..e4dc4552 100644 --- a/tests/testthat/test_phyloseq_class.R +++ b/tests/testthat/test_phyloseq_class.R @@ -62,7 +62,7 @@ test_that("add_dna_to_phyloseq works fine", { }) -test_that("verify_pq works fine", { + test_that("verify_pq works fine", { expect_error(verify_pq(unclass(data_fungi_mini)), "The physeq argument is not a valid phyloseq object.") expect_silent(verify_pq(data_fungi_mini, verbose = TRUE)) }) @@ -90,8 +90,10 @@ test_that("perc works fine", { test_that("count_seq works fine", { skip_on_os("windows") - expect_equal(count_seq("inst/extdata/ex_R1_001.fastq.gz"), 2500) - expect_equal(count_seq("inst/extdata/ex_R2_001.fastq.gz"), 2500) + skip_on_os("mac") + expect_equal(count_seq(folder_path= "inst/extdata/fasta"), c(3, 2)) + expect_equal(count_seq("inst/extdata/ex_R1_001.fastq.gz"), 100) + expect_equal(count_seq("inst/extdata/ex_R2_001.fastq.gz"), 100) expect_equal(count_seq("inst/extdata/ex.fasta"), 3) expect_equal(count_seq("inst/extdata/ex.fastq"), 4) expect_error(count_seq("tests/testthat.R"), "The file extension R is not supported.") From 0df188e440f3fb0b7fedd6c613d8d6974415af2c Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Sun, 11 Feb 2024 12:24:36 +0100 Subject: [PATCH 3/8] add data --- inst/extdata/fasta/ex.fasta | 6 ++++++ inst/extdata/fasta/ex_little.fasta | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 inst/extdata/fasta/ex.fasta create mode 100644 inst/extdata/fasta/ex_little.fasta diff --git a/inst/extdata/fasta/ex.fasta b/inst/extdata/fasta/ex.fasta new file mode 100644 index 00000000..0a38c1b0 --- /dev/null +++ b/inst/extdata/fasta/ex.fasta @@ -0,0 +1,6 @@ +>Eutypa_spinosa +TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG +>Eutypa_spinosa2 +TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGGGCGAATTACCTGGTAAGGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG +>Eutypa_spinosa3 +TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG diff --git a/inst/extdata/fasta/ex_little.fasta b/inst/extdata/fasta/ex_little.fasta new file mode 100644 index 00000000..2e991565 --- /dev/null +++ b/inst/extdata/fasta/ex_little.fasta @@ -0,0 +1,4 @@ +>seq1 +TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAACCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG +>seq2 +TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG From 44812f9f1f066a54af72000ffb7d11a268407a6e Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Sun, 11 Feb 2024 20:19:18 +0100 Subject: [PATCH 4/8] Fix test --- tests/testthat/test_phyloseq_class.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test_phyloseq_class.R b/tests/testthat/test_phyloseq_class.R index e4dc4552..7c85c4c9 100644 --- a/tests/testthat/test_phyloseq_class.R +++ b/tests/testthat/test_phyloseq_class.R @@ -64,7 +64,7 @@ test_that("add_dna_to_phyloseq works fine", { test_that("verify_pq works fine", { expect_error(verify_pq(unclass(data_fungi_mini)), "The physeq argument is not a valid phyloseq object.") - expect_silent(verify_pq(data_fungi_mini, verbose = TRUE)) + expect_silent(suppressWarnings(verify_pq(data_fungi_mini, verbose = TRUE))) }) data_fungi_with__P <- data_fungi_mini @@ -91,9 +91,9 @@ test_that("perc works fine", { test_that("count_seq works fine", { skip_on_os("windows") skip_on_os("mac") - expect_equal(count_seq(folder_path= "inst/extdata/fasta"), c(3, 2)) - expect_equal(count_seq("inst/extdata/ex_R1_001.fastq.gz"), 100) - expect_equal(count_seq("inst/extdata/ex_R2_001.fastq.gz"), 100) + expect_equal(count_seq(folder_path= "inst/extdata/fasta"), c(2, 3)) + expect_equal(count_seq("inst/extdata/ex_R1_001.fastq.gz"), 2500) + expect_equal(count_seq("inst/extdata/ex_R2_001.fastq.gz"), 2500 expect_equal(count_seq("inst/extdata/ex.fasta"), 3) expect_equal(count_seq("inst/extdata/ex.fastq"), 4) expect_error(count_seq("tests/testthat.R"), "The file extension R is not supported.") From bd0ef783e92ef6c871c49f5362c318ebd2afa510 Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Mon, 12 Feb 2024 15:54:47 +0100 Subject: [PATCH 5/8] Lower time for examples and test for CRAN --- DESCRIPTION | 4 +-- R/Deseq2_edgeR.R | 5 +++- R/beta_div_test.R | 15 ++++++++-- R/dada_phyloseq.R | 19 ++++++++----- R/plot_functions.R | 38 ++++++++++++++++++++------ inst/extdata/fasta/ex.fasta | 6 ---- inst/extdata/fasta/ex_little.fasta | 4 --- man/LCBD_pq.Rd | 4 ++- man/accu_plot.Rd | 3 +- man/accu_samp_threshold.Rd | 2 ++ man/are_modality_even_depth.Rd | 6 ++-- man/asv2otu.Rd | 5 +++- man/build_phytree_pq.Rd | 2 ++ man/circle_pq.Rd | 7 +++-- man/ggvenn_pq.Rd | 3 +- man/graph_test_pq.Rd | 4 ++- man/heat_tree_pq.Rd | 2 +- man/multipatt_pq.Rd | 2 ++ man/plot_LCBD_pq.Rd | 2 ++ man/plot_SCBD_pq.Rd | 3 +- man/plot_deseq2_pq.Rd | 2 ++ man/plot_edgeR_pq.Rd | 3 +- man/plot_mt.Rd | 2 ++ man/plot_tax_pq.Rd | 3 +- man/plot_tsne_pq.Rd | 2 ++ man/reorder_taxa_pq.Rd | 6 ++-- man/ridges_pq.Rd | 3 +- man/sankey_pq.Rd | 2 ++ man/tax_bar_pq.Rd | 2 ++ man/treemap_pq.Rd | 2 ++ man/upset_pq.Rd | 2 ++ man/venn_pq.Rd | 2 ++ tests/testthat/test_adonis.R | 1 + tests/testthat/test_deprecated.R | 1 + tests/testthat/test_figures_beta_div.R | 16 ++++++++++- tests/testthat/test_figures_biplot.R | 4 +-- tests/testthat/test_figures_misc.R | 4 +++ tests/testthat/test_figures_taxo.R | 10 +++++++ tests/testthat/test_misc.R | 4 +++ tests/testthat/test_phyloseq_class.R | 4 +-- 40 files changed, 155 insertions(+), 56 deletions(-) delete mode 100644 inst/extdata/fasta/ex.fasta delete mode 100644 inst/extdata/fasta/ex_little.fasta diff --git a/DESCRIPTION b/DESCRIPTION index 7e436ca6..cf24f43c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,10 @@ Package: MiscMetabar Type: Package Title: Miscellaneous Functions for Metabarcoding Analysis -Version: 0.7.6 +Version: 0.7.7 Authors@R: person("Adrien", "Taudière", email = "adrien.taudiere@zaclys.net", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0003-1088-1182")) -Description: The MiscMetabar package aims to facilitate the description, transformation, exploration, and reproducibility of metabarcoding analysis. Mainly build on the top of phyloseq, dada2 R packages. MiscMetabar help to build reproducible and robust bioinformatic pipeline in R. MiscMetabar make ecological analysis of alpha and beta-diversity simple and powerful by integrating a large number of analysis, some of them from other R packages. +Description: The MiscMetabar package aims to facilitate the description, transformation, exploration, and reproducibility of metabarcoding analysis. Mainly build on the top of phyloseq, dada2 R packages. MiscMetabar help to build reproducible and robust bioinformatics pipelines in R. MiscMetabar make ecological analysis of alpha and beta-diversity simple and powerful by integrating a large number of analysis, some of them from other R packages. License: AGPL-3 Encoding: UTF-8 LazyData: true diff --git a/R/Deseq2_edgeR.R b/R/Deseq2_edgeR.R index a4d26ffa..4730fd22 100644 --- a/R/Deseq2_edgeR.R +++ b/R/Deseq2_edgeR.R @@ -22,10 +22,11 @@ #' @examplesIf tolower(Sys.info()[["sysname"]]) != "windows" #' data("GlobalPatterns", package = "phyloseq") #' GP_archae <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") +#' \donttest{ #' plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), #' color_tax = "Kingdom" #' ) -#' \dontrun{ +#' #' plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), #' taxolev = "Class", color_tax = "Kingdom" #' ) @@ -153,6 +154,7 @@ plot_edgeR_pq <- #' @details #' Please cite `DESeq2` package if you use chis function. #' @examples +#' \donttest{ #' data("GlobalPatterns", package = "phyloseq") #' GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") #' GP <- subset_samples(GP, SampleType %in% c("Soil", "Skin")) @@ -170,6 +172,7 @@ plot_edgeR_pq <- #' tax_table = GP@tax_table, color_tax = "Class", #' select_taxa = c("522457", "271582") #' ) +#' } #' @author Adrien Taudière #' #' @return A \code{\link{ggplot}}2 plot representing DESeq2 results diff --git a/R/beta_div_test.R b/R/beta_div_test.R index acd3de37..ea736340 100644 --- a/R/beta_div_test.R +++ b/R/beta_div_test.R @@ -25,7 +25,9 @@ #' @examples #' data(enterotype) #' graph_test_pq(enterotype, fact = "SeqTech") -#' graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) +#' \donttest{ +#' graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) +#' } #' @author Adrien Taudière #' #' @return A \code{\link{ggplot}}2 plot with a subtitle indicating the pvalue @@ -235,7 +237,9 @@ adonis_pq <- function(physeq, #' str(res) #' length(res$LCBD) #' length(res$SCBD) -#' LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") +#' \donttest{ +#' LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") +#' } #' #' @author Adrien Taudière #' This function is mainly a wrapper of the work of others. @@ -292,6 +296,7 @@ LCBD_pq <- function(physeq, #' nperm = 100, only_plot_significant = FALSE, #' pval = 0.2 #' ) +#' \donttest{ #' plot_LCBD_pq(data_fungi_mini, #' nperm = 100, only_plot_significant = TRUE, #' pval = 0.2 @@ -310,6 +315,7 @@ LCBD_pq <- function(physeq, #' legend.text = element_text(size = 10), #' axis.title.x = element_text(size = 6) #' ) +#' } #' @author Adrien Taudière #' @details #' This function is mainly a wrapper of the work of others. @@ -431,9 +437,10 @@ plot_LCBD_pq <- function(physeq, #' plot_SCBD_pq(data_fungi) + #' geom_text(aes(label = paste(Genus, Species)), hjust = 1, vjust = 2) + #' xlim(c(0, NA)) -#' +#' \donttest{ #' plot_SCBD_pq(data_fungi, tax_level = "Class", tax_col = "Phylum", min_SCBD = 0) + #' geom_jitter() +#' } #' @author Adrien Taudière #' @details #' This function is mainly a wrapper of the work of others. @@ -489,10 +496,12 @@ plot_SCBD_pq <- function(physeq, #' data(data_fungi) #' data_fungi_ab <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 10000) #' multipatt_pq(subset_samples(data_fungi_ab, !is.na(Time)), fact = "Time") +#' \donttest{ #' multipatt_pq(subset_samples(data_fungi_ab, !is.na(Time)), #' fact = "Time", #' max.order = 1, control = permute::how(nperm = 99) #' ) +#' } #' @author Adrien Taudière #' @details #' This function is mainly a wrapper of the work of others. diff --git a/R/dada_phyloseq.R b/R/dada_phyloseq.R index aca87b1a..bcbfcf24 100644 --- a/R/dada_phyloseq.R +++ b/R/dada_phyloseq.R @@ -524,13 +524,16 @@ track_wkflow_samples <- function(list_pq_obj, ...) { #' #' @examples #' asv2otu(data_fungi_mini) -#' asv2otu(data_fungi_mini, method_clusterize = "longest") +#' \donttest{ +#' asv2otu(data_fungi_mini, method_clusterize = "longest") +#' } #' if (MiscMetabar:::is_swarm_installed()) { #' d_swarm <- asv2otu(data_fungi_mini, method = "swarm") #' } #' if (MiscMetabar:::is_vsearch_installed()) { #' d_vs <- asv2otu(data_fungi_mini, method = "vsearch") #' } +#' #' @references #' VSEARCH can be downloaded from #' \url{https://github.com/torognes/vsearch}. @@ -1927,6 +1930,7 @@ plot_guild_pq <- #' Please make a reference to `phangorn` package if you #' use this function. #' @examplesIf tolower(Sys.info()[["sysname"]]) != "windows" +#' \donttest{ #' library("phangorn") #' df <- subset_taxa_pq(data_fungi_mini, taxa_sums(data_fungi_mini) > 9000) #' df_tree <- build_phytree_pq(df, nb_bootstrap = 2) @@ -1946,6 +1950,7 @@ plot_guild_pq <- #' plot(consensusNet(df_tree$ML_bs)) #' plot(consensusNet(df_tree$NJ_bs)) #' ps_tree <- merge_phyloseq(df, df_tree$ML$tree) +#' } build_phytree_pq <- function(physeq, nb_bootstrap = 0, model = "GTR", @@ -2065,9 +2070,9 @@ build_phytree_pq <- function(physeq, #' @importFrom stats kruskal.test #' @examples #' -#' are_modality_even_depth(data_fungi, "Time")$p.value -#' are_modality_even_depth(rarefy_even_depth(data_fungi), "Time")$p.value -#' are_modality_even_depth(data_fungi, "Height", boxplot = TRUE) +#' are_modality_even_depth(data_fungi_mini, "Time")$p.value +#' are_modality_even_depth(rarefy_even_depth(data_fungi_mini), "Time")$p.value +#' are_modality_even_depth(data_fungi_mini, "Height", boxplot = TRUE) are_modality_even_depth <- function(physeq, fact, boxplot = FALSE) { nb_seq <- sample_sums(physeq) fact <- factor(unclass(physeq@sam_data[, fact])[[1]]) @@ -2108,9 +2113,9 @@ are_modality_even_depth <- function(physeq, fact, boxplot = FALSE) { #' taxa_names(data_fungi)[order(as.vector(data_fungi@tax_table[, "Genus"]))] #' ) #' -#' data_fungi_asc_ordered_by_abundance <- reorder_taxa_pq( -#' data_fungi, -#' taxa_names(data_fungi)[order(taxa_sums(data_fungi))] +#' data_fungi_mini_asc_ordered_by_abundance <- reorder_taxa_pq( +#' data_fungi_mini, +#' taxa_names(data_fungi_mini)[order(taxa_sums(data_fungi_mini))] #' ) reorder_taxa_pq <- function(physeq, names_ordered, remove_phy_tree = FALSE) { new_physeq <- physeq diff --git a/R/plot_functions.R b/R/plot_functions.R index 53c29d69..fd05f52e 100644 --- a/R/plot_functions.R +++ b/R/plot_functions.R @@ -15,7 +15,9 @@ #' data_fungi <- subset_samples(data_fungi, !is.na(Time)) #' res <- mt(data_fungi, "Time", method = "fdr", test = "f", B = 300) #' plot_mt(res) +#' \donttest{ #' plot_mt(res, taxa = "Genus", color_tax = "Order") +#' } #' @return a \code{\link{ggplot}}2 plot of result of a mt test #' @export #' @seealso [phyloseq::mt()] @@ -80,6 +82,7 @@ plot_mt <- #' if `add_nb_seq` = TRUE or to \code{\link{plot}} if `add_nb_seq` = FALSE #' #' @examples +#' \donttest{ #' data("GlobalPatterns", package = "phyloseq") #' GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") #' GP <- rarefy_even_depth(subset_samples_pq(GP, sample_sums(GP) > 3000)) @@ -89,7 +92,7 @@ plot_mt <- #' p + theme(legend.position = "none") #' #' p + xlim(c(0, 400)) -#' +#' } #' @return A \code{\link{ggplot}}2 plot representing the richness #' accumulation plot if add_nb_seq = TRUE, else, if add_nb_seq = FALSE #' return a base plot. @@ -288,6 +291,7 @@ accu_plot <- #' to obtain `threshold` proportion of the ASV #' #' @examples +#' \donttest{ #' data("GlobalPatterns", package = "phyloseq") #' GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") #' GP <- rarefy_even_depth(subset_samples_pq(GP, sample_sums(GP) > 3000)) @@ -300,6 +304,7 @@ accu_plot <- #' # Plot the number of sequences needed to accumulate 0.95% of ASV in 50%, 75% #' # and 100% of samples #' p + geom_vline(xintercept = quantile(val_threshold, probs = c(0.50, 0.75, 1))) +#' } #' @export #' @author Adrien Taudière #' @seealso [accu_plot()] @@ -355,12 +360,13 @@ accu_samp_threshold <- function(res_accuplot, threshold = 0.95) { #' \code{\link[circlize]{chordDiagram}} or \code{\link[circlize]{circos.par}} #' #' @examples +#' \donttest{ #' data("GlobalPatterns", package = "phyloseq") #' GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") #' circle_pq(GP, "SampleType") -#' # circle_pq(GP, "SampleType", add_nb_seq = FALSE) -#' # circle_pq(GP, "SampleType", taxa = "Class") -#' +#' circle_pq(GP, "SampleType", add_nb_seq = FALSE) +#' circle_pq(GP, "SampleType", taxa = "Class") +#'} #' @author Adrien Taudière #' #' @return A \code{\link[circlize]{chordDiagram}} plot representing the @@ -557,8 +563,10 @@ circle_pq <- #' data("GlobalPatterns", package = "phyloseq") #' GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") #' sankey_pq(GP, fact = "SampleType") +#' \donttest{ #' sankey_pq(GP, taxa = 1:4, min_prop_tax = 0.01) #' sankey_pq(GP, taxa = 1:4, min_prop_tax = 0.01, add_nb_seq = TRUE) +#' } #' @author Adrien Taudière #' #' @return A \code{\link[networkD3]{sankeyNetwork}} plot representing the @@ -763,13 +771,14 @@ sankey_pq <- #' @examplesIf tolower(Sys.info()[["sysname"]]) != "windows" #' data("enterotype") #' venn_pq(enterotype, fact = "SeqTech") +#' \donttest{ #' venn_pq(enterotype, fact = "ClinicalStatus") #' venn_pq(enterotype, fact = "Nationality", print_values = FALSE) #' venn_pq(enterotype, fact = "ClinicalStatus", print_values = FALSE) + #' scale_fill_hue() #' venn_pq(enterotype, fact = "ClinicalStatus", print_values = FALSE) + #' scale_fill_hue() -#' +#' } #' @return A \code{\link{ggplot}}2 plot representing Venn diagram of #' modalities of the argument \code{factor} #' @@ -980,6 +989,7 @@ venn_pq <- #' @examples #' #' ggvenn_pq(data_fungi, fact = "Height") +#' \donttest{ #' ggvenn_pq(data_fungi, fact = "Height") + #' ggplot2::scale_fill_distiller(palette = "BuPu", direction = 1) #' pl <- ggvenn_pq(data_fungi, fact = "Height", split_by = "Time") @@ -998,7 +1008,7 @@ venn_pq <- #' ggvenn_pq(data_fungi, fact = "Height", rarefy_before_merging = TRUE) #' ggvenn_pq(data_fungi, fact = "Height", rarefy_after_merging = TRUE) + #' scale_x_continuous(expand = expansion(mult = 0.5)) -#' +#' } #' @export #' @author Adrien Taudière @@ -1771,6 +1781,7 @@ rotl_pq <- function(physeq, #' @author Adrien Taudière #' #' @examples +#' \donttest{ #' library("metacoder") #' data("GlobalPatterns", package = "phyloseq") #' @@ -1797,7 +1808,6 @@ rotl_pq <- function(physeq, #' node_size_trans = "log10 area" #' ) #' -#' \dontrun{ #' heat_tree_pq(GPsubset, #' node_size = nb_sequences, #' node_color = n_obs, @@ -2220,7 +2230,7 @@ multi_biplot_pq <- function(physeq, #' merge_sample_by = "Time", #' taxa_fill = "Class" #' ) -#' +#' \donttest{ #' plot_tax_pq(data_fungi_sp_known, #' "Height", #' merge_sample_by = "Height", @@ -2236,6 +2246,7 @@ multi_biplot_pq <- function(physeq, #' na_remove = FALSE, #' clean_pq = FALSE #' ) +#' } plot_tax_pq <- function(physeq, fact = NULL, @@ -2563,8 +2574,10 @@ tsne_pq <- #' @examplesIf tolower(Sys.info()[["sysname"]]) != "windows" #' data(data_fungi) #' plot_tsne_pq(data_fungi, fact = "Height", perplexity = 15) +#' \donttest{ #' plot_tsne_pq(data_fungi, fact = "Time") + geom_label(aes(label = Sample_id, fill = Time)) #' plot_tsne_pq(data_fungi, fact = "Time", na_remove = FALSE, force_factor = FALSE) +#' } plot_tsne_pq <- function(physeq, method = "bray", dims = 2, @@ -2758,6 +2771,7 @@ iNEXT_pq <- function(physeq, #' fact = "Height", width_ratio = 0.2, #' taxa_fill = "Class" #' ) +#' \donttest{ #' upset_pq(data_fungi_mini, fact = "Height", min_nb_seq = 1000) #' upset_pq(data_fungi_mini, fact = "Height", na_remove = FALSE) #' @@ -2858,6 +2872,7 @@ iNEXT_pq <- function(physeq, #' data_fungi2@sam_data[["Height__Time_0"]][grepl("NA", data_fungi2@sam_data[["Height__Time_0"]])] <- #' NA #' upset_pq(data_fungi2, fact = "Height__Time_0", width_ratio = 0.2, min_size = 2) +#' } upset_pq <- function(physeq, fact, taxa_fill = NULL, @@ -3141,9 +3156,11 @@ diff_fct_diff_class <- #' #' data_fungi_ab <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 10000) #' tax_bar_pq(data_fungi_ab) + theme(legend.position = "none") +#' \donttest{ #' tax_bar_pq(data_fungi_ab, taxa = "Class") #' tax_bar_pq(data_fungi_ab, taxa = "Class", percent_bar = TRUE) #' tax_bar_pq(data_fungi_ab, taxa = "Class", fact = "Time") +#' } #' @author Adrien Taudière #' @seealso [plot_tax_pq()] and [multitax_bar_pq()] #' @@ -3190,6 +3207,7 @@ tax_bar_pq <- function(physeq, fact = "Sample", taxa = "Order", percent_bar = FA #' @examples #' #' ridges_pq(data_fungi_mini, "Time", alpha = 0.5, log10trans = FALSE) + xlim(c(0, 1000)) +#' \donttest{ #' ridges_pq(data_fungi_mini, "Time", alpha = 0.5, scale = 0.9) #' ridges_pq(data_fungi_mini, "Sample_names", log10trans = TRUE) #' @@ -3200,7 +3218,7 @@ tax_bar_pq <- function(physeq, fact = "Sample", taxa = "Order", percent_bar = FA #' point_shape = "|", point_size = 3, point_alpha = 1, alpha = 0.7, #' scale = 0.8 #' ) -#' +#'} ridges_pq <- function(physeq, fact, nb_seq = TRUE, @@ -3270,6 +3288,7 @@ ridges_pq <- function(physeq, #' "Order", "Class", #' plot_legend = TRUE #' ) +#' \donttest{ #' treemap_pq( #' clean_pq(subset_taxa( #' data_fungi_sp_known, @@ -3286,6 +3305,7 @@ ridges_pq <- function(physeq, #' "Order", "Class", #' nb_seq = FALSE, log10trans = FALSE #' ) +#' } treemap_pq <- function(physeq, lvl1, lvl2, diff --git a/inst/extdata/fasta/ex.fasta b/inst/extdata/fasta/ex.fasta deleted file mode 100644 index 0a38c1b0..00000000 --- a/inst/extdata/fasta/ex.fasta +++ /dev/null @@ -1,6 +0,0 @@ ->Eutypa_spinosa -TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG ->Eutypa_spinosa2 -TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGGGCGAATTACCTGGTAAGGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG ->Eutypa_spinosa3 -TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG diff --git a/inst/extdata/fasta/ex_little.fasta b/inst/extdata/fasta/ex_little.fasta deleted file mode 100644 index 2e991565..00000000 --- a/inst/extdata/fasta/ex_little.fasta +++ /dev/null @@ -1,4 +0,0 @@ ->seq1 -TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAACCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG ->seq2 -TACCTATGTTGCCTTGGCGGCTAAACCTACCCGGGATTTGATGGCGAATTACCTGGTATTTTAGCCCACTTACCCGGTACCAACCTACCCTGTACACCGCGCCTGGGTCTACCCTCCGGATGACATTTTTAAGACTCTTGTTTTATAGTGAAATTCTGAGTTTTTATACTTAATAAGTTAAAACTTTCAATCTCGGATCTCTTGGCTCTGGCATCGATGAAGAACGCTACGAAATGCTGATAAATAATGTGAATTGCCGAATTCATTGAATCATCGAATCTTTGAACGCACATTGCACCCATTAGTATTCTAGAGTGCATGCCTGTTCCAGCGTCATTTTCAATCCTCAAGCCCCTTATTGCTTGGTGTTGGCAGTTTAGCTGGCTTTATAGTGCTTAACTCCCTAAATATACTGCCTGATTCGCGGTGACCCCAAGCGTAATAATTATTTTCTCGCTTGAGGTG diff --git a/man/LCBD_pq.Rd b/man/LCBD_pq.Rd index a990bf53..e6562e58 100644 --- a/man/LCBD_pq.Rd +++ b/man/LCBD_pq.Rd @@ -30,7 +30,9 @@ res <- LCBD_pq(data_fungi_sp_known, nperm = 5) str(res) length(res$LCBD) length(res$SCBD) -LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") +\donttest{ + LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") +} } \seealso{ diff --git a/man/accu_plot.Rd b/man/accu_plot.Rd index c804a3ba..6795d76e 100644 --- a/man/accu_plot.Rd +++ b/man/accu_plot.Rd @@ -65,6 +65,7 @@ return a base plot. \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} } \examples{ +\donttest{ data("GlobalPatterns", package = "phyloseq") GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") GP <- rarefy_even_depth(subset_samples_pq(GP, sample_sums(GP) > 3000)) @@ -74,7 +75,7 @@ p <- accu_plot(GP, "SampleType", add_nb_seq = TRUE, step = 10) p + theme(legend.position = "none") p + xlim(c(0, 400)) - +} } \seealso{ \code{\link[vegan]{specaccum}} \code{\link[=accu_samp_threshold]{accu_samp_threshold()}} diff --git a/man/accu_samp_threshold.Rd b/man/accu_samp_threshold.Rd index 740ecf4f..a80835a0 100644 --- a/man/accu_samp_threshold.Rd +++ b/man/accu_samp_threshold.Rd @@ -20,6 +20,7 @@ to obtain \code{threshold} proportion of the ASV \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} } \examples{ +\donttest{ data("GlobalPatterns", package = "phyloseq") GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") GP <- rarefy_even_depth(subset_samples_pq(GP, sample_sums(GP) > 3000)) @@ -33,6 +34,7 @@ summary(val_threshold) # and 100\% of samples p + geom_vline(xintercept = quantile(val_threshold, probs = c(0.50, 0.75, 1))) } +} \seealso{ \code{\link[=accu_plot]{accu_plot()}} } diff --git a/man/are_modality_even_depth.Rd b/man/are_modality_even_depth.Rd index 0e2ab7c1..3eb71ad8 100644 --- a/man/are_modality_even_depth.Rd +++ b/man/are_modality_even_depth.Rd @@ -30,9 +30,9 @@ per samples in function of the factor \code{fact}. } \examples{ -are_modality_even_depth(data_fungi, "Time")$p.value -are_modality_even_depth(rarefy_even_depth(data_fungi), "Time")$p.value -are_modality_even_depth(data_fungi, "Height", boxplot = TRUE) +are_modality_even_depth(data_fungi_mini, "Time")$p.value +are_modality_even_depth(rarefy_even_depth(data_fungi_mini), "Time")$p.value +are_modality_even_depth(data_fungi_mini, "Height", boxplot = TRUE) } \author{ Adrien Taudière diff --git a/man/asv2otu.Rd b/man/asv2otu.Rd index fcb980aa..b30eecc2 100644 --- a/man/asv2otu.Rd +++ b/man/asv2otu.Rd @@ -101,13 +101,16 @@ of \code{\link[=merge_taxa_vec]{merge_taxa_vec()}}. } \examples{ asv2otu(data_fungi_mini) -asv2otu(data_fungi_mini, method_clusterize = "longest") +\donttest{ + asv2otu(data_fungi_mini, method_clusterize = "longest") +} if (MiscMetabar:::is_swarm_installed()) { d_swarm <- asv2otu(data_fungi_mini, method = "swarm") } if (MiscMetabar:::is_vsearch_installed()) { d_vs <- asv2otu(data_fungi_mini, method = "vsearch") } + } \references{ VSEARCH can be downloaded from diff --git a/man/build_phytree_pq.Rd b/man/build_phytree_pq.Rd index e21fbbe3..da8c130a 100644 --- a/man/build_phytree_pq.Rd +++ b/man/build_phytree_pq.Rd @@ -74,6 +74,7 @@ use this function. } \examples{ \dontshow{if (tolower(Sys.info()[["sysname"]]) != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\donttest{ library("phangorn") df <- subset_taxa_pq(data_fungi_mini, taxa_sums(data_fungi_mini) > 9000) df_tree <- build_phytree_pq(df, nb_bootstrap = 2) @@ -93,6 +94,7 @@ plotBS( plot(consensusNet(df_tree$ML_bs)) plot(consensusNet(df_tree$NJ_bs)) ps_tree <- merge_phyloseq(df, df_tree$ML$tree) +} \dontshow{\}) # examplesIf} } \author{ diff --git a/man/circle_pq.Rd b/man/circle_pq.Rd index 64103dbc..3f24cd4f 100644 --- a/man/circle_pq.Rd +++ b/man/circle_pq.Rd @@ -77,12 +77,13 @@ fact \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} } \examples{ +\donttest{ data("GlobalPatterns", package = "phyloseq") GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") circle_pq(GP, "SampleType") -# circle_pq(GP, "SampleType", add_nb_seq = FALSE) -# circle_pq(GP, "SampleType", taxa = "Class") - +circle_pq(GP, "SampleType", add_nb_seq = FALSE) +circle_pq(GP, "SampleType", taxa = "Class") +} } \seealso{ \code{\link[circlize]{chordDiagram}} diff --git a/man/ggvenn_pq.Rd b/man/ggvenn_pq.Rd index a41e5fd1..2b4949f1 100644 --- a/man/ggvenn_pq.Rd +++ b/man/ggvenn_pq.Rd @@ -68,6 +68,7 @@ examples. \examples{ ggvenn_pq(data_fungi, fact = "Height") +\donttest{ ggvenn_pq(data_fungi, fact = "Height") + ggplot2::scale_fill_distiller(palette = "BuPu", direction = 1) pl <- ggvenn_pq(data_fungi, fact = "Height", split_by = "Time") @@ -86,7 +87,7 @@ ggvenn_pq(data_fungi, fact = "Height", add_nb_seq = TRUE, set_size = 4) ggvenn_pq(data_fungi, fact = "Height", rarefy_before_merging = TRUE) ggvenn_pq(data_fungi, fact = "Height", rarefy_after_merging = TRUE) + scale_x_continuous(expand = expansion(mult = 0.5)) - +} } \seealso{ \code{\link[=upset_pq]{upset_pq()}} diff --git a/man/graph_test_pq.Rd b/man/graph_test_pq.Rd index cb5fe6e3..2d7602dd 100644 --- a/man/graph_test_pq.Rd +++ b/man/graph_test_pq.Rd @@ -57,7 +57,9 @@ Please cite \code{phyloseqGraphTest} package. \examples{ data(enterotype) graph_test_pq(enterotype, fact = "SeqTech") -graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) +\donttest{ + graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) +} } \author{ Adrien Taudière diff --git a/man/heat_tree_pq.Rd b/man/heat_tree_pq.Rd index a698629c..23ed1677 100644 --- a/man/heat_tree_pq.Rd +++ b/man/heat_tree_pq.Rd @@ -26,6 +26,7 @@ Note that the number of ASV is store under the name \code{n_obs} and the number of sequences under the name \code{nb_sequences} } \examples{ +\donttest{ library("metacoder") data("GlobalPatterns", package = "phyloseq") @@ -52,7 +53,6 @@ heat_tree_pq(GPsubset, node_size_trans = "log10 area" ) -\dontrun{ heat_tree_pq(GPsubset, node_size = nb_sequences, node_color = n_obs, diff --git a/man/multipatt_pq.Rd b/man/multipatt_pq.Rd index b08b2ad7..ac28a919 100644 --- a/man/multipatt_pq.Rd +++ b/man/multipatt_pq.Rd @@ -48,10 +48,12 @@ use this function. data(data_fungi) data_fungi_ab <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 10000) multipatt_pq(subset_samples(data_fungi_ab, !is.na(Time)), fact = "Time") +\donttest{ multipatt_pq(subset_samples(data_fungi_ab, !is.na(Time)), fact = "Time", max.order = 1, control = permute::how(nperm = 99) ) +} \dontshow{\}) # examplesIf} } \author{ diff --git a/man/plot_LCBD_pq.Rd b/man/plot_LCBD_pq.Rd index f2df4ee4..9a8ce56c 100644 --- a/man/plot_LCBD_pq.Rd +++ b/man/plot_LCBD_pq.Rd @@ -50,6 +50,7 @@ plot_LCBD_pq(data_fungi_mini, nperm = 100, only_plot_significant = FALSE, pval = 0.2 ) +\donttest{ plot_LCBD_pq(data_fungi_mini, nperm = 100, only_plot_significant = TRUE, pval = 0.2 @@ -69,6 +70,7 @@ plot_LCBD_pq(data_fungi_mini, axis.title.x = element_text(size = 6) ) } +} \seealso{ \link{LCBD_pq}, \code{\link[adespatial:beta.div]{adespatial::beta.div()}} } diff --git a/man/plot_SCBD_pq.Rd b/man/plot_SCBD_pq.Rd index 99684268..60992d54 100644 --- a/man/plot_SCBD_pq.Rd +++ b/man/plot_SCBD_pq.Rd @@ -44,10 +44,11 @@ data(data_fungi) plot_SCBD_pq(data_fungi) + geom_text(aes(label = paste(Genus, Species)), hjust = 1, vjust = 2) + xlim(c(0, NA)) - +\donttest{ plot_SCBD_pq(data_fungi, tax_level = "Class", tax_col = "Phylum", min_SCBD = 0) + geom_jitter() } +} \seealso{ \link{LCBD_pq}, \code{\link[adespatial:beta.div]{adespatial::beta.div()}} } diff --git a/man/plot_deseq2_pq.Rd b/man/plot_deseq2_pq.Rd index 282f1246..6bf458f8 100644 --- a/man/plot_deseq2_pq.Rd +++ b/man/plot_deseq2_pq.Rd @@ -68,6 +68,7 @@ A \code{\link{ggplot}}2 plot representing DESeq2 results Please cite \code{DESeq2} package if you use chis function. } \examples{ +\donttest{ data("GlobalPatterns", package = "phyloseq") GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") GP <- subset_samples(GP, SampleType \%in\% c("Soil", "Skin")) @@ -86,6 +87,7 @@ plot_deseq2_pq(res, c("SampleType", "Soil", "Skin"), select_taxa = c("522457", "271582") ) } +} \seealso{ \code{\link[DESeq2]{DESeq}} diff --git a/man/plot_edgeR_pq.Rd b/man/plot_edgeR_pq.Rd index 2d5b6025..40cd2492 100644 --- a/man/plot_edgeR_pq.Rd +++ b/man/plot_edgeR_pq.Rd @@ -47,10 +47,11 @@ A \code{\link{ggplot}}2 plot representing edgeR results \dontshow{if (tolower(Sys.info()[["sysname"]]) != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data("GlobalPatterns", package = "phyloseq") GP_archae <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") +\donttest{ plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), color_tax = "Kingdom" ) -\dontrun{ + plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), taxolev = "Class", color_tax = "Kingdom" ) diff --git a/man/plot_mt.Rd b/man/plot_mt.Rd index 7aba0316..77f7d362 100644 --- a/man/plot_mt.Rd +++ b/man/plot_mt.Rd @@ -27,8 +27,10 @@ a \code{\link{ggplot}}2 plot of result of a mt test data_fungi <- subset_samples(data_fungi, !is.na(Time)) res <- mt(data_fungi, "Time", method = "fdr", test = "f", B = 300) plot_mt(res) +\donttest{ plot_mt(res, taxa = "Genus", color_tax = "Order") } +} \seealso{ \code{\link[phyloseq:mt-methods]{phyloseq::mt()}} } diff --git a/man/plot_tax_pq.Rd b/man/plot_tax_pq.Rd index c1d0238b..38a473ae 100644 --- a/man/plot_tax_pq.Rd +++ b/man/plot_tax_pq.Rd @@ -74,7 +74,7 @@ plot_tax_pq(data_fungi_sp_known, merge_sample_by = "Time", taxa_fill = "Class" ) - +\donttest{ plot_tax_pq(data_fungi_sp_known, "Height", merge_sample_by = "Height", @@ -91,6 +91,7 @@ plot_tax_pq(data_fungi_sp_known, clean_pq = FALSE ) } +} \seealso{ \code{\link[=tax_bar_pq]{tax_bar_pq()}} and \code{\link[=multitax_bar_pq]{multitax_bar_pq()}} } diff --git a/man/plot_tsne_pq.Rd b/man/plot_tsne_pq.Rd index 92296f96..0dccc5b9 100644 --- a/man/plot_tsne_pq.Rd +++ b/man/plot_tsne_pq.Rd @@ -55,8 +55,10 @@ Partially inspired by \code{phylosmith::tsne_phyloseq()} function developed by S \dontshow{if (tolower(Sys.info()[["sysname"]]) != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(data_fungi) plot_tsne_pq(data_fungi, fact = "Height", perplexity = 15) +\donttest{ plot_tsne_pq(data_fungi, fact = "Time") + geom_label(aes(label = Sample_id, fill = Time)) plot_tsne_pq(data_fungi, fact = "Time", na_remove = FALSE, force_factor = FALSE) +} \dontshow{\}) # examplesIf} } \author{ diff --git a/man/reorder_taxa_pq.Rd b/man/reorder_taxa_pq.Rd index bf0992d4..c7aa155b 100644 --- a/man/reorder_taxa_pq.Rd +++ b/man/reorder_taxa_pq.Rd @@ -32,9 +32,9 @@ data_fungi_ordered_by_genus <- reorder_taxa_pq( taxa_names(data_fungi)[order(as.vector(data_fungi@tax_table[, "Genus"]))] ) -data_fungi_asc_ordered_by_abundance <- reorder_taxa_pq( - data_fungi, - taxa_names(data_fungi)[order(taxa_sums(data_fungi))] +data_fungi_mini_asc_ordered_by_abundance <- reorder_taxa_pq( + data_fungi_mini, + taxa_names(data_fungi_mini)[order(taxa_sums(data_fungi_mini))] ) } \author{ diff --git a/man/ridges_pq.Rd b/man/ridges_pq.Rd index 1d466c6c..15b3f2eb 100644 --- a/man/ridges_pq.Rd +++ b/man/ridges_pq.Rd @@ -33,6 +33,7 @@ taxonomic groups \examples{ ridges_pq(data_fungi_mini, "Time", alpha = 0.5, log10trans = FALSE) + xlim(c(0, 1000)) +\donttest{ ridges_pq(data_fungi_mini, "Time", alpha = 0.5, scale = 0.9) ridges_pq(data_fungi_mini, "Sample_names", log10trans = TRUE) @@ -43,7 +44,7 @@ ridges_pq(data_fungi_mini, point_shape = "|", point_size = 3, point_alpha = 1, alpha = 0.7, scale = 0.8 ) - +} } \author{ Adrien Taudière diff --git a/man/sankey_pq.Rd b/man/sankey_pq.Rd index 3ebd81a8..5d6c7b25 100644 --- a/man/sankey_pq.Rd +++ b/man/sankey_pq.Rd @@ -57,9 +57,11 @@ of \code{fact} data("GlobalPatterns", package = "phyloseq") GP <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea") sankey_pq(GP, fact = "SampleType") +\donttest{ sankey_pq(GP, taxa = 1:4, min_prop_tax = 0.01) sankey_pq(GP, taxa = 1:4, min_prop_tax = 0.01, add_nb_seq = TRUE) } +} \seealso{ \code{\link[networkD3]{sankeyNetwork}} } diff --git a/man/tax_bar_pq.Rd b/man/tax_bar_pq.Rd index ab2a4165..b250f7dd 100644 --- a/man/tax_bar_pq.Rd +++ b/man/tax_bar_pq.Rd @@ -40,10 +40,12 @@ taxonomic groups data_fungi_ab <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 10000) tax_bar_pq(data_fungi_ab) + theme(legend.position = "none") +\donttest{ tax_bar_pq(data_fungi_ab, taxa = "Class") tax_bar_pq(data_fungi_ab, taxa = "Class", percent_bar = TRUE) tax_bar_pq(data_fungi_ab, taxa = "Class", fact = "Time") } +} \seealso{ \code{\link[=plot_tax_pq]{plot_tax_pq()}} and \code{\link[=multitax_bar_pq]{multitax_bar_pq()}} } diff --git a/man/treemap_pq.Rd b/man/treemap_pq.Rd index aa8184a4..c2e93fde 100644 --- a/man/treemap_pq.Rd +++ b/man/treemap_pq.Rd @@ -53,6 +53,7 @@ treemap_pq( "Order", "Class", plot_legend = TRUE ) +\donttest{ treemap_pq( clean_pq(subset_taxa( data_fungi_sp_known, @@ -70,6 +71,7 @@ treemap_pq( nb_seq = FALSE, log10trans = FALSE ) } +} \author{ Adrien Taudière } diff --git a/man/upset_pq.Rd b/man/upset_pq.Rd index 98fc50fa..d821bb5d 100644 --- a/man/upset_pq.Rd +++ b/man/upset_pq.Rd @@ -55,6 +55,7 @@ upset_pq(data_fungi_mini, fact = "Height", width_ratio = 0.2, taxa_fill = "Class" ) +\donttest{ upset_pq(data_fungi_mini, fact = "Height", min_nb_seq = 1000) upset_pq(data_fungi_mini, fact = "Height", na_remove = FALSE) @@ -156,6 +157,7 @@ data_fungi2@sam_data[["Height__Time_0"]][grepl("NA", data_fungi2@sam_data[["Heig NA upset_pq(data_fungi2, fact = "Height__Time_0", width_ratio = 0.2, min_size = 2) } +} \seealso{ \code{\link[=ggvenn_pq]{ggvenn_pq()}} } diff --git a/man/venn_pq.Rd b/man/venn_pq.Rd index 38c7bcf1..0d405b73 100644 --- a/man/venn_pq.Rd +++ b/man/venn_pq.Rd @@ -35,12 +35,14 @@ modalities of the argument \code{factor} \dontshow{if (tolower(Sys.info()[["sysname"]]) != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data("enterotype") venn_pq(enterotype, fact = "SeqTech") +\donttest{ venn_pq(enterotype, fact = "ClinicalStatus") venn_pq(enterotype, fact = "Nationality", print_values = FALSE) venn_pq(enterotype, fact = "ClinicalStatus", print_values = FALSE) + scale_fill_hue() venn_pq(enterotype, fact = "ClinicalStatus", print_values = FALSE) + scale_fill_hue() +} \dontshow{\}) # examplesIf} } \seealso{ diff --git a/tests/testthat/test_adonis.R b/tests/testthat/test_adonis.R index 21695b31..7de3bc65 100644 --- a/tests/testthat/test_adonis.R +++ b/tests/testthat/test_adonis.R @@ -3,6 +3,7 @@ data(enterotype, package = "phyloseq") test_that("adonis function works fine", { expect_s3_class(adonis_pq(data_fungi, "Tree_name"), "anova") + skip_on_cran() expect_s3_class(adonis_pq(data_fungi, "Height", na_remove = TRUE), "anova") expect_s3_class(adonis_pq(data_fungi, "Tree_name", correction_for_sample_size = TRUE), "anova") expect_s3_class(adonis_pq(data_fungi, "Tree_name", rarefy_nb_seqs = TRUE), "anova") diff --git a/tests/testthat/test_deprecated.R b/tests/testthat/test_deprecated.R index 6000b61e..04214dd2 100644 --- a/tests/testthat/test_deprecated.R +++ b/tests/testthat/test_deprecated.R @@ -25,6 +25,7 @@ GP <- subset_samples_pq( res_deseq <- DESeq2::DESeq(phyloseq_to_deseq2(GP, ~SampleType), test = "Wald", fitType = "local") test_that("Test one case for each deprecated functions", { + skip_on_cran() expect_warning(physeq_graph_test(data_fungi_mini, fact = "Tree_name"), "deprecated") expect_s3_class(suppressWarnings(adonis_phyloseq(data_fungi_mini, "Tree_name")), "anova") expect_s4_class(suppressWarnings(clean_pq(data_fungi_mini)), "phyloseq") diff --git a/tests/testthat/test_figures_beta_div.R b/tests/testthat/test_figures_beta_div.R index 963e75ff..9475cad2 100644 --- a/tests/testthat/test_figures_beta_div.R +++ b/tests/testthat/test_figures_beta_div.R @@ -20,6 +20,7 @@ res_mt <- test_that("circle_pq works", { expect_message(circle_pq(data_basidio_2trees, fact = "Tree_name", nproc = 1)) + skip_on_cran() expect_message(circle_pq( clean_pq(data_basidio_2trees, force_taxa_as_rows = TRUE), fact = "Tree_name", @@ -68,6 +69,7 @@ test_that("circle_pq works", { test_that("graph_test_pq works", { expect_silent(graph_test_pq(data_fungi_mini, fact = "Tree_name")) + skip_on_cran() expect_silent(graph_test_pq(data_fungi_mini, fact = "Tree_name", na_remove = TRUE)) expect_silent(graph_test_pq(data_fungi_mini, fact = "Tree_name", return_plot = FALSE)) expect_message(graph_test_pq( @@ -85,6 +87,7 @@ test_that("graph_test_pq works", { test_that("plot_mt works", { expect_s3_class(res_mt, "data.frame") expect_s3_class(suppressWarnings(plot_mt(res_mt)), "ggplot") + skip_on_cran() expect_s3_class(suppressWarnings(plot_mt( res_mt, taxa = "Genus", color_tax = "Order" @@ -93,6 +96,7 @@ test_that("plot_mt works", { test_that("sankey_pq works with GlobalPatterns dataset", { expect_silent(sankey_pq(GP_archae)) + skip_on_cran() expect_s3_class(sankey_pq(GP_archae), "htmlwidget") expect_s3_class(sankey_pq(GP_archae), "sankeyNetwork") expect_silent(suppressWarnings(sankey_pq(GP_archae, fact = "SampleType"))) @@ -147,6 +151,7 @@ test_that("sankey_pq works with GlobalPatterns dataset", { test_that("sankey_pq works with data_fungi_mini dataset", { expect_silent(sankey_pq(data_fungi_mini)) + skip_on_cran() expect_s3_class(sankey_pq(data_fungi_mini), "htmlwidget") expect_s3_class(sankey_pq(data_fungi_mini), "sankeyNetwork") expect_silent(suppressWarnings(sankey_pq(data_fungi_mini, fact = "Height"))) @@ -197,6 +202,7 @@ test_that("venn_pq works with data_fungi_mini dataset", { skip_on_os("windows") library("grid") expect_silent(venn_pq(data_fungi_mini, "Height")) + skip_on_cran() expect_silent(suppressMessages(venn_pq( clean_pq( data_fungi_mini, @@ -225,6 +231,7 @@ test_that("venn_pq works with data_fungi_mini dataset", { test_that("ggvenn_pq works with data_fungi_mini dataset", { expect_message(ggvenn_pq(data_fungi_mini, "Height")) + skip_on_cran() expect_message(ggvenn_pq(data_fungi_mini, "Height", rarefy_before_merging = TRUE)) expect_message(suppressWarnings(ggvenn_pq(data_fungi_mini, "Height", rarefy_after_merging = TRUE))) expect_message(ggvenn_pq(data_fungi_mini, "Height", add_nb_seq = TRUE)) @@ -240,6 +247,7 @@ test_that("ggvenn_pq works with data_fungi_mini dataset", { test_that("upset_pq works with data_fungi dataset", { expect_silent(suppressMessages(upset_pq(data_fungi_mini, "Height"))) + skip_on_cran() expect_s3_class(upset_pq(data_fungi_mini, "Height", taxa_fill = "Class"), "ggplot") expect_s3_class(upset_pq(data_fungi_mini, "Height"), "ggplot") expect_s3_class( @@ -264,6 +272,7 @@ test_that("upset_pq works with data_fungi dataset", { test_that("upset_test_pq works with data_fungi_mini dataset", { expect_s3_class(upset_test_pq(data_fungi_mini, "Height"), "data.frame") + skip_on_cran() expect_s3_class(upset_test_pq(data_fungi_mini, "Time"), "data.frame") expect_s3_class( upset_test_pq(data_fungi_mini, "Time", min_nb_seq = 10), @@ -295,6 +304,7 @@ test_that("plot_LCBD_pq works with data_fungi dataset", { ), "ggplot" ) + skip_on_cran() expect_s3_class( plot_LCBD_pq( data_fungi_mini, @@ -319,6 +329,7 @@ test_that("plot_LCBD_pq works with data_fungi dataset", { test_that("LCBD_pq works with data_fungi_mini dataset", { expect_s3_class(LCBD_pq(data_fungi_mini, nperm = 100), "beta.div") + skip_on_cran() expect_s3_class( LCBD_pq(data_fungi_mini, nperm = 100, method = "jaccard"), "beta.div" @@ -334,6 +345,7 @@ test_that("plot_LCBD_pq works with data_fungi_mini dataset", { ), "ggplot" ) + skip_on_cran() expect_s3_class( plot_LCBD_pq( data_fungi_mini, @@ -358,6 +370,7 @@ test_that("plot_LCBD_pq works with data_fungi_mini dataset", { test_that("plot_SCBD_pq works with data_fungi_mini dataset", { expect_s3_class(plot_SCBD_pq(data_fungi_mini), "ggplot") + skip_on_cran() expect_s3_class( plot_SCBD_pq( data_fungi_mini, @@ -391,7 +404,8 @@ test_that("multipatt_pq works with data_fungi_mini dataset", { levels_fact = c("Low", "High"), verbose = TRUE ))), "list") - + skip_on_cran() + expect_s3_class(res_height$bias_correct_log_table, "data.frame") expect_equal(dim(res_height$res), c(6, 15)) diff --git a/tests/testthat/test_figures_biplot.R b/tests/testthat/test_figures_biplot.R index 6fbb5b7c..dafbaedc 100644 --- a/tests/testthat/test_figures_biplot.R +++ b/tests/testthat/test_figures_biplot.R @@ -20,6 +20,7 @@ test_that("biplot_pq works", { ), "plotly" ) + skip_on_cran() expect_s3_class( biplot_pq( data_fungi_2trees, @@ -44,8 +45,6 @@ test_that("biplot_pq works", { "biplot_pq needs only two samples" ) expect_error(biplot_pq(data_fungi_2trees, merge_sample_by = "tRREE_name")) - - geom_label }) @@ -60,6 +59,7 @@ test_that("multi_biplot_pq works with data_fungi dataset", { p3 <- multi_biplot_pq(data_fungi_abun, pairs = "Random_pairs") expect_s3_class(p1[[1]], "ggplot") expect_type(p1, "list") + skip_on_cran() expect_s3_class(p2[[1]], "ggplot") expect_type(p2, "list") expect_s3_class(p3[[1]], "ggplot") diff --git a/tests/testthat/test_figures_misc.R b/tests/testthat/test_figures_misc.R index e3ccf360..ab25d7dc 100644 --- a/tests/testthat/test_figures_misc.R +++ b/tests/testthat/test_figures_misc.R @@ -10,11 +10,13 @@ test_that("tsne_pq works with data_fungi_mini dataset", { skip_on_os("windows") expect_silent(suppressMessages(res_tsne <- tsne_pq(data_fungi_mini))) expect_s3_class(res_tsne, "Rtsne") + skip_on_cran() expect_silent(suppressMessages(res_tsne <- tsne_pq(data_fungi_mini, dims = 3, perplexity = 25))) }) test_that("plot_tsne_pq works with data_fungi_mini dataset", { skip_on_os("windows") + skip_on_cran() expect_silent(suppressMessages(pt <- plot_tsne_pq(data_fungi_mini, fact = "Height", perplexity = 15))) expect_s3_class(pt, "ggplot") expect_error(plot_tsne_pq(data_fungi_mini, fact = "HEIgTHT")) @@ -22,6 +24,7 @@ test_that("plot_tsne_pq works with data_fungi_mini dataset", { test_that("SRS_curve_pq works with data_fungi_mini dataset", { expect_silent(suppressMessages(sc <- SRS_curve_pq(data_fungi_mini))) + skip_on_cran() expect_silent(suppressMessages(sc <- SRS_curve_pq(data_fungi_mini, clean_pq = TRUE))) expect_s3_class(sc, "recordedplot") expect_silent(suppressMessages(sc <- SRS_curve_pq(data_fungi_mini, metric = "shannon"))) @@ -32,6 +35,7 @@ test_that("multiplot works fine", { res_venn1 <- ggvenn_pq(data_fungi_mini, "Height") res_venn2 <- ggvenn_pq(data_fungi_mini, "Time") expect_silent(multiplot(res_venn1, res_venn2)) + skip_on_cran() expect_message(multiplot(res_venn1)) expect_type(multiplot(res_venn1, res_venn2), "NULL") }) diff --git a/tests/testthat/test_figures_taxo.R b/tests/testthat/test_figures_taxo.R index 764dd9c1..88c8f75d 100644 --- a/tests/testthat/test_figures_taxo.R +++ b/tests/testthat/test_figures_taxo.R @@ -14,6 +14,7 @@ GP_archae <- test_that("rotl_pq works with data_fungi dataset", { skip_on_os("windows") + skip_on_cran() library("rotl") expect_s3_class(suppressWarnings(tr <- rotl_pq(data_fungi, species_colnames = "Genus_species")), "phylo") @@ -30,6 +31,7 @@ test_that("rotl_pq works with data_fungi dataset", { test_that("heat_tree_pq works with data_fungi dataset", { library(metacoder) expect_silent(suppressMessages(ht <- heat_tree_pq(data_fungi_mini))) + skip_on_cran() expect_s3_class(ht, "ggplot") expect_s3_class( heat_tree_pq(data_fungi_mini, taxonomic_level = 1:4), @@ -44,6 +46,7 @@ GPsubset <- subset_taxa( test_that("heat_tree_pq works with GlobalPatterns dataset", { library(metacoder) expect_silent(suppressMessages(ht <- heat_tree_pq(GPsubset))) + skip_on_cran() expect_silent(suppressMessages( ht <- heat_tree_pq( @@ -70,6 +73,7 @@ test_that("plot_tax_pq works with data_fungi dataset", { add_info = FALSE ) )) + skip_on_cran() expect_silent(suppressMessages( pt <- plot_tax_pq( @@ -163,6 +167,7 @@ test_that("multitax_bar_pq works with data_fungi_sp_known dataset", { multitax_bar_pq(data_fungi_mini, "Phylum", "Class", "Order", "Time"), "ggplot" ) + skip_on_cran() expect_s3_class( multitax_bar_pq(data_fungi_mini, "Phylum", "Class", "Order"), "ggplot" @@ -201,6 +206,7 @@ test_that("multitax_bar_pq works with GlobalPatterns dataset", { multitax_bar_pq(GP_archae, "Phylum", "Class", "Order", "SampleType"), "ggplot" ) + skip_on_cran() expect_s3_class( multitax_bar_pq(GP_archae, "Phylum", "Class", "Order"), "ggplot" @@ -241,6 +247,7 @@ test_that("rigdes_pq work with data_fungi dataset", { ) + xlim(c(0, 1000)), "ggplot" ) + skip_on_cran() expect_s3_class( ridges_pq(data_fungi_mini, "Time", alpha = 0.5), "ggplot" @@ -305,6 +312,7 @@ test_that("treemap_pq work with data_fungi_sp_known dataset", { ), "ggplot" ) + skip_on_cran() expect_s3_class( treemap_pq( clean_pq( @@ -329,6 +337,7 @@ test_that("treemap_pq work with data_fungi_sp_known dataset", { test_that("tax_bar_pq work with data_fungi dataset", { expect_s3_class(tax_bar_pq(data_fungi_mini, taxa = "Class"), "ggplot") + skip_on_cran() expect_s3_class(tax_bar_pq(data_fungi_mini, taxa = "Class", fact = "Time"), "ggplot") expect_s3_class( tax_bar_pq( @@ -387,6 +396,7 @@ test_that("add_funguild_info and plot_guild_pq work with data_fungi_mini dataset test_that("build_phytree_pq work with data_fungi dataset", { skip_on_os("windows") + skip_on_cran() df <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 19000) expect_type(df_tree <- build_phytree_pq(df, nb_bootstrap = 2, rearrangement = "stochastic"), "list") expect_type(df_tree <- build_phytree_pq(df, nb_bootstrap = 2, rearrangement = "ratchet"), "list") diff --git a/tests/testthat/test_misc.R b/tests/testthat/test_misc.R index 75badde4..9a477023 100644 --- a/tests/testthat/test_misc.R +++ b/tests/testthat/test_misc.R @@ -8,6 +8,7 @@ test_that("dist_bycol works fine", { as_binary_otu_table(data_fungi)@otu_table ) ), 2) + skip_on_cran() expect_error(length(dist_bycol( data_fungi@otu_table, enterotype@otu_table ))) @@ -26,6 +27,7 @@ test_that("diff_fct_diff_class works fine", { ), 17852 ) + skip_on_cran() expect_equal( round(diff_fct_diff_class( data_fungi@sam_data$Time, @@ -93,6 +95,7 @@ withr::local_envvar( test_that("install_pkg_needed works fine", { expect_message(install_pkg_needed("abc", verbose = TRUE)) + skip_on_cran() expect_message(install_pkg_needed("MiscMetabar", verbose = TRUE)) expect_silent(install_pkg_needed("MiscMetabar")) expect_silent(suppressMessages(install_pkg_needed("microbiomeDataSets"))) @@ -100,6 +103,7 @@ test_that("install_pkg_needed works fine", { }) test_that("add_funguild_info works fine", { + skip_on_cran() skip_on_cran() data_f <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 5000) expect_silent(data_f <- add_funguild_info(data_f, diff --git a/tests/testthat/test_phyloseq_class.R b/tests/testthat/test_phyloseq_class.R index 7c85c4c9..b732e7ed 100644 --- a/tests/testthat/test_phyloseq_class.R +++ b/tests/testthat/test_phyloseq_class.R @@ -91,9 +91,9 @@ test_that("perc works fine", { test_that("count_seq works fine", { skip_on_os("windows") skip_on_os("mac") - expect_equal(count_seq(folder_path= "inst/extdata/fasta"), c(2, 3)) + expect_equal(count_seq(folder_path = "inst/extdata", pattern = "*.fasta"), c(1000, 3, 2)) expect_equal(count_seq("inst/extdata/ex_R1_001.fastq.gz"), 2500) - expect_equal(count_seq("inst/extdata/ex_R2_001.fastq.gz"), 2500 + expect_equal(count_seq("inst/extdata/ex_R2_001.fastq.gz"), 2500) expect_equal(count_seq("inst/extdata/ex.fasta"), 3) expect_equal(count_seq("inst/extdata/ex.fastq"), 4) expect_error(count_seq("tests/testthat.R"), "The file extension R is not supported.") From 618283aaffb7dcdbe14feceab2b817fe117a5084 Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Tue, 13 Feb 2024 05:00:20 +0100 Subject: [PATCH 6/8] Lower time for examples and test for CRAN --- R/Deseq2_edgeR.R | 2 +- R/beta_div_test.R | 6 ++-- R/blast.R | 14 ++++---- R/dada_phyloseq.R | 7 ++-- R/miscellanous.R | 5 ++- R/plot_functions.R | 14 ++++---- R/vsearch.R | 6 ++++ man/LCBD_pq.Rd | 2 +- man/adonis_pq.Rd | 2 +- man/asv2otu.Rd | 6 ++-- man/blast_to_phyloseq.Rd | 14 ++++---- man/chimera_detection_vs.Rd | 2 ++ man/chimera_removal_vs.Rd | 2 ++ man/count_seq.Rd | 5 ++- man/graph_test_pq.Rd | 2 +- man/multi_biplot_pq.Rd | 4 +-- man/multitax_bar_pq.Rd | 3 +- man/mumu_pq.Rd | 1 - man/rotl_pq.Rd | 3 +- man/vsearch_clustering.Rd | 2 ++ tests/testthat/test_clean_pq.R | 2 ++ tests/testthat/test_controls.R | 42 +++++++++++----------- tests/testthat/test_deprecated.R | 3 +- tests/testthat/test_deseq2_edgeR.R | 3 ++ tests/testthat/test_figures_alpha_div.R | 6 ++++ tests/testthat/test_figures_beta_div.R | 10 +++--- tests/testthat/test_figures_biplot.R | 2 +- tests/testthat/test_figures_misc.R | 4 +-- tests/testthat/test_figures_summary_plot.R | 3 ++ tests/testthat/test_figures_taxo.R | 6 ++-- tests/testthat/test_misc.R | 1 - tests/testthat/test_phyloseq_class.R | 4 ++- tests/testthat/test_subset.R | 2 ++ tests/testthat/test_table_functions.R | 4 +++ tests/testthat/test_tuckey.R | 3 ++ 35 files changed, 116 insertions(+), 81 deletions(-) diff --git a/R/Deseq2_edgeR.R b/R/Deseq2_edgeR.R index 4730fd22..aa61fbd7 100644 --- a/R/Deseq2_edgeR.R +++ b/R/Deseq2_edgeR.R @@ -26,7 +26,7 @@ #' plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), #' color_tax = "Kingdom" #' ) -#' +#' #' plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), #' taxolev = "Class", color_tax = "Kingdom" #' ) diff --git a/R/beta_div_test.R b/R/beta_div_test.R index ea736340..8940e745 100644 --- a/R/beta_div_test.R +++ b/R/beta_div_test.R @@ -26,7 +26,7 @@ #' data(enterotype) #' graph_test_pq(enterotype, fact = "SeqTech") #' \donttest{ -#' graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) +#' graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) #' } #' @author Adrien Taudière #' @@ -125,8 +125,8 @@ graph_test_pq <- function(physeq, #' more information. #' @examples #' data(enterotype) -#' adonis_pq(enterotype, "SeqTech*Enterotype", na_remove = TRUE) #' \donttest{ +#' adonis_pq(enterotype, "SeqTech*Enterotype", na_remove = TRUE) #' adonis_pq(enterotype, "SeqTech", dist_method = "jaccard") #' adonis_pq(enterotype, "SeqTech", dist_method = "robust.aitchison") #' } @@ -238,7 +238,7 @@ adonis_pq <- function(physeq, #' length(res$LCBD) #' length(res$SCBD) #' \donttest{ -#' LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") +#' LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") #' } #' #' @author Adrien Taudière diff --git a/R/blast.R b/R/blast.R index 705a500a..b4795ae2 100644 --- a/R/blast.R +++ b/R/blast.R @@ -46,13 +46,13 @@ #' @examples #' \dontrun{ #' -#' blastpath <- "...YOUR_PATH_TO_BLAST..." -#' blast_to_phyloseq(data_fungi, -#' seq2search = system.file("extdata", "ex.fasta", -#' package = "MiscMetabar", mustWork = TRUE -#' ), -#' blastpath = blastpath -#' ) +#' # blastpath <- "...YOUR_PATH_TO_BLAST..." +#' # blast_to_phyloseq(data_fungi, +#' # seq2search = system.file("extdata", "ex.fasta", +#' # package = "MiscMetabar", mustWork = TRUE +#' # ), +#' # blastpath = blastpath +#' # ) #' } blast_to_phyloseq <- function(physeq, seq2search, diff --git a/R/dada_phyloseq.R b/R/dada_phyloseq.R index bcbfcf24..2b1b5cdf 100644 --- a/R/dada_phyloseq.R +++ b/R/dada_phyloseq.R @@ -525,15 +525,15 @@ track_wkflow_samples <- function(list_pq_obj, ...) { #' @examples #' asv2otu(data_fungi_mini) #' \donttest{ -#' asv2otu(data_fungi_mini, method_clusterize = "longest") -#' } +#' asv2otu(data_fungi_mini, method_clusterize = "longest") +#' #' if (MiscMetabar:::is_swarm_installed()) { #' d_swarm <- asv2otu(data_fungi_mini, method = "swarm") #' } #' if (MiscMetabar:::is_vsearch_installed()) { #' d_vs <- asv2otu(data_fungi_mini, method = "vsearch") #' } -#' +#' } #' @references #' VSEARCH can be downloaded from #' \url{https://github.com/torognes/vsearch}. @@ -1165,7 +1165,6 @@ lulu_pq <- function(physeq, #' @export #' @examples #' \dontrun{ -#' data(data_fungi_sp_known) #' mumu_pq(data_fungi_sp_known) #' } #' @author Frédéric Mahé diff --git a/R/miscellanous.R b/R/miscellanous.R index 4a2e0080..f22e9550 100644 --- a/R/miscellanous.R +++ b/R/miscellanous.R @@ -202,7 +202,10 @@ perc <- function(x, y = NULL, accuracy = 0, add_symbol = FALSE) { #' package = "MiscMetabar", #' mustWork = TRUE #' )) -#' count_seq(folder_path = "extdata/", pattern = "*.fasta") +#' count_seq( +#' folder_path = system.file("extdata", package = "MiscMetabar"), +#' pattern = "*.fasta" +#' ) count_seq <- function(file_path = NULL, folder_path = NULL, pattern = NULL) { if (is.null(file_path) && is.null(folder_path)) { stop("You need to specify one of file_path or folder_path param!") diff --git a/R/plot_functions.R b/R/plot_functions.R index fd05f52e..27c6bd35 100644 --- a/R/plot_functions.R +++ b/R/plot_functions.R @@ -366,7 +366,7 @@ accu_samp_threshold <- function(res_accuplot, threshold = 0.95) { #' circle_pq(GP, "SampleType") #' circle_pq(GP, "SampleType", add_nb_seq = FALSE) #' circle_pq(GP, "SampleType", taxa = "Class") -#'} +#' } #' @author Adrien Taudière #' #' @return A \code{\link[circlize]{chordDiagram}} plot representing the @@ -1724,10 +1724,11 @@ summary_plot_pq <- function(physeq, #' Please make a reference to `rotl` package if you #' use this function. #' @examplesIf tolower(Sys.info()[["sysname"]]) != "windows" +#' \donttest{ #' library("rotl") #' tr <- rotl_pq(data_fungi_mini, species_colnames = "Genus_species") #' plot(tr) -#' \dontrun{ +#' #' tr_Asco <- rotl_pq(data_fungi, species_colnames = "Genus_species", context_name = "Ascomycetes") #' plot(tr_Asco) #' } @@ -2128,11 +2129,11 @@ biplot_pq <- function(physeq, #' @export #' #' @examples -#' +#' \donttest{ #' data_fungi_abun <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 10000) #' p <- multi_biplot_pq(data_fungi_abun, "Height") #' lapply(p, print) -#' +#' } #' @author Adrien Taudière multi_biplot_pq <- function(physeq, split_by = NULL, @@ -2402,9 +2403,8 @@ plot_tax_pq <- #' #' @author Adrien Taudière #' @examples -#' data(data_fungi_sp_known) -#' multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", "Time") #' \donttest{ +#' multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", "Time") #' multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order") #' multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", #' nb_seq = FALSE, log10trans = FALSE @@ -3218,7 +3218,7 @@ tax_bar_pq <- function(physeq, fact = "Sample", taxa = "Order", percent_bar = FA #' point_shape = "|", point_size = 3, point_alpha = 1, alpha = 0.7, #' scale = 0.8 #' ) -#'} +#' } ridges_pq <- function(physeq, fact, nb_seq = TRUE, diff --git a/R/vsearch.R b/R/vsearch.R index ef8b9c0d..7a9016c1 100644 --- a/R/vsearch.R +++ b/R/vsearch.R @@ -374,9 +374,11 @@ swarm_clustering <- function(physeq = NULL, #' @author Adrien Taudière #' #' @examplesIf MiscMetabar:::is_vsearch_installed() +#' \donttest{ #' summary_plot_pq(data_fungi) #' d_vs <- vsearch_clustering(data_fungi) #' summary_plot_pq(d_vs) +#' } #' @details #' This function is mainly a wrapper of the work of others. #' Please cite [vsearch](https://github.com/torognes/vsearch). @@ -500,6 +502,7 @@ vsearch_clustering <- function(physeq = NULL, #' @export #' #' @examplesIf MiscMetabar:::is_vsearch_installed() +#' \donttest{ #' data_fungi_nochim <- chimera_removal_vs(data_fungi) #' data_fungi_nochim_16 <- chimera_removal_vs(data_fungi, #' abskew = 16, @@ -509,6 +512,7 @@ vsearch_clustering <- function(physeq = NULL, #' chimera_removal_vs(data_fungi, type = "Select_only_non_chim") #' data_fungi_chimera <- #' chimera_removal_vs(data_fungi, type = "Select_only_chim") +#' } #' @author Adrien Taudière #' @details #' This function is mainly a wrapper of the work of others. @@ -621,10 +625,12 @@ chimera_removal_vs <- #' @export #' #' @examplesIf MiscMetabar:::is_vsearch_installed() +#' \donttest{ #' chimera_detection_vs( #' seq2search = data_fungi@refseq, #' nb_seq = taxa_sums(data_fungi) #' ) +#' } #' @author Adrien Taudière #' @details #' This function is mainly a wrapper of the work of others. diff --git a/man/LCBD_pq.Rd b/man/LCBD_pq.Rd index e6562e58..15e57945 100644 --- a/man/LCBD_pq.Rd +++ b/man/LCBD_pq.Rd @@ -31,7 +31,7 @@ str(res) length(res$LCBD) length(res$SCBD) \donttest{ - LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") +LCBD_pq(data_fungi_sp_known, nperm = 5, method = "jaccard") } } diff --git a/man/adonis_pq.Rd b/man/adonis_pq.Rd index 3c79696c..ec79cd25 100644 --- a/man/adonis_pq.Rd +++ b/man/adonis_pq.Rd @@ -66,8 +66,8 @@ use this function. } \examples{ data(enterotype) -adonis_pq(enterotype, "SeqTech*Enterotype", na_remove = TRUE) \donttest{ +adonis_pq(enterotype, "SeqTech*Enterotype", na_remove = TRUE) adonis_pq(enterotype, "SeqTech", dist_method = "jaccard") adonis_pq(enterotype, "SeqTech", dist_method = "robust.aitchison") } diff --git a/man/asv2otu.Rd b/man/asv2otu.Rd index b30eecc2..c98c9774 100644 --- a/man/asv2otu.Rd +++ b/man/asv2otu.Rd @@ -102,15 +102,15 @@ of \code{\link[=merge_taxa_vec]{merge_taxa_vec()}}. \examples{ asv2otu(data_fungi_mini) \donttest{ - asv2otu(data_fungi_mini, method_clusterize = "longest") -} +asv2otu(data_fungi_mini, method_clusterize = "longest") + if (MiscMetabar:::is_swarm_installed()) { d_swarm <- asv2otu(data_fungi_mini, method = "swarm") } if (MiscMetabar:::is_vsearch_installed()) { d_vs <- asv2otu(data_fungi_mini, method = "vsearch") } - +} } \references{ VSEARCH can be downloaded from diff --git a/man/blast_to_phyloseq.Rd b/man/blast_to_phyloseq.Rd index 0755c137..04ac05c7 100644 --- a/man/blast_to_phyloseq.Rd +++ b/man/blast_to_phyloseq.Rd @@ -80,13 +80,13 @@ the blast table \examples{ \dontrun{ -blastpath <- "...YOUR_PATH_TO_BLAST..." -blast_to_phyloseq(data_fungi, - seq2search = system.file("extdata", "ex.fasta", - package = "MiscMetabar", mustWork = TRUE - ), - blastpath = blastpath -) +# blastpath <- "...YOUR_PATH_TO_BLAST..." +# blast_to_phyloseq(data_fungi, +# seq2search = system.file("extdata", "ex.fasta", +# package = "MiscMetabar", mustWork = TRUE +# ), +# blastpath = blastpath +# ) } } \seealso{ diff --git a/man/chimera_detection_vs.Rd b/man/chimera_detection_vs.Rd index 8c028359..4478d01c 100644 --- a/man/chimera_detection_vs.Rd +++ b/man/chimera_detection_vs.Rd @@ -58,10 +58,12 @@ Please make \href{https://github.com/torognes/vsearch}{vsearch}. } \examples{ \dontshow{if (MiscMetabar:::is_vsearch_installed()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\donttest{ chimera_detection_vs( seq2search = data_fungi@refseq, nb_seq = taxa_sums(data_fungi) ) +} \dontshow{\}) # examplesIf} } \author{ diff --git a/man/chimera_removal_vs.Rd b/man/chimera_removal_vs.Rd index 18eb93f9..fee96251 100644 --- a/man/chimera_removal_vs.Rd +++ b/man/chimera_removal_vs.Rd @@ -46,6 +46,7 @@ Please make \href{https://github.com/torognes/vsearch}{vsearch}. } \examples{ \dontshow{if (MiscMetabar:::is_vsearch_installed()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\donttest{ data_fungi_nochim <- chimera_removal_vs(data_fungi) data_fungi_nochim_16 <- chimera_removal_vs(data_fungi, abskew = 16, @@ -55,6 +56,7 @@ data_fungi_nochim2 <- chimera_removal_vs(data_fungi, type = "Select_only_non_chim") data_fungi_chimera <- chimera_removal_vs(data_fungi, type = "Select_only_chim") +} \dontshow{\}) # examplesIf} } \seealso{ diff --git a/man/count_seq.Rd b/man/count_seq.Rd index fa6375b5..6da5e7d4 100644 --- a/man/count_seq.Rd +++ b/man/count_seq.Rd @@ -29,7 +29,10 @@ count_seq(file_path = system.file( package = "MiscMetabar", mustWork = TRUE )) -count_seq(folder_path = "extdata/", pattern = "*.fasta") +count_seq( + folder_path = system.file("extdata", package = "MiscMetabar"), + pattern = "*.fasta" +) \dontshow{\}) # examplesIf} } \author{ diff --git a/man/graph_test_pq.Rd b/man/graph_test_pq.Rd index 2d7602dd..ae3fc845 100644 --- a/man/graph_test_pq.Rd +++ b/man/graph_test_pq.Rd @@ -58,7 +58,7 @@ Please cite \code{phyloseqGraphTest} package. data(enterotype) graph_test_pq(enterotype, fact = "SeqTech") \donttest{ - graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) +graph_test_pq(enterotype, fact = "Enterotype", na_remove = TRUE) } } \author{ diff --git a/man/multi_biplot_pq.Rd b/man/multi_biplot_pq.Rd index b7cd4319..26135c48 100644 --- a/man/multi_biplot_pq.Rd +++ b/man/multi_biplot_pq.Rd @@ -32,11 +32,11 @@ This allow to plot all the possible \code{\link[=biplot_pq]{biplot_pq()}} combin using one factor. } \examples{ - +\donttest{ data_fungi_abun <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 10000) p <- multi_biplot_pq(data_fungi_abun, "Height") lapply(p, print) - +} } \author{ Adrien Taudière diff --git a/man/multitax_bar_pq.Rd b/man/multitax_bar_pq.Rd index f5f60cc1..db7eceba 100644 --- a/man/multitax_bar_pq.Rd +++ b/man/multitax_bar_pq.Rd @@ -47,9 +47,8 @@ Note that lvl3 need to be nested in lvl2 which need to be nested in lvl1 } \examples{ -data(data_fungi_sp_known) -multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", "Time") \donttest{ +multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", "Time") multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order") multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", nb_seq = FALSE, log10trans = FALSE diff --git a/man/mumu_pq.Rd b/man/mumu_pq.Rd index fcbc7ca2..581abac3 100644 --- a/man/mumu_pq.Rd +++ b/man/mumu_pq.Rd @@ -60,7 +60,6 @@ for your work. } \examples{ \dontrun{ -data(data_fungi_sp_known) mumu_pq(data_fungi_sp_known) } } diff --git a/man/rotl_pq.Rd b/man/rotl_pq.Rd index 61c90a4a..77f3aeb1 100644 --- a/man/rotl_pq.Rd +++ b/man/rotl_pq.Rd @@ -32,10 +32,11 @@ use this function. } \examples{ \dontshow{if (tolower(Sys.info()[["sysname"]]) != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\donttest{ library("rotl") tr <- rotl_pq(data_fungi_mini, species_colnames = "Genus_species") plot(tr) -\dontrun{ + tr_Asco <- rotl_pq(data_fungi, species_colnames = "Genus_species", context_name = "Ascomycetes") plot(tr_Asco) } diff --git a/man/vsearch_clustering.Rd b/man/vsearch_clustering.Rd index c1f3c8ed..c1cf8f29 100644 --- a/man/vsearch_clustering.Rd +++ b/man/vsearch_clustering.Rd @@ -74,9 +74,11 @@ Please cite \href{https://github.com/torognes/vsearch}{vsearch}. } \examples{ \dontshow{if (MiscMetabar:::is_vsearch_installed()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\donttest{ summary_plot_pq(data_fungi) d_vs <- vsearch_clustering(data_fungi) summary_plot_pq(d_vs) +} \dontshow{\}) # examplesIf} } \references{ diff --git a/tests/testthat/test_clean_pq.R b/tests/testthat/test_clean_pq.R index 254a9733..7e12cb86 100644 --- a/tests/testthat/test_clean_pq.R +++ b/tests/testthat/test_clean_pq.R @@ -7,6 +7,7 @@ data_fungi_test@otu_table[10, ] <- rep(0, ncol(data_fungi_test@otu_table)) test_that("clean_pq return a phyloseq object after cleaning empty taxa and samples", { expect_s4_class(data_fungi_test, "phyloseq") expect_s4_class(clean_pq(data_fungi_test), "phyloseq") + skip_on_cran() expect_s4_class(clean_pq(data_fungi_test, verbose = TRUE), "phyloseq") expect_s4_class(clean_pq(data_fungi_test, reorder_asv = TRUE), "phyloseq") expect_s4_class(clean_pq(data_fungi_test, rename_asv = TRUE), "phyloseq") @@ -15,6 +16,7 @@ test_that("clean_pq return a phyloseq object after cleaning empty taxa and sampl test_that("clean_pq clean empty taxa and samples", { expect_message(clean_pq(data_fungi_test), "Cleaning suppress 2 taxa and 1 samples") + skip_on_cran() expect_equal(nrow(data_fungi_test@otu_table) - nrow(clean_pq(data_fungi_test)@otu_table), 1) expect_equal(ncol(data_fungi_test@otu_table) - diff --git a/tests/testthat/test_controls.R b/tests/testthat/test_controls.R index 9804bff4..f705d564 100644 --- a/tests/testthat/test_controls.R +++ b/tests/testthat/test_controls.R @@ -9,29 +9,27 @@ test_that("dist_pos_control function works fine", { expect_equal(length(dist_pos_control(enterotype, sam_name_factice)), 2) }) -data(data_fungi) - -res_seq <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), - method = "cutoff_seq" -)) -res_mixt <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), - method = "cutoff_mixt" -)) -res_diff <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), - method = "cutoff_diff", min_diff_for_cutoff = 2 -)) -res_min <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), - method = "min", min_diff_for_cutoff = 2 -)) -res_max <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), - method = "max", min_diff_for_cutoff = 2 -)) -res_mean <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), - method = "mean", min_diff_for_cutoff = 2 -)) - - test_that("subset_taxa_tax_control function works fine", { + skip_on_cran() + res_seq <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), + method = "cutoff_seq" + )) + res_mixt <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), + method = "cutoff_mixt" + )) + res_diff <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), + method = "cutoff_diff", min_diff_for_cutoff = 2 + )) + res_min <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), + method = "min", min_diff_for_cutoff = 2 + )) + res_max <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), + method = "max", min_diff_for_cutoff = 2 + )) + res_mean <- suppressWarnings(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), + method = "mean", min_diff_for_cutoff = 2 + )) + expect_error(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), method = "cutoff_diff")) expect_error(subset_taxa_tax_control(data_fungi, as.numeric(data_fungi@otu_table[, 50]), method = "cut", min_diff_for_cutoff = 2)) expect_s4_class(res_seq, "phyloseq") diff --git a/tests/testthat/test_deprecated.R b/tests/testthat/test_deprecated.R index 04214dd2..f9fdf38d 100644 --- a/tests/testthat/test_deprecated.R +++ b/tests/testthat/test_deprecated.R @@ -22,10 +22,9 @@ GP <- subset_samples_pq( GP_archae@sam_data$SampleType %in% c("Soil", "Skin") ) -res_deseq <- DESeq2::DESeq(phyloseq_to_deseq2(GP, ~SampleType), test = "Wald", fitType = "local") - test_that("Test one case for each deprecated functions", { skip_on_cran() + res_deseq <- DESeq2::DESeq(phyloseq_to_deseq2(GP, ~SampleType), test = "Wald", fitType = "local") expect_warning(physeq_graph_test(data_fungi_mini, fact = "Tree_name"), "deprecated") expect_s3_class(suppressWarnings(adonis_phyloseq(data_fungi_mini, "Tree_name")), "anova") expect_s4_class(suppressWarnings(clean_pq(data_fungi_mini)), "phyloseq") diff --git a/tests/testthat/test_deseq2_edgeR.R b/tests/testthat/test_deseq2_edgeR.R index 28ea1bcb..dc7b3817 100644 --- a/tests/testthat/test_deseq2_edgeR.R +++ b/tests/testthat/test_deseq2_edgeR.R @@ -29,6 +29,7 @@ fac2col <- function(x, col.pal = funky_color, na.col = "transparent", seed = NUL test_that("plot_edgeR_pq works with GP dataset", { expect_message(plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), color_tax = "Kingdom"), "Perform edgeR binary test") + skip_on_cran() expect_message(plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), color_tax = "Species"), "Perform edgeR binary test") expect_message(plot_edgeR_pq(GP_archae, c("SampleType", "Soil", "Feces"), taxolev = "Class", color_tax = "Kingdom"), "Perform edgeR binary test") expect_error(plot_edgeR_pq(GP_archae, "SampleType", taxolev = "Class", color_tax = "Kingdom"), "At least one element of given pair is not a group") @@ -37,6 +38,7 @@ test_that("plot_edgeR_pq works with GP dataset", { test_that("plot_deseq2_pq works with results on GP dataset", { expect_message(res <- DESeq2::DESeq(phyloseq_to_deseq2(GP, ~SampleType), test = "Wald", fitType = "local"), "fitting model and testing") + skip_on_cran() expect_silent(suppressWarnings(plot_deseq2_pq(res, c("SampleType", "Soil", "Skin"), tax_table = GP@tax_table, color_tax = "Kingdom"))) expect_silent(suppressWarnings(plot_deseq2_pq(res, c("SampleType", "Soil", "Skin"), tax_table = GP@tax_table, tax_depth = "Genus"))) expect_silent(suppressWarnings(plot_deseq2_pq(res, c("SampleType", "Soil", "Skin"), @@ -56,6 +58,7 @@ test_that("plot_deseq2_pq works with results on GP dataset", { test_that("plot_deseq2_pq works with GP dataset", { expect_message(suppressWarnings(plot_deseq2_pq(GP, c("SampleType", "Soil", "Skin")))) + skip_on_cran() expect_message(suppressWarnings(plot_deseq2_pq(GP, c("SampleType", "Soil", "Skin"), color_tax = "Class", select_taxa = c("522457", "271582", "200359")))) expect_message(suppressWarnings(plot_deseq2_pq(GP, c("SampleType", "Soil", "Skin"), taxolev = "Class", verbose = TRUE))) expect_message(suppressWarnings(plot_deseq2_pq(GP, c("SampleType", "Soil", "Skin"), pval = 0.1))) diff --git a/tests/testthat/test_figures_alpha_div.R b/tests/testthat/test_figures_alpha_div.R index ddb3dac6..44941868 100644 --- a/tests/testthat/test_figures_alpha_div.R +++ b/tests/testthat/test_figures_alpha_div.R @@ -16,6 +16,7 @@ data_basidio <- subset_taxa(data_fungi, Phylum == "Basidiomycota") test_that("hill_pq works with data_fungi dataset", { expect_message(hill_pq(data_fungi_mini, "Height")) + skip_on_cran() expect_message(hill_pq(data_fungi_mini, "Height", add_points = TRUE)) expect_silent(suppressMessages(hill_pq( clean_pq(subset_samples_pq( @@ -60,6 +61,7 @@ test_that("hill_pq works with data_fungi dataset", { test_that("hill_pq works with GP dataset", { expect_message(hill_pq(GP, "SampleType")) + skip_on_cran() expect_message(hill_pq(GP, "SampleType", add_points = TRUE)) expect_silent(suppressMessages(hill_pq(GP, "SampleType", letters = TRUE))) expect_silent(suppressMessages(hill_pq(GP, "SampleType", add_points = TRUE))) @@ -68,6 +70,7 @@ test_that("hill_pq works with GP dataset", { }) test_that("iNEXT_pq works with data_fungi_mini dataset", { + skip_on_cran() library("iNEXT") expect_s3_class( suppressWarnings(res_iNEXT <- iNEXT_pq( @@ -90,6 +93,7 @@ test_that("iNEXT_pq works with data_fungi_mini dataset", { test_that("accu_plot works with GlobalPatterns dataset", { expect_silent(suppressWarnings(accu_plot(GP_archae, fact = "X.SampleID", by.fact = TRUE))) + skip_on_cran() expect_silent(suppressWarnings(accu_plot(GP_archae, fact = "X.SampleID", by.fact = FALSE))) expect_silent(suppressWarnings(accu_plot( GP_archae, @@ -115,6 +119,7 @@ test_that("accu_plot works with GlobalPatterns dataset", { }) test_that("accu_plot works with data_fungi dataset", { + skip_on_cran() expect_silent(accu_plot(data_basidio, fact = "Height", by.fact = TRUE)) expect_error(suppressWarnings(accu_plot(data_basidio, fact = "Height", @@ -148,6 +153,7 @@ test_that("accu_samp_threshold works with GlobalPatterns dataset", { }) test_that("accu_samp_threshold works with data_fungi_mini dataset", { + skip_on_cran() expect_warning(ggb <- ggbetween_pq(data_fungi_mini, variable = "Time")) expect_equal(length(ggb), 3) diff --git a/tests/testthat/test_figures_beta_div.R b/tests/testthat/test_figures_beta_div.R index 9475cad2..9cf5e51c 100644 --- a/tests/testthat/test_figures_beta_div.R +++ b/tests/testthat/test_figures_beta_div.R @@ -19,8 +19,8 @@ res_mt <- ) test_that("circle_pq works", { - expect_message(circle_pq(data_basidio_2trees, fact = "Tree_name", nproc = 1)) skip_on_cran() + expect_message(circle_pq(data_basidio_2trees, fact = "Tree_name", nproc = 1)) expect_message(circle_pq( clean_pq(data_basidio_2trees, force_taxa_as_rows = TRUE), fact = "Tree_name", @@ -200,9 +200,9 @@ test_that("sankey_pq works with data_fungi_mini dataset", { test_that("venn_pq works with data_fungi_mini dataset", { skip_on_os("windows") + skip_on_cran() library("grid") expect_silent(venn_pq(data_fungi_mini, "Height")) - skip_on_cran() expect_silent(suppressMessages(venn_pq( clean_pq( data_fungi_mini, @@ -296,6 +296,7 @@ test_that("upset_test_pq works with data_fungi_mini dataset", { }) test_that("plot_LCBD_pq works with data_fungi dataset", { + skip_on_cran() expect_s3_class( plot_LCBD_pq( data_fungi_mini, @@ -304,7 +305,6 @@ test_that("plot_LCBD_pq works with data_fungi dataset", { ), "ggplot" ) - skip_on_cran() expect_s3_class( plot_LCBD_pq( data_fungi_mini, @@ -384,6 +384,7 @@ test_that("plot_SCBD_pq works with data_fungi_mini dataset", { test_that("multipatt_pq works with data_fungi_mini dataset", { skip_on_os("windows") + skip_on_cran() expect_s3_class( multipatt_pq(subset_samples(data_fungi_mini, !is.na(Time)), fact = "Time" @@ -395,6 +396,7 @@ test_that("multipatt_pq works with data_fungi_mini dataset", { test_that("multipatt_pq works with data_fungi_mini dataset", { skip_on_os("windows") + skip_on_cran() expect_type(suppressMessages(suppressWarnings(res_height <- ancombc_pq( subset_taxa_pq( data_fungi_sp_known, @@ -404,8 +406,6 @@ test_that("multipatt_pq works with data_fungi_mini dataset", { levels_fact = c("Low", "High"), verbose = TRUE ))), "list") - skip_on_cran() - expect_s3_class(res_height$bias_correct_log_table, "data.frame") expect_equal(dim(res_height$res), c(6, 15)) diff --git a/tests/testthat/test_figures_biplot.R b/tests/testthat/test_figures_biplot.R index dafbaedc..4d6afec7 100644 --- a/tests/testthat/test_figures_biplot.R +++ b/tests/testthat/test_figures_biplot.R @@ -20,7 +20,7 @@ test_that("biplot_pq works", { ), "plotly" ) - skip_on_cran() + skip_on_cran() expect_s3_class( biplot_pq( data_fungi_2trees, diff --git a/tests/testthat/test_figures_misc.R b/tests/testthat/test_figures_misc.R index ab25d7dc..e9de6db0 100644 --- a/tests/testthat/test_figures_misc.R +++ b/tests/testthat/test_figures_misc.R @@ -8,9 +8,9 @@ data_basidio <- subset_taxa(data_fungi, Phylum == "Basidiomycota") test_that("tsne_pq works with data_fungi_mini dataset", { skip_on_os("windows") + skip_on_cran() expect_silent(suppressMessages(res_tsne <- tsne_pq(data_fungi_mini))) expect_s3_class(res_tsne, "Rtsne") - skip_on_cran() expect_silent(suppressMessages(res_tsne <- tsne_pq(data_fungi_mini, dims = 3, perplexity = 25))) }) @@ -32,10 +32,10 @@ test_that("SRS_curve_pq works with data_fungi_mini dataset", { }) test_that("multiplot works fine", { + skip_on_cran() res_venn1 <- ggvenn_pq(data_fungi_mini, "Height") res_venn2 <- ggvenn_pq(data_fungi_mini, "Time") expect_silent(multiplot(res_venn1, res_venn2)) - skip_on_cran() expect_message(multiplot(res_venn1)) expect_type(multiplot(res_venn1, res_venn2), "NULL") }) diff --git a/tests/testthat/test_figures_summary_plot.R b/tests/testthat/test_figures_summary_plot.R index 7d5c94f5..7cb27a10 100644 --- a/tests/testthat/test_figures_summary_plot.R +++ b/tests/testthat/test_figures_summary_plot.R @@ -7,6 +7,7 @@ GP <- GlobalPatterns test_that("summary_plot_pq works with data_fungi dataset", { expect_message(summary_plot_pq(data_fungi)) + skip_on_cran() expect_s3_class(summary_plot_pq(data_fungi), "ggplot") expect_message(summary_plot_pq(data_fungi, add_info = FALSE)) expect_message(summary_plot_pq(data_fungi, add_info = FALSE, min_seq_samples = 33)) @@ -16,6 +17,7 @@ test_that("summary_plot_pq works with data_fungi dataset", { test_that("summary_plot_pq works with GP dataset", { expect_message(summary_plot_pq(GP)) + skip_on_cran() expect_s3_class(summary_plot_pq(GP), "ggplot") expect_message(summary_plot_pq(GP, add_info = FALSE)) expect_message(summary_plot_pq(GP, add_info = FALSE, min_seq_samples = 33)) @@ -25,6 +27,7 @@ test_that("summary_plot_pq works with GP dataset", { test_that("summary_plot_pq works with enterotype dataset", { expect_message(summary_plot_pq(enterotype)) + skip_on_cran() expect_s3_class(summary_plot_pq(enterotype), "ggplot") expect_message(summary_plot_pq(enterotype, add_info = FALSE)) expect_message(summary_plot_pq(enterotype, add_info = FALSE, min_seq_samples = 33)) diff --git a/tests/testthat/test_figures_taxo.R b/tests/testthat/test_figures_taxo.R index 88c8f75d..85ac0168 100644 --- a/tests/testthat/test_figures_taxo.R +++ b/tests/testthat/test_figures_taxo.R @@ -1,5 +1,3 @@ -data("data_fungi") -data("data_fungi_sp_known") data("GlobalPatterns", package = "phyloseq") data("enterotype", package = "phyloseq") @@ -29,9 +27,9 @@ test_that("rotl_pq works with data_fungi dataset", { }) test_that("heat_tree_pq works with data_fungi dataset", { + skip_on_cran() library(metacoder) expect_silent(suppressMessages(ht <- heat_tree_pq(data_fungi_mini))) - skip_on_cran() expect_s3_class(ht, "ggplot") expect_s3_class( heat_tree_pq(data_fungi_mini, taxonomic_level = 1:4), @@ -44,9 +42,9 @@ GPsubset <- subset_taxa( GlobalPatterns@tax_table[, 1] == "Bacteria" ) test_that("heat_tree_pq works with GlobalPatterns dataset", { + skip_on_cran() library(metacoder) expect_silent(suppressMessages(ht <- heat_tree_pq(GPsubset))) - skip_on_cran() expect_silent(suppressMessages( ht <- heat_tree_pq( diff --git a/tests/testthat/test_misc.R b/tests/testthat/test_misc.R index 9a477023..ab2057d0 100644 --- a/tests/testthat/test_misc.R +++ b/tests/testthat/test_misc.R @@ -103,7 +103,6 @@ test_that("install_pkg_needed works fine", { }) test_that("add_funguild_info works fine", { - skip_on_cran() skip_on_cran() data_f <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 5000) expect_silent(data_f <- add_funguild_info(data_f, diff --git a/tests/testthat/test_phyloseq_class.R b/tests/testthat/test_phyloseq_class.R index b732e7ed..00d55172 100644 --- a/tests/testthat/test_phyloseq_class.R +++ b/tests/testthat/test_phyloseq_class.R @@ -7,6 +7,7 @@ sequences_ex <- c( ) test_that("asv2otu works fine with Clusterize method", { expect_s4_class(data_fungi_mini, "phyloseq") + skip_on_cran() expect_s4_class(suppressWarnings(asv2otu(data_fungi_mini)), "phyloseq") expect_s4_class(suppressWarnings(asv2otu(data_fungi_mini, method_clusterize = "longest" @@ -62,7 +63,7 @@ test_that("add_dna_to_phyloseq works fine", { }) - test_that("verify_pq works fine", { +test_that("verify_pq works fine", { expect_error(verify_pq(unclass(data_fungi_mini)), "The physeq argument is not a valid phyloseq object.") expect_silent(suppressWarnings(verify_pq(data_fungi_mini, verbose = TRUE))) }) @@ -91,6 +92,7 @@ test_that("perc works fine", { test_that("count_seq works fine", { skip_on_os("windows") skip_on_os("mac") + skip_on_cran() expect_equal(count_seq(folder_path = "inst/extdata", pattern = "*.fasta"), c(1000, 3, 2)) expect_equal(count_seq("inst/extdata/ex_R1_001.fastq.gz"), 2500) expect_equal(count_seq("inst/extdata/ex_R2_001.fastq.gz"), 2500) diff --git a/tests/testthat/test_subset.R b/tests/testthat/test_subset.R index 2e4c7660..9389f658 100644 --- a/tests/testthat/test_subset.R +++ b/tests/testthat/test_subset.R @@ -4,6 +4,7 @@ names(cond_taxa) <- taxa_names(data_fungi) test_that("subset_taxa_pq works fine", { expect_s4_class(subset_taxa_pq(data_fungi, data_fungi@tax_table[, "Phylum"] == "Ascomycota"), "phyloseq") + skip_on_cran() expect_equal(ntaxa(subset_taxa_pq(data_fungi, data_fungi@tax_table[, "Phylum"] == "Ascomycota")), 1066) expect_s4_class(subset_taxa_pq(data_fungi, cond_taxa), "phyloseq") expect_equal(ntaxa(subset_taxa_pq(data_fungi, cond_taxa)), 128) @@ -14,6 +15,7 @@ test_that("subset_taxa_pq works fine", { cond_samp <- grepl("A1", data_fungi@sam_data[["Sample_names"]]) test_that("subset_samples_pq works fine", { expect_s4_class(subset_samples_pq(data_fungi, data_fungi@sam_data[["Height"]] == "Low"), "phyloseq") + skip_on_cran() expect_s4_class(subset_samples_pq(data_fungi, cond_samp), "phyloseq") expect_error(subset_samples_pq(data_fungi, data_fungi@tax_table[, "Phylum"] == "Ascomycota")) data_fungi2 <- data_fungi diff --git a/tests/testthat/test_table_functions.R b/tests/testthat/test_table_functions.R index 7d802e03..61484635 100644 --- a/tests/testthat/test_table_functions.R +++ b/tests/testthat/test_table_functions.R @@ -4,6 +4,7 @@ data(enterotype) test_that("tax_datatable function works fine with data_fungi dataset", { skip_on_os("windows") expect_silent(taxdt <- tax_datatable(data_fungi)) + skip_on_cran() expect_s3_class(taxdt, "datatables") expect_silent(taxdt <- tax_datatable(data_fungi, taxonomic_level = 1:2)) expect_s3_class(taxdt, "datatables") @@ -15,6 +16,7 @@ test_that("tax_datatable function works fine with data_fungi dataset", { test_that("tax_datatable function works fine with enterotype dataset", { skip_on_os("windows") expect_silent(tax_datatable(enterotype)) + skip_on_cran() expect_s3_class(tax_datatable(enterotype), "datatables") expect_silent(tax_datatable(enterotype, modality = enterotype@sam_data$SeqTech)) expect_s3_class(tax_datatable(enterotype, modality = enterotype@sam_data$SeqTech), "datatables") @@ -27,6 +29,7 @@ data_fungi_low_high_withNA@sam_data[["Height"]][1] <- NA test_that("compare_pairs_pq function works fine with data_fungi dataset", { expect_s3_class(compare_pairs_pq(data_fungi_low_high, bifactor = "Height", merge_sample_by = "Height"), "tbl_df") + skip_on_cran() expect_message(expect_message(compare_pairs_pq(data_fungi_low_high_withNA, bifactor = "Height", merge_sample_by = "Height"))) expect_equal(dim(compare_pairs_pq(data_fungi_low_high, bifactor = "Height", merge_sample_by = "Height")), c(1, 13)) expect_s3_class(compare_pairs_pq(data_fungi_low_high, bifactor = "Height", merge_sample_by = "Height", nb_min_seq = 2), "tbl_df") @@ -37,6 +40,7 @@ test_that("compare_pairs_pq function works fine with data_fungi dataset", { test_that("tbl_sum_samdata function works fine with data_fungi and enterotype dataset", { expect_s3_class(tbl_sum_samdata(enterotype), "tbl_summary") + skip_on_cran() expect_s3_class(tbl_sum_samdata(data_fungi), "tbl_summary") expect_s3_class(tbl_sum_samdata(data_fungi, remove_col_unique_value = FALSE), "tbl_summary") expect_s3_class(tbl_sum_samdata(data_fungi, diff --git a/tests/testthat/test_tuckey.R b/tests/testthat/test_tuckey.R index fd6ab12f..02d8499a 100644 --- a/tests/testthat/test_tuckey.R +++ b/tests/testthat/test_tuckey.R @@ -3,6 +3,7 @@ GlobalPatterns@sam_data[, "Soil_logical"] <- ifelse(GlobalPatterns@sam_data[, "SampleType"] == "Soil", "Soil", "Not Soil") test_that("hill_tuckey_pq function works fine with GlobalPatterns dataset", { expect_silent(suppressMessages(hill_tuckey_pq(GlobalPatterns, "Soil_logical"))) + skip_on_cran() expect_silent(suppressMessages(hill_tuckey_pq(GlobalPatterns, "SampleType"))) expect_message(hill_tuckey_pq(GlobalPatterns, "SampleType", silent = FALSE)) expect_s3_class(hill_tuckey_pq(GlobalPatterns, "SampleType"), "ggplot") @@ -13,6 +14,7 @@ test_that("hill_tuckey_pq function works fine with GlobalPatterns dataset", { data("enterotype") test_that("hill_tuckey_pq function works fine with enterotype dataset", { expect_silent(hill_tuckey_pq(enterotype, "Nationality")) + skip_on_cran() expect_message(hill_tuckey_pq(enterotype, "Nationality", silent = FALSE)) expect_s3_class(hill_tuckey_pq(enterotype, "Nationality"), "ggplot") expect_error(hill_tuckey_pq(enterotype, "NAtionnality")) @@ -21,6 +23,7 @@ test_that("hill_tuckey_pq function works fine with enterotype dataset", { data("data_fungi") test_that("hill_tuckey_pq function works fine with data_fungi dataset", { expect_silent(hill_tuckey_pq(data_fungi, "Time")) + skip_on_cran() expect_message(hill_tuckey_pq(data_fungi, "Time", silent = FALSE)) expect_s3_class(hill_tuckey_pq(data_fungi, "Time"), "ggplot") expect_error(hill_tuckey_pq(data_fungi, "Timmes")) From 214bb72522f099f0e70c6a55ddb2465b7cb2c4f9 Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Tue, 13 Feb 2024 07:06:51 +0100 Subject: [PATCH 7/8] fix --- R/dada_phyloseq.R | 8 +++----- R/plot_functions.R | 2 +- R/vsearch.R | 9 ++++----- man/cutadapt_remove_primers.Rd | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/R/dada_phyloseq.R b/R/dada_phyloseq.R index 2b1b5cdf..99da0395 100644 --- a/R/dada_phyloseq.R +++ b/R/dada_phyloseq.R @@ -913,10 +913,8 @@ save_pq <- function(physeq, path = NULL, ...) { #' @export #' #' @examples -#' \dontrun{ -#' read_pq(path = "phyloseq_data") -#' read_pq(path = "phyloseq_data", taxa_are_rows = TRUE) -#' } +#' # read_pq(path = "phyloseq_folder") +#' # read_pq(path = "phyloseq_folder", taxa_are_rows = TRUE) #' read_pq <- function(path = NULL, taxa_are_rows = FALSE, @@ -2341,7 +2339,7 @@ physeq_or_string_to_dna <- function(physeq = NULL, #' ) #' #' -#' unlink(tempdir(), recursive = TRUE) +#' # unlink(tempdir(), recursive = TRUE) #' } #' @details #' This function is mainly a wrapper of the work of others. diff --git a/R/plot_functions.R b/R/plot_functions.R index 27c6bd35..b239829b 100644 --- a/R/plot_functions.R +++ b/R/plot_functions.R @@ -2697,7 +2697,7 @@ SRS_curve_pq <- function(physeq, clean_pq = FALSE, ...) { #' ) #' GPsubset <- subset_taxa( #' GPsubset, -#' rowSums(GPsubset@otu_table) > 1000 +#' rowSums(GPsubset@otu_table) > 20000 #' ) #' GPsubset <- subset_taxa( #' GPsubset, diff --git a/R/vsearch.R b/R/vsearch.R index 7a9016c1..47e51478 100644 --- a/R/vsearch.R +++ b/R/vsearch.R @@ -16,11 +16,10 @@ #' - temp.fasta (refseq in fasta) #' - cluster.fasta (centroid) #' - temp.uc (clusters) -#' @examples -#' \dontrun{ +#' @examplesIf MiscMetabar:::is_vsearch_installed() +#' \donttest{ #' file_dna <- tempfile("dna.fa") -#' seqinr::write.fasta("GCCCATTAGTATTCTAGTGGGCATGCCTGTTCGAGCGTCATTTTCA -#' ACCCTCAAGCCCCTTATTGCTTGGTGTTGGGAGTTTAGCTGGCTTTATAGCGGTTAACTCCCTAAATATACTGGCG", +#' seqinr::write.fasta("GCCCATTAGTATTCTAGTGGGCATGCCTGTTCGAGCGTCATTTTCAACCCTCAAGCCCCTTATTGCTTGGTGTTGGGAGTTTAGCTGGCTTTATAGCGGTTAACTCCCTAAATATACTGGCG", nbchar = 200, #' file = file_dna, names = "seq1" #' ) #' @@ -58,7 +57,7 @@ vs_search_global <- function(physeq, } if (!is.null(seq2search)) { if (inherits(seq2search, "character")) { - seq2search <- Biostrings::DNAStringSet(seq2search) + seq2search <- Biostrings::readDNAStringSet(seq2search) } Biostrings::writeXStringSet(seq2search, paste0(tempdir(), "seq2search.fasta")) seq2search <- paste0(tempdir(), "seq2search.fasta") diff --git a/man/cutadapt_remove_primers.Rd b/man/cutadapt_remove_primers.Rd index dc5a10ef..c89ed56f 100644 --- a/man/cutadapt_remove_primers.Rd +++ b/man/cutadapt_remove_primers.Rd @@ -91,7 +91,7 @@ cutadapt_remove_primers( ) -unlink(tempdir(), recursive = TRUE) +# unlink(tempdir(), recursive = TRUE) } \dontshow{\}) # examplesIf} } From 59ecb78760567df457a3c86ca9d1768e1918c431 Mon Sep 17 00:00:00 2001 From: Adrien Taudiere Date: Tue, 13 Feb 2024 07:09:02 +0100 Subject: [PATCH 8/8] Fix a bug in vsearch_global_pq example --- R/vsearch.R | 5 +++-- man/iNEXT_pq.Rd | 2 +- man/read_pq.Rd | 6 ++---- man/vs_search_global.Rd | 8 +++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/R/vsearch.R b/R/vsearch.R index 47e51478..04656c1e 100644 --- a/R/vsearch.R +++ b/R/vsearch.R @@ -16,10 +16,11 @@ #' - temp.fasta (refseq in fasta) #' - cluster.fasta (centroid) #' - temp.uc (clusters) -#' @examplesIf MiscMetabar:::is_vsearch_installed() +#' @examplesIf MiscMetabar:::is_vsearch_installed() #' \donttest{ #' file_dna <- tempfile("dna.fa") -#' seqinr::write.fasta("GCCCATTAGTATTCTAGTGGGCATGCCTGTTCGAGCGTCATTTTCAACCCTCAAGCCCCTTATTGCTTGGTGTTGGGAGTTTAGCTGGCTTTATAGCGGTTAACTCCCTAAATATACTGGCG", nbchar = 200, +#' seqinr::write.fasta("GCCCATTAGTATTCTAGTGGGCATGCCTGTTCGAGCGTCATTTTCAACCCTCAAGCCCCTTATTGCTTGGTGTTGGGAGTTTAGCTGGCTTTATAGCGGTTAACTCCCTAAATATACTGGCG", +#' nbchar = 200, #' file = file_dna, names = "seq1" #' ) #' diff --git a/man/iNEXT_pq.Rd b/man/iNEXT_pq.Rd index a4f02ae0..f32d7a81 100644 --- a/man/iNEXT_pq.Rd +++ b/man/iNEXT_pq.Rd @@ -33,7 +33,7 @@ GPsubset <- subset_taxa( ) GPsubset <- subset_taxa( GPsubset, - rowSums(GPsubset@otu_table) > 1000 + rowSums(GPsubset@otu_table) > 20000 ) GPsubset <- subset_taxa( GPsubset, diff --git a/man/read_pq.Rd b/man/read_pq.Rd index e11c0590..6373a198 100644 --- a/man/read_pq.Rd +++ b/man/read_pq.Rd @@ -35,9 +35,7 @@ and if present a phy_tree in Newick format. At least the otu_table.csv need to b \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#maturing}{\figure{lifecycle-maturing.svg}{options: alt='[Maturing]'}}}{\strong{[Maturing]}} } \examples{ -\dontrun{ -read_pq(path = "phyloseq_data") -read_pq(path = "phyloseq_data", taxa_are_rows = TRUE) -} +# read_pq(path = "phyloseq_folder") +# read_pq(path = "phyloseq_folder", taxa_are_rows = TRUE) } diff --git a/man/vs_search_global.Rd b/man/vs_search_global.Rd index fc953f83..084a5b30 100644 --- a/man/vs_search_global.Rd +++ b/man/vs_search_global.Rd @@ -49,10 +49,11 @@ This function is mainly a wrapper of the work of others. Please cite \href{https://github.com/torognes/vsearch}{vsearch}. } \examples{ -\dontrun{ +\dontshow{if (MiscMetabar:::is_vsearch_installed()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\donttest{ file_dna <- tempfile("dna.fa") -seqinr::write.fasta("GCCCATTAGTATTCTAGTGGGCATGCCTGTTCGAGCGTCATTTTCA - ACCCTCAAGCCCCTTATTGCTTGGTGTTGGGAGTTTAGCTGGCTTTATAGCGGTTAACTCCCTAAATATACTGGCG", +seqinr::write.fasta("GCCCATTAGTATTCTAGTGGGCATGCCTGTTCGAGCGTCATTTTCAACCCTCAAGCCCCTTATTGCTTGGTGTTGGGAGTTTAGCTGGCTTTATAGCGGTTAACTCCCTAAATATACTGGCG", + nbchar = 200, file = file_dna, names = "seq1" ) @@ -63,6 +64,7 @@ res[res$identity != "*", ] clean_pq(subset_taxa(data_fungi, res$identity != "*")) } +\dontshow{\}) # examplesIf} } \author{ Adrien Taudière