microbiome / mia

Microbiome analysis
https://microbiome.github.io/mia/
Artistic License 2.0
45 stars 25 forks source link

Add function to add tree #557

Closed Daenarys8 closed 1 week ago

Daenarys8 commented 1 month ago

ping #498

TuomasBorman commented 1 month ago

Can you check: it seems that row can have only one link in rowLinks. This means that no extra tree can be added (then there would be more than one linkage between single row and trees). There can be multiple trees if the dataset is divided into several trees.

--> Can you check if that is true

Daenarys8 commented 1 month ago

Load sample data

> library(mia)
> data(GlobalPatterns, package="mia")
> tse <- GlobalPatterns
> tse <- transformAssay(tse, MARGIN = "samples", method="relabundance")

Check the rowLinks slot >row_links <- rowLinks(tse)

Count the number of links per row > num_links_per_row <- sapply(row_links, length)

Check if any row has multiple links

> has_multiple_links <- any(num_links_per_row > 1)
> has_multiple_links
TRUE

row seems to have multiple links.

TuomasBorman commented 1 month ago

Your example does not show that. If you check rowLinks(tse):

  1. Row in rowLinks() represent a row in TreeSE. For instance, row number 1 in TreeSE is a row number 1 in rowLinks
  2. nodeNum tells which node represents the row in rowTree. In rowTree, multiple rows of TreeSE can be represented by a single node.
TuomasBorman commented 1 month ago

But the question was:

  1. If we add new rowTree, it must be linked with rows.
  2. Can there be more rows in rowLinks than there are rows in TreeSE. For instance in GlobalPatterns dataset there would be then almost 40,000 rows in rowLinks versus ~ 20,000 rows in TreeSE

--> I think this is not possible to do. I beliave the linkage between rows in TreeSE and rows in rowLinks is "hard" that way that each row in TreeSE is linked to corresponding index in rowLinks (but I might be wrong)

If that is the case, then we can just close this PR and issue --> the thing has be been checked

TuomasBorman commented 1 month ago

Any updates on this?

TuomasBorman commented 1 month ago

updates?

Daenarys8 commented 4 weeks ago

Not yet. Still unable to clarify if TreeSE can hold multiple *trees