Skip to content

Commit

Permalink
Fix vignettes and add pkgdown GA
Browse files Browse the repository at this point in the history
  • Loading branch information
sdgamboa committed May 24, 2024
1 parent f3ca871 commit c85373d
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 36 deletions.
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
47 changes: 47 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Copied this workflow from: https://github.com/waldronlab/bugphyzz/blob/main/.github/workflows/pkgdown.yaml
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
container: bioconductor/bioconductor_docker:RELEASE_3_19
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install apt dependencies
run: |
sudo apt-get update && sudo apt-get install -y rsync
- name: Install R dependencies
run: |
remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories())
install.packages("pkgdown", dependencies = TRUE)
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
clean: false
folder: docs
3 changes: 0 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
url: http://waldronlab.io/MicrobiomeBenchmarkDataAnalyses/
template:
bootstrap: 5

56 changes: 29 additions & 27 deletions vignettes/articles/HMP_2012_WMS_gingival.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,40 @@ ps
Select methods for DA:

```{r, message=FALSE, warning=FALSE}
# ps <- runNormalizations(set_norm_list(), ps, verbose = FALSE)
# zw <- weights_ZINB(ps, design = conditions_col)
# DA_methods <- set_DA_methods_list(conditions_col, conditions)
#
# for (i in seq_along(DA_methods)) {
# if (grepl("Seurat", names(DA_methods)[i])) {
# names(DA_methods[[i]]$contrast) <- NULL
# } else {
# next
# }
# }
# names(DA_methods)
```



# Run DA

```{r, message=FALSE, warning=FALSE}
## DA_output <- run_DA(ps, conditions_col, conditions)
ps <- runNormalizations(set_norm_list(), ps, verbose = FALSE)
zw <- weights_ZINB(ps, design = conditions_col)
DA_methods <- set_DA_methods_list(conditions_col, conditions)
for (i in seq_along(DA_methods)) {
if (grepl("Seurat", names(DA_methods)[i])) {
names(DA_methods[[i]]$contrast) <- NULL
} else {
next
}
}
# These methods throw an error, so they must be removed
DA_methods <- DA_methods[!names(DA_methods) == 'DA_ALDEx2.1']
DA_methods <- DA_methods[!names(DA_methods) == 'DA_corncob.1']
# DA_methods <- DA_methods[!names(DA_methods) == 'DA_ALDEx2.1']
# DA_methods <- DA_methods[!names(DA_methods) == 'DA_corncob.1']
DA_methods <- DA_methods[!names(DA_methods) == 'DA_edgeR.1']
names(DA_methods)
```

# run methods
DA_output <- runDA(DA_methods, ps, weights = zw, verbose = FALSE)
```{r, warning=FALSE, message=TRU}
tim <- system.time({
DA_output <- vector("list", length(DA_methods))
for (i in seq_along(DA_output)) {
message(
"Running method ", i, ": ", names(DA_methods)[i], " - ", Sys.time()
)
DA_output[[i]] <- tryCatch(
error = function(e) NULL,
runDA(DA_methods[i], ps, weights = zw, verbose = FALSE)
)
}
DA_output <- purrr::list_flatten(DA_output, name_spec = "{inner}")
DA_output <- purrr::discard(DA_output, is.null)
})
tim
```

# Enrichment
Expand Down Expand Up @@ -159,7 +163,7 @@ positives <- createPositives(

## Plot TP - FP

```{r, fig.height = 6, fig.width=10}
```{r, fig.height = 10, fig.width=15}
positive_plots <- plot_positives(positives)
grid.arrange(grobs = positive_plots, ncol = 3)
```
Expand All @@ -169,5 +173,3 @@ grid.arrange(grobs = positive_plots, ncol = 3)
```{r session info}
sessionInfo()
```


55 changes: 49 additions & 6 deletions vignettes/articles/Ravel_2011_16S_BV.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,61 @@ methods added to the original workflow and modified plots.

## Run differential abundance analysis


DA analysis:

```{r run DA benchdamic, message=FALSE, warning=FALSE}
```{r}
ps <- runNormalizations(set_norm_list(), ps, verbose = FALSE)
zw <- weights_ZINB(ps, design = conditions_col)
DA_methods <- set_DA_methods_list(conditions_col, conditions)
for (i in seq_along(DA_methods)) {
if (grepl("Seurat", names(DA_methods)[i])) {
names(DA_methods[[i]]$contrast) <- NULL
} else {
next
}
}
# These methods throw an error, so they must be removed
# DA_methods <- DA_methods[!names(DA_methods) == 'DA_ALDEx2.1']
# DA_methods <- DA_methods[!names(DA_methods) == 'DA_corncob.1']
# DA_methods <- DA_methods[!names(DA_methods) == 'DA_edgeR.1']
names(DA_methods)
```



```{r, warning=FALSE, message=TRUE}
tim <- system.time({
DA_output <- vector("list", length(DA_methods))
for (i in seq_along(DA_output)) {
message(
"Running method ", i, ": ", names(DA_methods)[i], " - ", Sys.time()
)
DA_output[[i]] <- tryCatch(
error = function(e) NULL,
runDA(DA_methods[i], ps, weights = zw, verbose = FALSE)
)
}
DA_output <- purrr::list_flatten(DA_output, name_spec = "{inner}")
DA_output <- purrr::discard(DA_output, is.null)
})
tim
```



```{r run DA benchdamic, message=FALSE, warning=FALSE}
# ps <- runNormalizations(set_norm_list(), ps, verbose = FALSE)
# zw <- weights_ZINB(ps, design = conditions_col)
# DA_methods <- set_DA_methods_list(conditions_col, conditions)
## These methods throw an error, so they must be removed
DA_methods <- DA_methods[!names(DA_methods) == 'DA_ALDEx2.1']
DA_methods <- DA_methods[!names(DA_methods) == 'DA_corncob.1']
# DA_methods <- DA_methods[!names(DA_methods) == 'DA_ALDEx2.1']
# DA_methods <- DA_methods[!names(DA_methods) == 'DA_corncob.1']
## run methods
DA_output <- runDA(DA_methods, ps, weights = zw, verbose = FALSE)
# DA_output <- runDA(DA_methods, ps, weights = zw, verbose = FALSE)
```

# Enrichment
Expand Down Expand Up @@ -179,7 +221,7 @@ positives <- createPositives(

Create putative positives plot

```{r plot positves, fig.width=10, fig.height=6}
```{r plot positves, fig.width=15, fig.height=10}
plots <- plot_positives(positives)
grid.arrange(grobs = plots, ncol = 3)
```
Expand All @@ -205,7 +247,8 @@ assay(tse_genus, 'TSS + CLR') <- apply(assay(tse_genus, 'TSS'), 2, function(x) {
# log(x / exp(mean(log(x))))
})
data <- tidySummarizedExperiment::as_tibble(tse_genus) |>
data <- tse_genus |>
as_tibble() |>
rename(taxon_name = .feature, sample = .sample) |>
mutate(
taxon_annotation = ifelse(
Expand Down

0 comments on commit c85373d

Please sign in to comment.