microbiome / mia

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

Faith index fails #466

Closed antagomir closed 10 months ago

antagomir commented 11 months ago

Faith index calculation fails, only producing zeroes.

library(mia)
data(GlobalPatterns)
tse <- GlobalPatterns
tse <- estimateDiversity(tse, assay.type="counts", index="faith")

print(tse$faith)
# 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

-> To diagnose why, and then fix.

This is the only phylogeny aware alpha diversity method in mia, hence essential.

ake123 commented 11 months ago

Here is the result I got

library(mia)
data(GlobalPatterns)
tse <- GlobalPatterns
tse <- estimateDiversity(tse, assay.type="counts", index="faith")
print(tse$faith)
 [1] 250.5354 262.2629 208.4578 117.8762 119.8247 135.7673 159.3715 123.3516 143.7972 111.7095
[11] 156.4513 147.9323 247.2830 253.2101 245.1008 127.2336 167.7246 155.5872 142.3473 197.6823
[21] 197.2321 124.6510 121.2056 179.9377 140.8096 126.5695
antagomir commented 11 months ago

Can you remove the "> " from the example so I can directly copy paste the code..?

ake123 commented 11 months ago

yes done

antagomir commented 11 months ago

This is very interesting. I only get zeroes.

@himmil and @ChouaibB could you test the above, do you get also real diversities, like @ake123

himmil commented 11 months ago

I got the same result as @ake123

TuomasBorman commented 10 months ago

The issue can be probably closed,I don't get zeroes either. Probably you had old version? Faith calculation was updated in September https://github.com/microbiome/mia/pull/447