agglomerateByRank() uses agglomerateByVariable() internally. However, for instance tree agglomeration was done separately in Rank function, and Rank and *Variable used different methods to agglomerate trees.
--> Take into account this. Do all the agglomeration steps in Variable function, and leave only rank-specific functionality in Rank function.
Moreover, *Variable() function's tree agglomeration method did not take into account the problem described here https://github.com/microbiome/mia/pull/548. It used node numbers instead of labels, but when TreeSE is created nodes are matched with rows/cols based on the label. This means that label found in row/colLinks matches with the tree (no need to make things more complex with node numbers).
agglomerateByRank() uses agglomerateByVariable() internally. However, for instance tree agglomeration was done separately in Rank function, and Rank and *Variable used different methods to agglomerate trees.
--> Take into account this. Do all the agglomeration steps in Variable function, and leave only rank-specific functionality in Rank function.
Moreover, *Variable() function's tree agglomeration method did not take into account the problem described here https://github.com/microbiome/mia/pull/548. It used node numbers instead of labels, but when TreeSE is created nodes are matched with rows/cols based on the label. This means that label found in row/colLinks matches with the tree (no need to make things more complex with node numbers).