Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
4ff0afd
Add C++ code from unifrac's implementation
jepasan Jun 26, 2024
6b2d218
Copy faith-related code into separate files
jepasan Nov 21, 2024
ec38762
Fix code crashing due to out-of-bounds vector access
jepasan Jan 6, 2025
cefd286
C++ code functional for some datasets
jepasan Jan 15, 2025
9f3bb88
Clean up unnecessary files
jepasan Jan 15, 2025
71a9ba5
Simplify source files and code
jepasan Jan 27, 2025
ff0702f
Modify folder structure to fit Rcpp guidelines
jepasan Feb 3, 2025
916560f
Integrate Rcpp and C++ code into the package
jepasan Feb 17, 2025
15d8fa2
Fix the bug that was causing divergent results
jepasan Feb 21, 2025
f62c853
Miscellaneous cleaning up
jepasan Feb 21, 2025
2b4cc75
Update documentation
jepasan Feb 21, 2025
985a873
Add all object files to .gitignore
jepasan Feb 21, 2025
a371637
Rename header files to get rid of warnings
jepasan Feb 21, 2025
5d728ad
Remove old Faith's PD implementation
jepasan Feb 25, 2025
c8ae628
Merge branch 'devel' into fastfaith
antagomir Mar 11, 2025
e61b74f
Update documentation
jepasan Mar 3, 2025
9859945
Merge branch 'fastfaith' of https://github.com/jepasan/mia into fastf…
jepasan Mar 12, 2025
d5d0288
Make C++ documentation internal
jepasan Mar 12, 2025
4036365
Merge branch 'devel' into fastfaith
antagomir Mar 12, 2025
d473c13
Merge branch 'devel' into fastfaith
antagomir Mar 12, 2025
6f3e370
Remove export keyword
jepasan Mar 13, 2025
cb85a3b
Update reference style
jepasan Mar 13, 2025
18a11f0
Merge branch 'fastfaith' of https://github.com/jepasan/mia into fastf…
jepasan Mar 13, 2025
460bf68
Merge branch 'devel' into fastfaith
antagomir Mar 16, 2025
e446c8f
Clean up C++ code
jepasan Mar 17, 2025
76ed7f2
Save re-sorted edges directly to tree
jepasan Mar 17, 2025
43526d9
Modify C++ code to work without colnames
jepasan Mar 17, 2025
de0f800
Merge branch 'fastfaith' of https://github.com/jepasan/mia into fastf…
jepasan Mar 17, 2025
991e3af
Update docs
TuomasBorman Mar 17, 2025
82149ee
Add name to DESCRIPTION
jepasan Mar 17, 2025
e72a839
Merge branch 'fastfaith' of https://github.com/jepasan/mia into fastf…
jepasan Mar 17, 2025
24af810
WIP
jepasan Sep 26, 2025
d3b3fbd
Initialise exporters to raw, qiime and mothur
RiboRings Apr 22, 2026
a519e0e
Minor fix to exporters
RiboRings Apr 22, 2026
b0d11f6
Fix variable types in exporters
RiboRings Apr 23, 2026
902719c
Fixes to exporters
RiboRings Apr 23, 2026
089fee4
Add option to create group file for Mothur export
RiboRings Apr 23, 2026
698fac7
Add group arg for qiime exporter
RiboRings Apr 24, 2026
6574215
Initial version that compiles
jepasan May 4, 2026
8b65f6e
Pass StripeMap by reference to fix crashing
jepasan May 4, 2026
025dcf5
Unweighted now produces accurate results
jepasan May 6, 2026
46e3519
Revome unnecessary copying for speed
jepasan May 6, 2026
8ed15b5
Added method for Weighted Unifrac
jepasan May 20, 2026
baf83cc
Remove unnecessary code blocks
jepasan May 20, 2026
8ba8c12
Clean up formatting
jepasan May 22, 2026
6572ec8
Merge latest
jepasan May 22, 2026
482e65a
Add C++ function to R code
jepasan May 22, 2026
1a9354e
Change weighted from normalized to unnormalized
jepasan May 22, 2026
c444f8f
Add chunked processing for performance
jepasan May 24, 2026
e5eb464
Remove unnecessary exit point
jepasan May 24, 2026
7468ed6
Improve formatting
jepasan May 25, 2026
f2cf6c4
Remove bypass_tips from function parameters
jepasan May 25, 2026
702c243
Update documentation
jepasan May 25, 2026
e8ee485
Turn return object into a distance matrix
jepasan May 25, 2026
dc7b8fe
Turn return object into a distance matrix
jepasan May 25, 2026
e44e288
Merge branch 'fastunifrac' of https://github.com/jepasan/mia into fas…
jepasan May 25, 2026
b7cb638
up
TuomasBorman Jun 12, 2026
345e129
Merge branch 'devel' into fastunifrac
TuomasBorman Jun 12, 2026
e7d5bac
up
TuomasBorman Jun 12, 2026
36104b0
Solve conflicts
RiboRings Jun 18, 2026
d9af452
Merge branch 'devel' into exporters
RiboRings Jun 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ Imports:
MASS,
MatrixGenerics,
methods,
ecodive,
rlang,
S4Vectors,
scater,
Expand All @@ -94,6 +93,7 @@ Suggests:
BiocStyle,
biomformat,
dada2,
ecodive,
knitr,
mediation,
miaTime,
Expand Down
7 changes: 5 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export(estimateDominance)
export(estimateEvenness)
export(estimateFaith)
export(estimateRichness)
export(exportMothur)
export(exportQIIME2)
export(exportRaw)
export(full_join)
export(getAbundanceClass)
export(getAbundant)
Expand Down Expand Up @@ -413,6 +416,8 @@ importFrom(ape,is.binary)
importFrom(ape,is.rooted)
importFrom(ape,read.tree)
importFrom(ape,reorder.phylo)
importFrom(ape,write.FASTA)
importFrom(ape,write.tree)
importFrom(bluster,clusterRows)
importFrom(decontam,isContaminant)
importFrom(decontam,isNotContaminant)
Expand All @@ -430,8 +435,6 @@ importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,sym)
importFrom(dplyr,tally)
importFrom(ecodive,unweighted_unifrac)
importFrom(ecodive,weighted_unifrac)
importFrom(rlang,":=")
importFrom(rlang,sym)
importFrom(scater,calculateMDS)
Expand Down
5 changes: 3 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@ Changes in version 1.19.x
Changes in version 1.21.x
+ Fixed explained percentages on PCA axes for jointRPCA and hardened
rank-deficient SVD handling in joint-RPCA (1.21.1, 2026-05-12)
* Generalise agglomerateByModule to non-binary numerical modules (1.21.2, 2026-05-31)
* Modify joint-RPCA to match with Gemelli implementation (1.21.3, 2026-06-16)
+ Generalise agglomerateByModule to non-binary numerical modules (1.21.2, 2026-05-31)
+ Modify joint-RPCA to match with Gemelli implementation (1.21.3, 2026-06-16)
+ Implement Striped Unifrac algorithm (1.21.3, 2026-06-12)
15 changes: 15 additions & 0 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ setGeneric("convertToBIOM", signature = c("x"),
setGeneric("convertToPhyloseq", signature = c("x"), function(x, ...)
standardGeneric("convertToPhyloseq"))

#' @rdname export-methods
#' @export
setGeneric("exportRaw", signature = c("x"), function(x, ...)
standardGeneric("exportRaw"))

#' @rdname export-methods
#' @export
setGeneric("exportQIIME2", signature = c("x"), function(x, ...)
standardGeneric("exportQIIME2"))

#' @rdname export-methods
#' @export
setGeneric("exportMothur", signature = c("x"), function(x, ...)
standardGeneric("exportMothur"))

#' @rdname isContaminant
#' @export
setGeneric("addContaminantQC", signature = c("x"),
Expand Down
4 changes: 4 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
.Call(`_mia_apply_transformation_difference_or_division`, mat, method)
}

.unifrac_cpp <- function(assay, rowTree, weighted) {
.Call(`_mia_unifrac_cpp`, assay, rowTree, weighted)
}

17 changes: 11 additions & 6 deletions R/addAlpha.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@
#' evenly the abundances of different species are distributed. The following
#' evenness indices are provided:
#'
#' By default, four indices are returned, each taking into account different
#' aspects: richness (the number of observed unique features),
#' dominance (Berger-Parker), information (Shannon), and phylogenetics (Faith)
#' By default, four indices are returned, each taking into account different
#' aspects: richness (the number of observed unique features),
#' dominance (Berger-Parker), information (Shannon), and phylogenetics (Faith)
#' (Cassol et al., 2025).
#'
#' The available evenness indices include the following (all in lowercase):
Expand Down Expand Up @@ -360,6 +360,11 @@
#' in characterizing microbiomes.
#' _Genome Res._ 31(11):2131-2137. doi: 10.1101/gr.275777.121
#'
#' Armstrong G. et al. (2021)
#' Efficient computation of Faith's phylogenetic diversity with applications
#' in characterizing microbiomes.
#' _Genome Res._ 31(11):2131-2137. doi: 10.1101/gr.275777.121
#'
#' Beisel J-N. et al. (2003)
#' A Comparative Analysis of Diversity Index Sensitivity.
#' _Internal Rev. Hydrobiol._ 88(1):3-15.
Expand Down Expand Up @@ -447,9 +452,9 @@
#' A tribute to Claude Shannon (1916 –2001) and a plea for more rigorous use of
#' species richness, species diversity and the ‘Shannon–Wiener’ Index.
#' _Alpha Ecology & Biogeography_ 12, 177–197.
#'
#' Cassol, I., Ibañez, M. & Bustamante, J.P. (2025)
#' Key features and guidelines for the application of microbial alpha diversity
#'
#' Cassol, I., Ibañez, M. & Bustamante, J.P. (2025)
#' Key features and guidelines for the application of microbial alpha diversity
#' metrics. _Sci Rep_ 15, 622. doi:10.1038/s41598-024-77864-y
#'
#' @seealso
Expand Down
10 changes: 7 additions & 3 deletions R/addDissimilarity.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@
#' all the abundances of features are equal between two samples, and 0 means
#' that samples have completely different relative abundances.
#'
#' Unifrac is calculated with \code{
#' \link[ecodive:unweighted_unifrac]{ecodive:unweighted_unifrac()}}
#' or \code{\link[ecodive:weighted_unifrac]{ecodive:weighted_unifrac()}}.
#' Unifrac is calculated with a C++ implementation of the Striped Unifrac
#' algorithm (McDonald et al. 2021).
#'
#' If rarefaction is enabled, \code{\link[vegan:avgdist]{vegan:avgdist()}} is
#' utilized.
Expand Down Expand Up @@ -131,6 +130,11 @@
#'
#' Lozupone C, Knight R. ``Unifrac: a new phylogenetic method for comparing
#' microbial communities.'' Appl Environ Microbiol. 2005 71 (12):8228-35.
#'
#' McDonald D, Vázquez-Baeza Y, Koslicki D, McClelland J, Reeve N, Xu Z,
#' Gonzalez A, Knight R. ``Striped UniFrac: enabling microbiome analysis at
#' unprecedented scale.'' Nat Methods. 2018 15 (11):847-848.
#' doi: 10.1038/s41592-018-0187-8.
#'
#' For JSD dissimilarity:
#' Jensen-Shannon Divergence and Hilbert space embedding.
Expand Down
9 changes: 3 additions & 6 deletions R/calculateUnifrac.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#' @importFrom ape drop.tip
#' @importFrom ecodive weighted_unifrac
#' @importFrom ecodive unweighted_unifrac
.get_unifrac <- function(
x, tree, weighted = FALSE, node.label = nodeLab, nodeLab = NULL, ...){
x, tree, new = FALSE, weighted = FALSE, node.label = nodeLab, nodeLab = NULL, ...){
# Transpose the matrix so that the orientation is the same as in other
# dissimilatity methods
x <- t(x)
Expand Down Expand Up @@ -72,9 +70,8 @@
# multiple rows are linked to single tip.
x <- .merge_assay_by_rows(x, node.label, ...)

# Calculate unifrac. Use implementation from ecodive package
FUN <- if( weighted ) weighted_unifrac else unweighted_unifrac
res <- FUN(t(x), tree = tree)
# Calculate unifrac with C++ algorithm
res <- .unifrac_cpp(x, tree, weighted)
return(res)
}

Expand Down
Loading
Loading