-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New dissimilarity functions #609
Conversation
…into getDissimilarity
The idea was to add dissimilarity calculation method back (we had it couple years ago).
The idea is this:
|
Yes, seems good. In principle it would be great to be able to run methods like runMDS() for TreeSE objects without specifying the tree separately but that's a separate discussion. The reducedDim slot works for this but it is also somewhat confusing because it is also used for ordination results are derived from dissimilarities. |
|
…into getDissimilarity
Merge branch 'devel' of https://github.com/microbiome/mia into getDissimilarity # Conflicts: # R/calculateJSD.R # R/calculateOverlap.R # R/calculateUnifrac.R # man/calculateJSD.Rd # man/calculateOverlap.Rd # man/calculateUnifrac.Rd # pkgdown/_pkgdown.yml
Now rarefaction is supported for all methods through vegan::avgdist |
@thpralas can you check that everything works. Can you do some checks for rarefaction? I will still fix documentation. assay_name was additional to getDissimilarity but removing it messed up other doc pages... E: the documentation should be fine now |
vegan is in imports. However, there are multiple |
I tried adding checks on rarefaction but I get different results using the wrapper and |
Setting the seed probably doesn't help because these functions have different command sequences anyway, then the results from even same random seed do not necessarily match exactly. More essential is that the results are sufficiently close. Could you paste here example comparison code and resulting comparison plot? There is related active discussion in #561 - we have similar issue with alpha diversity. If we can conclude that both methods work correctly (there can be some technical choices that are acceptable and explain the differences), and if they yield comparable results then it would be very helpful to just get this merged soon, and open a separate issue that should investigate why results from vegan::avgdist, vegan::rrarefy, and mia wrappers are different, and what should be done about that. |
Merge branch 'devel' of https://github.com/microbiome/mia into getDissimilarity # Conflicts: # R/calculateUnifrac.R
Here is the check and its ouput:
The results of |
There was a problem: dist() function was used incorrectly. Intention was to convert "normal" matrix to distance matrix. dist() was used instead of as.dist(). I removed conversion completely. Without rarefaction, getDissimilarity outputs distance matrix; with rarefaction it outputs normal matrix. (Not sure if this is a big deal) Does it work now? |
Yes it works now, thanks! |
Nice work! I think this is now good to go after checks pass |
This PR adds new methods
getDissimilarity
andaddDissimilarity
.These methods combine overlap, JSD, and UniFrac dissimilarity calculations as implemented in mia, and additionally use vegan dissimilarity function when overlap, JSD, or UniFrac are not employed.
This PR also makes the following naming modifications:
calculateOverlap
-->getOverlap
runOverlap
-->addOverlap
calculateUnifrac
-->getUnifrac
calculateJSD
-->getJSD