Skip to content

Commit

Permalink
Cleaning before v 0.51
Browse files Browse the repository at this point in the history
  • Loading branch information
adrientaudiere committed Dec 11, 2023
1 parent c8655f7 commit fcca992
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 23 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Suggests:
testthat (>= 3.0.0),
tibble,
tidyr,
tidytree,
treeio,
treemapify,
utils,
Expand Down
2 changes: 1 addition & 1 deletion R/controls.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ search_exact_seq_pq <- function(physeq, sequences) {
for (i in seq_along(sequences)) {
original <- sequences[[i]]
rev <- reverse(sequences[[i]])
rev_comp <- Biostrings::reverseComplement(sequences[[i]])
rev_comp <- Biostrings::reverseComplement(sequences[[i]])
comp <- complement(sequences[[i]])

original_count <- sum(grepl(original, physeq@refseq))
Expand Down
4 changes: 4 additions & 0 deletions R/dada_phyloseq.R
Original file line number Diff line number Diff line change
Expand Up @@ -1784,13 +1784,15 @@ tbl_sum_samdata <- function(physeq, remove_col_unique_value = TRUE, ...) {
#' @author Adrien Taudière
#' @examples
#' df <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 5000)
#' \dontrun{
#' df <- add_funguild_info(df,
#' taxLevels = c(
#' "Domain", "Phylum", "Class", "Order",
#' "Family", "Genus", "Species"
#' )
#' )
#' sort(table(df@tax_table[, "guild"]), decreasing = TRUE)
#' }
#' @details
#' This function is mainly a wrapper of the work of others.
#' Please make a reference to `FUNGuildR::funguild_assign()` if you
Expand Down Expand Up @@ -1846,6 +1848,7 @@ add_funguild_info <- function(physeq,
#' @export
#' @author Adrien Taudière
#' @examples
#' \dontrun{
#' df <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 5000)
#' df <- add_funguild_info(df,
#' taxLevels = c(
Expand All @@ -1863,6 +1866,7 @@ add_funguild_info <- function(physeq,
#' levels_order = p$data$Guild[order(p$data$nb_seq)]
#' ) +
#' ylab("") + theme(axis.text.y = element_blank()))
#' }
#' @seealso [add_funguild_info()]

plot_guild_pq <-
Expand Down
Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.
7 changes: 4 additions & 3 deletions tests/testthat/test_tuckey.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
data("GlobalPatterns", package = "phyloseq")
GlobalPatterns@sam_data[, "Soil_logical"] <- ifelse(GlobalPatterns@sam_data[, "SampleType"] == "Soil", "Soil", "Not Soil")
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(hill_tuckey_pq(GlobalPatterns, "Soil_logical"))
expect_silent(hill_tuckey_pq(GlobalPatterns, "SampleType"))
expect_silent(suppressMessages(hill_tuckey_pq(GlobalPatterns, "Soil_logical")))
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")
expect_error(hill_tuckey_pq(GlobalPatterns, "SampleTYPE"))
Expand Down
11 changes: 10 additions & 1 deletion vignettes/MiscMetabar.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ vignette: >
%\VignetteEncoding{UTF-8}
---


```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE
)
```

# Introduction to MiscMetabar : an R packages to facilitate visualization and reproducibility in metabarcoding analysis

## Raison d'être
Expand All @@ -26,7 +35,7 @@ For developers, I also have a vignette describing som [rules of codes](https://a

### Summarize a physeq object

```{r example, message=FALSE}
```{r example}
library("MiscMetabar")
library("phyloseq")
library("magrittr")
Expand Down
10 changes: 6 additions & 4 deletions vignettes/Reclustering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ bibliography: bibliography.bib
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
message = FALSE
)
```

```{r setup, message=FALSE}

```{r setup}
library(MiscMetabar)
```

Expand Down Expand Up @@ -48,7 +50,7 @@ summary_plot_pq(otu)

Another post-clustering transformation method is implemented in `lulu_pq()`, which uses @froslev2017's method for curation of DNA amplicon data. The aim is more to clean non-biological information than to make explicitly less clusters.

```{r, message=FALSE, results="hide"}
```{r, results="hide"}
library("lulu")
data(data_fungi_sp_known)
lulu_res <- lulu_pq(data_fungi_sp_known)
Expand All @@ -70,4 +72,4 @@ track_wkflow(list(
))
```

# References
# References
3 changes: 2 additions & 1 deletion vignettes/alpha-div.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ editor_options:
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
message = FALSE
)
```

Expand Down
4 changes: 3 additions & 1 deletion vignettes/beta-div.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ vignette: >
%\VignetteEncoding{UTF-8}
---


```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
message = FALSE
)
```

Expand Down
7 changes: 7 additions & 0 deletions vignettes/bibliography.bib
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,13 @@ @article{smith2019
journal = {Journal of Open Source Software}
}

@manual{smith2023,
title = {phylosmith: Functions to help analyze data as phyloseq objects},
author = {Schuyler Smith},
year = {2023},
note = {R package version 1.0.7},
url = {https://schuyler-smith.github.io/phylosmith/}
}
@misc{taberlet2012,
doi = {10.1002/(issn)2637-4943},
title = {Environmental dna},
Expand Down
3 changes: 2 additions & 1 deletion vignettes/filter.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ vignette: >
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
message = FALSE
)
```

Expand Down
6 changes: 3 additions & 3 deletions vignettes/import_export_track.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ vignette: >
---



```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
message = FALSE
)
```

Expand Down Expand Up @@ -51,4 +51,4 @@ In bioinformatic pipeline, we often need to track the number of samples, sequenc

```{r}
track_wkflow(list(data_fungi, data_fungi_sp_known))
```
```
9 changes: 9 additions & 0 deletions vignettes/tengeler.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ vignette: >
---
This tutorial explore the dataset from Tengeler et al. (2020) available in the `mia` package.


```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE
)
```

# Load library

```{r}
Expand Down
35 changes: 27 additions & 8 deletions vignettes/tree_visualization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,30 @@ vignette: >
bibliography: bibliography.bib
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE,
warning = FALSE,
fig.width = 10,
fig.height = 8
)
quiet <- function(x) {
sink(tempfile())
on.exit(sink())
invisible(force(x))
}
```

```{r}
library("tidytree") # first load to disable warning about phylo class
library("MiscMetabar")
library("phangorn")
df <- subset_taxa_pq(data_fungi, taxa_sums(data_fungi) > 9000)
df_tree <- build_phytree_pq(df, nb_bootstrap = 5)
data_fungi_tree <- merge_phyloseq(df, df_tree$ML$tree)
df_tree <- quiet(build_phytree_pq(df, nb_bootstrap = 5))
data_fungi_tree <- merge_phyloseq(df, phyloseq::phy_tree(df_tree$ML$tree))
```


Expand All @@ -27,17 +45,18 @@ ggdensitree(df_tree$ML_bs, alpha = .3, colour = "steelblue") +
geom_tiplab(size = 3) + hexpand(.35)
ggtree(as.treedata(df_tree$ML)) +
geom_text(aes(x = branch, label = AA_subs, vjust = -.5), size = 1)
tax_tab <- as_tibble(data_fungi_tree@tax_table) |>
dplyr::mutate(.otu = as.character(.otu))
```

```{r}
tax_tab <- as.data.frame(data_fungi_tree@tax_table)
tax_tab <- data.frame("OTU" = rownames(tax_tab), tax_tab)
p <- ggtree(as.treedata(data_fungi_tree@phy_tree)) %<+%
as_tibble(data_fungi_tree@tax_table)
tax_tab
p + geom_tippoint(aes(color = Class, shape = Phylum)) +
geom_text(aes(label = Genus), hjust = -0.2, size = 2)
ggtree(as.treedata(data_fungi_tree@phy_tree), branch.length = "none") %<+%
as_tibble(data_fungi_tree@tax_table) +
tax_tab +
geom_tippoint(aes(color = Class, shape = Phylum), size = 2)
# removeClass("phylo", where = "package:tidytree")
```


0 comments on commit fcca992

Please sign in to comment.