From 988a78c6732402c35532dd85bd3ffd628d1e0fa2 Mon Sep 17 00:00:00 2001 From: Tuomas Borman <60338854+TuomasBorman@users.noreply.github.com> Date: Sun, 21 Jul 2024 18:29:49 +0300 Subject: [PATCH] Build fix: remove R packages not utilized, remove unnecessary files in Docker build (#571) --- .github/workflows/biocbook.yml | 23 ++++--- DESCRIPTION | 69 +++++++++---------- inst/pages/exercises.qmd | 6 +- inst/pages/extra_material.qmd | 2 +- inst/pages/extra_material/24_biclustering.Rmd | 2 +- inst/pages/extra_material/add-comm-typing.Rmd | 2 +- inst/pages/machine_learning.qmd | 23 +++---- inst/pages/visualization.qmd | 4 +- 8 files changed, 61 insertions(+), 70 deletions(-) diff --git a/.github/workflows/biocbook.yml b/.github/workflows/biocbook.yml index 63d5936fc..eead3c9ed 100644 --- a/.github/workflows/biocbook.yml +++ b/.github/workflows/biocbook.yml @@ -15,7 +15,6 @@ jobs: packages: write steps: - - name: ๐Ÿงพ Checkout repository uses: actions/checkout@v3 @@ -26,12 +25,20 @@ jobs: run: | docker system prune --all --force --volumes + - name: ๐Ÿงน Additional disk space cleanup + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/lib/android/sdk + sudo apt-get clean + sudo rm -rf /var/lib/apt/lists/* + - name: ๐Ÿณ Set up QEMU uses: docker/setup-qemu-action@v2 - name: ๐Ÿณ Set up Docker Buildx uses: docker/setup-buildx-action@v2 - + - name: ๐Ÿ“ฆ Cache Docker layers uses: actions/cache@v3 with: @@ -81,7 +88,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} build-args: | BIOC_VERSION=${{ github.ref_name }} - + - name: ๐Ÿš€ Push local Docker image to ghcr.io uses: docker/build-push-action@v4 with: @@ -93,7 +100,7 @@ jobs: build-args: | BIOC_VERSION=${{ github.ref_name }} - - name: ๐Ÿ“š Recover pkg artifacts generated during build in local Docker container (pkg bundle and book) + - name: ๐Ÿ“š Recover pkg artifacts generated during build in local Docker container (pkg bundle and book) env: IMG: ${{ steps.docker.outputs.ImageID }} run: | @@ -110,10 +117,10 @@ jobs: - name: ๐Ÿš€ Deploy book to Github Pages on versioned branch uses: JamesIves/github-pages-deploy-action@v4.4.3 with: - folder: ${{ env.book_path }}/ - target-folder: docs/${{ env.target_folder }}/ + folder: ${{ env.book_path }}/ + target-folder: docs/${{ env.target_folder }}/ branch: gh-pages - clean: false + clean: false - name: ๐Ÿ’พ Upload package bundle artifact uses: actions/upload-artifact@v3 @@ -125,4 +132,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: book - path: ${{ env.book_path }} + path: ${{ env.book_path }} \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index e923abb99..7ffe63013 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,73 +28,71 @@ Depends: R (>= 4.0.0) Imports: Suggests: - ALDEx2, - ANCOMBC, - ape, - biclust, + ALDEx2, + ANCOMBC, + ape, + biclust, BiocBook, BiocManager, BiocParallel, - Biostrings, - bluster, + Biostrings, + bluster, caret, - circlize, + circlize, cluster, - cobiclust, - ComplexHeatmap, + cobiclust, + ComplexHeatmap, corpcor, - cowplot, - curatedMetagenomicData, + curatedMetagenomicData, dada2, - dendextend, + dendextend, devtools, DirichletMultinomial, - dplyr, + dplyr, DT, factoextra, forcats, fido, - ggplot2, + ggplot2, ggpubr, ggtree, - glmnet, - glue, + glmnet, + glue, grid, gsEasy, - gtools, - GUniFrac, - igraph, - kableExtra, - knitr, + igraph, + kableExtra, + knitr, Maaslin2, mia, miaTime, - miaViz, - microbiome, + miaViz, + microbiome, microbiomeDataSets, MicrobiomeStat, - mikropml, - MLeval, + mikropml, MMUPHin, + MOFA2, multiview, NetCoMi, NbClust, + NMF, patchwork, - pheatmap, - phyloseq, - plotly, - purrr, - randomcoloR, + phyloseq, + plotly, + purrr, + qgraph, RColorBrewer, rebook, reshape2, reticulate, rgl, - ROCR, + ROCR, scales, - scater, - sechm, + scater, + sechm, sessioninfo, + shadowtext, SpiecEasi, SPRING, stats, @@ -104,11 +102,6 @@ Suggests: topGO, vegan, WGCNA, - NMF, - qgraph, - MOFA2, - shadowtext, - plotROC, xgboost Remotes: github::microbiome/mia, diff --git a/inst/pages/exercises.qmd b/inst/pages/exercises.qmd index 720dc569d..935f9ab17 100644 --- a/inst/pages/exercises.qmd +++ b/inst/pages/exercises.qmd @@ -1392,8 +1392,6 @@ named `tse`. #| code-summary: "Show solution" library(mia) -library(GUniFrac) - data("peerj13075", package = "mia") tse <- peerj13075 ``` @@ -1484,7 +1482,7 @@ whether the difference of certain taxa was statistically significant. boxplot & jitterplot. Useful functions: wilcox.test, kruskal.test, ggplot2::ggplot, -pheatmap::pheatmap, ComplexHeatMap::Heatmap, ANCOMBC::ancombc2, +ComplexHeatmap::pheatmap, ComplexHeatMap::Heatmap, ANCOMBC::ancombc2, ALDEx2::aldex, Maaslin2::Maaslin2, agglomerateByRank, transformAssay, subsetByPrevalent @@ -1719,7 +1717,7 @@ sample types). ```{r, eval = FALSE} # Load necessary libraries library(SummarizedExperiment) -library(pheatmap) +library(ComplexHeatmap) # Example data creation # Assuming enterotype is a SummarizedExperiment object with sample metadata diff --git a/inst/pages/extra_material.qmd b/inst/pages/extra_material.qmd index 30f69d6ec..b232f0165 100644 --- a/inst/pages/extra_material.qmd +++ b/inst/pages/extra_material.qmd @@ -742,7 +742,7 @@ clusters$classification Next we can plot clusters. Annotated heatmap is a common choice. ```{r cobiclust_3a, fig.width=14, fig.height=12} -library(pheatmap) +library(ComplexHeatmap) # z-transform for heatmap mae[[1]] <- transformAssay( mae[[1]], assay.type = "rclr", MARGIN = "features", method = "z", diff --git a/inst/pages/extra_material/24_biclustering.Rmd b/inst/pages/extra_material/24_biclustering.Rmd index 89919de8a..1334c931d 100644 --- a/inst/pages/extra_material/24_biclustering.Rmd +++ b/inst/pages/extra_material/24_biclustering.Rmd @@ -76,7 +76,7 @@ Next we can plot clusters. Commonly used plot is heatmap with annotations. ```{r cobiclust_3, fig.width=14, fig.height=18} -library(pheatmap) +library(ComplexHeatmap) # standardize-transform for heatmap mae[[1]] <- transformAssay(mae[[1]], assay.type = "rclr", diff --git a/inst/pages/extra_material/add-comm-typing.Rmd b/inst/pages/extra_material/add-comm-typing.Rmd index a1d93fa2c..c49ac7730 100644 --- a/inst/pages/extra_material/add-comm-typing.Rmd +++ b/inst/pages/extra_material/add-comm-typing.Rmd @@ -160,7 +160,7 @@ The community composition can be visualised with a heatmap where one axis repres Here, the CLR + Z-transformed abundances are shown. ```{r, message=FALSE, warning=FALSE} -library(pheatmap) +library(ComplexHeatmap) library(grid) library(RColorBrewer) # Agglomerate to phylum level diff --git a/inst/pages/machine_learning.qmd b/inst/pages/machine_learning.qmd index 3111787ec..6530efb31 100644 --- a/inst/pages/machine_learning.qmd +++ b/inst/pages/machine_learning.qmd @@ -211,21 +211,14 @@ technique for binary classification problems. ```{r} #| label: ROC -library(plotROC) - -# Add observation as binary -res[["obs_binary"]] <- 0 -res[["obs_binary"]][ res[["obs"]] == "healthy" ] <- 1 -roc_plot <- ggplot(res, aes(m = .data[["healthy"]], d = .data[["obs_binary"]])) + - geom_roc(labels = FALSE, n.cuts = 0) + - labs(x = "False Positive Rate", y = "True Positive Rate") -# Add AUC -p <- roc_plot + - geom_rocci(fill="pink", sig.level = 0.05) + - geom_text(aes( - 0.5, 0.5, label = paste0("AUC = ", round(calc_auc(roc_plot)$AUC, 3)) - )) + - theme(legend.position="none") +library(ROCR) + +# Get positive class +pos_class <-levels(res[["obs"]])[[1]] +# Create ROC plot +pred <- prediction(res[[pos_class]], ifelse(res[["obs"]] == pos_class, 1, 0)) +perf <- performance(pred, measure = "tpr", x.measure = "fpr") +p <- plot(perf) p ``` diff --git a/inst/pages/visualization.qmd b/inst/pages/visualization.qmd index d11e03a2c..25abe54f9 100644 --- a/inst/pages/visualization.qmd +++ b/inst/pages/visualization.qmd @@ -31,7 +31,7 @@ includes the following packages: * _patchwork_, _cowplot_, _ggpubr_ and _gridExtra_: plot layouts and multi-panel plotting * _miaViz_: specific visualization tools for `TreeSummaizedExperiment` objects * _scater_: specific visualization tools for `SingleCellExperiment` objects -* _ggplot2_, _pheatmap_, _ggtree_, _sechm_: composition heatmaps +* _ggplot2_, _ComplexHeatmap_, _ggtree_, _sechm_: composition heatmaps * _ANCOMBC_, _ALDEx2_ and _Maaslin2_: visual differential abundance * _fido_: tree-based methods for differential abundance * _plotly_: animated and 3D plotting @@ -51,7 +51,7 @@ library(patchwork) library(miaViz) library(sechm) library(reshape2) -library(pheatmap) +library(ComplexHeatmap) library(ape) library(ggtree) # essential data