-
Notifications
You must be signed in to change notification settings - Fork 45
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
upgrade to adonis2 #328
Comments
I would love if this refactor (which I'm happy to help with) output an artifact rather than a visualization. The results could then be passed into the current visualizer, but it would make adonis/adonis2 easier to use in the python interface for multiple testing or for comparing models. Again, happy to help! |
Hey @jwdebelius, @lizgehret and I have been working on reporting statistical outputs as artifacts (in no small part because of your suggestions at the last workshop). If you'd like to see how we've been doing it, you can find it here: https://github.com/qiime2/q2-fmt , we'd be super interested in any feedback you can give. We're using Tabular Data Resources as the backing format because it makes the data a bit more standardized for alternate environments and lets us attach metadata to the columns, so we can preserve things like labels and other info (ideally mirroring the convenience of R a little bit). Maybe these can serve as a template for the Adonis refactor? It may be worth having an offline conversation about what our plans are in the near-term for this stuff. I think it would be really great to have you on-board! (cc @gregcaporaso and @nbokulich) |
Thanks @ebolyen, I will check it out! Thank you. And I'm happy to talk offline and contribute, if I can. I'm not too familiar with the tabular data resource. |
Thanks @nbokulich for starting this and @jwdebelius for offering to help it out!
Yes, totally, there are a few options here. The updated vegan package comes with both adonis() and adonis2(). Option 1: keep default as adonis() to avoid any backward compatibility issues, and add adonis2 as a separate plugin. Option2: use adonis() as default and switch to adonis2() if the user adds the with adonis()library(tidyverse)
library(vegan)
library(broom)
data(dune)
data(dune.env)
set.seed(2022)
adonis(dune ~ Management+A1, data = dune.env) %>% #build model
.$aov.tab %>% #grab summary table
broom::tidy() #broom's tidy cleans up results in a tibble. The warnings can be ignored.
'adonis' will be deprecated: use 'adonis2' instead
# A tibble: 4 × 7
term df SumsOfSqs MeanSqs F.Model R2 p.value
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Management 3 1.47 0.490 3.07 0.342 0.004
2 A1 1 0.441 0.441 2.77 0.103 0.023
3 Residuals 15 2.39 0.159 NA 0.556 NA
4 Total 19 4.30 NA NA 1 NA
Warning message:
In tidy.anova(.) :
The following column names in ANOVA output were not recognized or transformed: SumsOfSqs, MeanSqs, F.Model, R2 with adonis2, by="terms"set.seed(2022); adonis2(dune ~ Management+A1, data = dune.env, by="terms") %>%
broom::tidy(.)
# A tibble: 4 × 6
term df SumOfSqs R2 statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Management 3 1.47 0.342 3.07 0.004
2 A1 1 0.441 0.103 2.77 0.023
3 Residual 15 2.39 0.556 NA NA
4 Total 19 4.30 1 NA NA
Warning message:
In tidy.anova(.) :
The following column names in ANOVA output were not recognized or transformed: SumOfSqs, R2 And finally with adonis2, by="margin"set.seed(2022)
adonis2(dune ~ Management+A1, data = dune.env, by="margin") %>%
broom::tidy(.)
# A tibble: 4 × 6
term df SumOfSqs R2 statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Management 3 1.19 0.276 2.48 0.005
2 A1 1 0.441 0.103 2.77 0.023
3 Residual 15 2.39 0.556 NA NA
4 Total 19 4.30 1 NA NA
Warning message:
In tidy.anova(.) :
The following column names in ANOVA output were not recognized or transformed: SumOfSqs, R2 A couple of notes here. The warnings here are related to the @ebolyen I have some minor suggestions about those awesome plots over on the q2-fmt page you linked. Should I comment there? |
Looks like I was wrong about adonis2() being introduced to vegan only after 2.5_7 and after, as Jari Oksanen mentioned in the above Q2 forum post, this has been around since 2.4-0, so updating this will be even simpler, just a matter of updating the existing syntax to |
Thank you all for working on this problem. I'm excited for q2-fmt |
the other issues linked here do not need to be solved at the same time. Rome was not built in a day 😅 |
Thanks @nbokulich, I'll bring this up in this week's eng meeting - this would be something we'd need to prioritize in the first couple of months of our current release cycle, since we are now halting any recipe updates 3 mos pre-upcoming release, to make community developers' lives easier. |
Hey Liz, that makes a lot of sense! I don't think this requires a recipe
change — afaik `adonis2` is just another function in the `vegan` package.
…On Tue, Nov 12, 2024 at 5:54 PM Liz Gehret ***@***.***> wrote:
Thanks @nbokulich <https://github.com/nbokulich>, I'll bring this up in
this week's eng meeting - this would be something we'd need to prioritize
in the first couple of months of our current release cycle, since we are
now halting any recipe updates 3 mos pre-upcoming release, to make
community developers' lives easier.
cc @gregcaporaso <https://github.com/gregcaporaso> @ebolyen
<https://github.com/ebolyen>
—
Reply to this email directly, view it on GitHub
<#328 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAORW3DPFSUFR7SZHGTFIM32AIXEDAVCNFSM6AAAAABRNTNO5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZRGA3TGMRRGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
q2-diversity/ci/recipe/meta.yaml Line 52 in 28c61be
We should be good to go! I don't hate the idea of bumping vegan, but it's stable, old-school software this may be unneeded! |
Yeah we don't directly depend on adonis, but if our conda env resolves vegan to >=2.6 (which could be possible in the future since we just have a min pin on vegan), we'll just have to make sure that we make any changes to be compatible with adonis2. So we may want to get ahead of that and bump that min pin, and then just make any needed changes within diversity to call adonis2 (instead of adonis). |
Improvement Description
Upgrade to the vegan function
adonis2
to access additional functionality unavailable in adonis1.To quote @mestaki :
Current Behavior
Currently
adonis
uses adonis1 in vegan. This lacks some functionality of adonis2.To quote @mestaki :
Proposed Behavior
Swap the functions, but keep the defaults to match the current adonis1 functionality (this should be possible with adonis2 surely).
Also expose marginal testing and other options available in
adonis2
(see related open issues about adonis parameters, e.g., #242)References
Raised by @mestaki on the forum
The text was updated successfully, but these errors were encountered: