Skip to content

Commit ff1efe0

Browse files
committed
updated dockerfile, added details section
1 parent 870cee5 commit ff1efe0

18 files changed

Lines changed: 63 additions & 56 deletions

R/bray.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#'
33
#' @description
44
#' Calculates the Bray-Curtis dissimilarity of a \link[Matrix]{sparseMatrix} pairwise for each column.
5+
#'
6+
#' @details
57
#' The Bray-Curtis dissimilarity between two samples \eqn{A} and \eqn{B}, each of length \eqn{n}, is defined as:
68
#'
79
#' \eqn{d(A,B) = \frac{\sum_{i}^n |A_i - B_i|}{\sum_{i}^n (A_i + B_i)}}

R/canberra.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#'
33
#' @description
44
#' Calculates the Canberra dissimilarity of a \link[Matrix]{sparseMatrix} pairwise for each column.
5+
#'
6+
#' @details
57
#' The Canberra dissimilarity between two samples \eqn{A} and \eqn{B}, each of length \eqn{n}, is defined as:
68
#'
79
#' \eqn{d(A,B) = \frac{1 / NZ} \sum_{i}^n \frac{|A_i - B_i|}{|A_i| + |B_i|}}

R/cosine.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#'
33
#' @description
44
#' Calculates the cosine disimilarity of a \link[Matrix]{sparseMatrix} pairwise for each column.
5+
#'
6+
#' @details
57
#' The cosine dissimilarity between two samples \eqn{A} and \eqn{B}, each of length \eqn{n}, is defined as:
68
#'
79
#' \eqn{d(A,B) = 1 - \frac{\sum_{i}^n A_i B_i}{\sqrt{\sum_{i}^n A_i^2} \sqrt{\sum_{i}^n B_i^2}} }

R/jaccard.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#'
33
#' @description
44
#' Calculates the Jaccard dissimilarity of a \link[Matrix]{sparseMatrix} pairwise for each column.
5+
#'
6+
#' @details
57
#' The weighted Jaccard disimilarity between two samples \eqn{A} and \eqn{B}, each of length \eqn{n}, is defined as:
68
#'
79
#' \eqn{d(A,B) = 1 - \frac{ \sum_{i}^{n} \min(A_i, B_i) }{ \sum_{i}^{n} \max(A_i, B_i) }}

R/jsd.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
#'
33
#' @description
44
#' Calculates the Jensen-Shannon divergence of a \link[Matrix]{sparseMatrix} pairwise for each column.
5+
#'
6+
#' @details
57
#' The Jensen-Shannon divergence between two probability distributions \eqn{A} and \eqn{B}, each of length \eqn{n}, is defined as:
68
#'
79
#' \eqn{ d(A, B) = \frac{1}{2} D_{KL}(A \parallel M) + \frac{1}{2} D_{KL}(B \parallel M) }
810
#'
911
#' where \eqn{M = \frac{1}{2} (A + B)} is the mixture distribution,
1012
#' and \eqn{D_{KL}} is the Kullback-Leibler divergence.
11-
#' When weighted is set to FALSE, counts are changed to relative abundances.
13+
#' When weighted is set to FALSE, counts are replaced by presence/absence data.
1214
#'
1315
#' @param x A \link[Matrix]{sparseMatrix}.
1416
#' @param weighted A boolean value, to use counts or relative abundances (default: TRUE).

R/manhattan.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#'
33
#' @description
44
#' Calculates the Manhattan dissimilarity of a \link[Matrix]{sparseMatrix} pairwise for each column.
5+
#'
6+
#' @details
57
#' The Manhattan dissimilarity between two samples \eqn{A} and \eqn{B}, each of length \eqn{n}, is defined as:
68
#'
79
#' \eqn{d(A, B) = \sum_{i}^n |A_i - B_i|}

R/omics-class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ omics <- R6::R6Class(
841841
#'
842842
#' obj$feature_subset(Kingdom == "Bacteria")
843843
#' dist <- obj$distance(metric = "bray")
844-
#' @seealso \link{ordination_plot}, \link{plot_pairwise_stats}, \link{pairwise_anosim}, \link{pairwise_adonis}
844+
#' @seealso \link{bray}, \link{canberra}, \link{cosine}, \link{jaccard}, \link{jsd}, \link{manhattan}, \link{unifrac}
845845
distance = function(metric, normalized = TRUE, weighted = TRUE, threads = 1) {
846846

847847
## Error handling

R/unifrac.R

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
#' Compute UniFrac Dissimilarity from a Sparse Matrix.
22
#'
33
#' @description Calculates the UniFrac dissimilarity between samples based on phylogenetic branch lengths and abundance or presence/absence data.
4-
#' The UniFrac distance between two samples \eqn{A} and \eqn{B}, with phylogenetic tree edges \eqn{i = 1 \ldots n} of lengths \eqn{L_i}, is computed differently depending on the \code{weighted} and \code{normalized} flags:
5-
#' Weighted UniFrac:
6-
#' \eqn{d(A,B) = \frac{\sum_{i}^n L_i |A_i - B_i|}{\sum_{i}^n L_i (A_i + B_i)}}
7-
#' Normalized Weighted UniFrac:
8-
#' \eqn{d(A,B) = \sum_{i}^n L_i |A_i - B_i|}
9-
#' where \eqn{A_i} and \eqn{B_i} are the abundance weights for branch \eqn{i} computed by propagating tip abundances to internal nodes.
10-
#'
11-
#' Unweighted UniFrac (always normalized):
12-
#' \eqn{d(A,B) = \frac{\sum_{i}^n L_i |A'_i - B'_i|}{\sum_{i}^n L_i \max(A'_i, B'_i)}}
13-
#'
14-
#' where \eqn{A'_i} and \eqn{B'_i} are binary indicators (presence/absence) on branches \eqn{i}, derived by propagating tip presence to internal nodes.
15-
#' When \code{weighted = FALSE}, input counts are first converted to presence/absence before distance computation.
16-
#'
4+
#'
5+
#' @details
6+
#' The UniFrac distance between two samples \eqn{A} and \eqn{B}, with phylogenetic tree edges \eqn{i = 1 \ldots n} of lengths \eqn{L_i}, is computed differently depending on the \code{weighted} and \code{normalized} flags.
7+
#' When \code{weighted = FALSE}, input counts are first converted to presence/absence data.
8+
#' \describe{
9+
#' \item{Weighted UniFrac (\code{normalized = FALSE} and \code{weighted = TRUE}):}{
10+
#' \eqn{d(A,B) = \frac{\sum_{i}^n L_i |A_i - B_i|}{\sum_{i}^n L_i (A_i + B_i)}}
11+
#' }
12+
#' \item{Normalized Weighted UniFrac (\code{normalized = TRUE} and \code{weighted = TRUE}):}{
13+
#' \eqn{d(A,B) = \sum_{i}^n L_i |A_i - B_i|}
14+
#' }
15+
#' \item{Unweighted UniFrac (\code{weighted = FALSE}, unweighted is always normalized):}{
16+
#' \eqn{d(A,B) = \frac{\sum_{i}^n L_i |A_i - B_i|}{\sum_{i}^n L_i \max(A_i, B_i)}}
17+
#' }
18+
#'}
1719
#' @param x A \link[Matrix]{sparseMatrix} of strictly positive counts or presence/absence data.
1820
#' @param tree A `phylo` class tree.
1921
#' @param weighted Logical indicating whether to compute weighted (abundance) or unweighted (presence/absence) UniFrac (default: TRUE).
2022
#' @param normalized Logical indicating whether to normalize weighted UniFrac distances to be between 0 and 1 (default: TRUE). Unweighted UniFrac is always normalized.
2123
#' @param threads Integer number of threads to use for parallel computation (default: 1).
2224
#' @return A symmetric matrix of pairwise UniFrac distances between columns of \code{x}.
2325
#' @references
24-
#' Lozupone, C., Hamady, M., Kelley, S. T., & Knight, R. (2007). Quantitative and qualitative beta diversity measures lead to different insights into factors that structure microbial communities. Applied and Environmental Microbiology, 73(5), 1576–1585.
25-
#'
2626
#' Lozupone, C., & Knight, R. (2005). UniFrac: a new phylogenetic method for comparing microbial communities. Applied and Environmental Microbiology, 71(12), 8228–8235.
27-
#'
28-
#' Lozupone, C., & Knight, R. (2008). Species divergence and the measurement of microbial diversity. FEMS Microbiology Reviews, 32(4), 557–578.
29-
#'
3027
#' @examples
3128
#' library("OmicFlow")
3229
#'

README.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,5 @@ res <- taxa$DFE(
162162
res$volcano_plot
163163
```
164164

165-
### Run autoflow via docker 🐳
166-
For additional options please run `autoflow -h`
167-
```bash
168-
docker pull agusinac/autoflow:1.3.2
169-
170-
docker run -it --rm -v \
171-
"$(pwd)":/data \ # Mount the data in a temporary directory
172-
-w /data \ # set working directory
173-
-u $(id -u):$(id -g) \ # non-root user
174-
agusinac/autoflow:1.3.2 \
175-
autoflow \ # autoflow R script
176-
-b /data/biom_with_taxonomy_hdf5.biom \
177-
-m /data/metadata.tsv
178-
```
179-
180165
## Support
181-
If you are having issues, please [create a ticket](https://github.com/agusinac/OmicFlow/issues)
166+
If you are having issues, please [create a ticket](https://github.com/agusinac/OmicFlow/issues)

docker/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#------------------------------------------------------------------------------------#
22
#
3-
# Created by Alem Gusinac, last modified at 16-10-2025
3+
# Created by Alem Gusinac, last modified at 24-10-2025
44
#
55
# It builds on top of a slim ubuntu (70MB) base
66
#
@@ -53,6 +53,10 @@ RUN echo "deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/" >> /et
5353
RUN apt-get update && apt-get upgrade -y && apt-get clean
5454
RUN apt-get update && apt-get install -y r-base
5555

56+
# Install ggplot2 3.5.2 explicitly before other packages
57+
RUN R -e "install.packages('remotes', repos='https://cloud.r-project.org')"
58+
RUN R -e "remotes::install_version('ggplot2', version='3.5.2', repos='https://cloud.r-project.org')"
59+
5660
# Copy requirements
5761
COPY install2.r .
5862
COPY installBioc.r .
@@ -62,11 +66,9 @@ RUN R -e "install.packages('docopt', dependencies=TRUE)"
6266

6367
# Essential R dependencies
6468
RUN Rscript install2.r --error --skipinstalled \
65-
remotes \
6669
pak \
6770
BiocManager \
6871
b64 \
69-
ggplot2 \
7072
cli \
7173
DT \
7274
downloadthis \
@@ -95,4 +97,4 @@ ARG USER_GID=$USER_UID
9597

9698
# Create the user
9799
RUN groupadd --gid $USER_GID $USERNAME \
98-
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
100+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME

0 commit comments

Comments
 (0)