-
Notifications
You must be signed in to change notification settings - Fork 188
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
Error Adonis (New error after reinstalling Phyloseq), Error in colnames<-
#1457
Comments
@DrMaestre I didn't encounter this error. I tested it with: library(phyloseq)
library(vegan) other attached packages:
[1] vegan_2.5-6 lattice_0.20-41 permute_0.9-5 phyloseq_1.30.0 |
I got it to work this morning, I had to transpose the matrix.
Thanks for your help!
On Sat, Apr 10, 2021 at 10:07 AM I-Hsuan Lin ***@***.***> wrote:
@DrMaestre <https://github.com/DrMaestre> I didn't encounter this error.
What's the version of your package vegan (which is where the adonis
function is from)?
I tested it with:
library(phyloseq)
library(vegan)
other attached packages:
[1] vegan_2.5-6 lattice_0.20-41 permute_0.9-5 phyloseq_1.30.0
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1457 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOQTT2OUAMMEEZSWCRIWL2TTIBSRFANCNFSM42TKENNQ>
.
--
Thanks,
JP.
"The voyage of discovery is not in seeking new landscapes but in having new
eyes"
- Marcel Proust -
Juan Pedro Maestre
Research Associate at The University of Texas at Austin.
+1 512 751 96 81
Pronouns: he, him, his
Curiosity + Science + Diversity + Empathy + Development + Community
|
Hi, I am having this same problem when I didn't used to. I tried to run the exact same code and got the exact same error. DrMaestre, what do you mean by transpose the matrix? For the record I have phyloseq=1.32.0 and vegan 2.5.7 |
I had to use the adonis2 function instead of adonis.
Thanks.
…On Thu, May 6, 2021 at 12:36 PM Adrian Verster ***@***.***> wrote:
Hi,
I am having this same problem when I didn't used to. I tried to run the
exact same code and got the exact same error. DrMaestre, what do you mean
by transpose the matrix? For the record I have phyloseq=1.32.0 and vegan
2.5.7
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1457 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOQTT2MU5DMZWWBBB6GL7ULTMLHRVANCNFSM42TKENNQ>
.
--
Thanks,
JP.
"The voyage of discovery is not in seeking new landscapes but in having new
eyes"
- Marcel Proust -
Juan Pedro Maestre
Research Associate at The University of Texas at Austin.
+1 512 751 96 81
Pronouns: he, him, his
Curiosity + Science + Diversity + Empathy + Development + Community
|
I noticed this problem as well, and adjusting to Adonis2 solved it for me. But now, I can no longer run @pmartinezarbizu without it throwing the same error. I did some digging, and found that pmartinezarbizu included a pairwise.adonis2() function that allows a user to include strata, but found that it is still using adonis() as its base (as opposed to adonis2). Does anyone have an explanation for why we had to switch to using Adonis2 in phyloseq? Additionally, has anyone found an alternative to pairwise comparisons of groups with this new version? Help would be greatly appreciated! -Luke |
HI, sorry to drop into your conversation. in pairwise.adonis I kept the link to adonis instead of adonis2, also in pairwise.adonis2(). |
Good morning Pedro and thanks for responding so quickly! When I run the original pairwise.adonis command, I recieve the following error: Which is the same error I get when trying to run the original adonis command for PERMANOVA. If i switch to the adonis2 command, the PERMANOVA analysis runs smoothly. But If I switch to the pairiwse.adonis2 command, I recieve the following error: I don't think it has anything to do with the pairwise.adonis2 command, but rather having to use the adonis2 command for the phyloseq data. I am using the command as follows: 'pairwise_adonis_results <- pairwise.adonis(BRAY_CURTIS_DIST_MATRIX, sample_data(PHYLOSEQ_OBJECT)$VARIABLE)' The phyloseq object contains an otu table, metadata and taxonomy component. Do you have any thoughts? I am a huge fan of the pairwise.adonis command and would love to keep using it! -Luke |
HI @lkoest12 , You need to make sure that the argument passed to pairwise.adonis is a column of a data.frame or a vector of values. In pairwise.adonis2 the rhs (right-hand side) argument of the formula is a column name of a data.frame which is specify in data= your.data.frame. something like or Pedro |
So inspect the output of |
OK! I tried out the new lines, and they didn't work. I see what you were thinking though, so I converted the metadata portion of the phyloseq object to data.frame and tried that as well. No dice. I took some screenshots and wrote a csv of my data frame to share. What I find most interesting is that the original adonis() command no longer works with this type of data either. As @DrMaestre mentioned above, when he switched to adonis2() that fixed the issue. Could it be a disconnect with vegan and phyloseq causing this? I am not entirely sure what the difference between adonis() and adonis2() is, nor do I understand why the original no longer works. In your examples online for pairwise.adonis() I don't think you use any distance matrices in your examples. I did run through your examples and it worked fine. My distance object is considered a "dist" value and cannot be converted to a data.frame. I can't really look at the structure to compare (probably the lack of skills as a coder). I can pass some code and data for a reprex if that would help! ################################################################################################### |
Hello Pedro @pmartinezarbizu, I was wondering if you had a chance to take a look at this. I know you're pretty busy, so no worries if you haven't had time yet. Also it was a holiday weekend in the US, too. I tried looking through some of the documentation describing the change between adonis and adonis2, but it seems somewhat vague to me. The Rdocumentation page states that both adonis and adonis2 commands will accept bray-curtis dissimilarity matrices, so I am a bit confused as to why the latest updates broke the link between adonis and phyloseq. I found a thread about how phyloseq:distance and vegdist commands are not quite the same thing. But this was from 2016, and my code was working up until the update. |
I am also having the same issue. |
Hello everyone, I may have found the problem for both adonis and pairwise.adonis. I think it may have to do with the functions that the package "DescTools" are masking. I found that the following example used by Chris still seemed to work fine: https://chrischizinski.github.io/rstats/adonis/ So I matched all of his inputs and still had trouble. I then just loaded only the packages that I needed for the specific analysis, and it worked again. Then it was just narrowing it down from there. This fixed the original Adonis command too, but it seems that Vegan is preparing to deprecate the original. Try it again without loading DescTools.
|
Hi, I also had the same problem (Error in That being said, I have no idea why it is working, since the documentation specify that the LHS should be a "community matrix or dissimilarity matrix (eg. from vegdist or dist)". I don't know if I'm breaking any computational laws that I don't know of, but for now it seems to be working for me. If it's not legit, please let me know. If it is, I hope it helps. |
HI @lkoest12 you sent your file with the factors data_subtype...xlsx Note, that in your example you are using the wrong sintax for pairwise.adonis use "matrix , factors" for pairwise.adonis2 use "matrix ~ factors, data = data" You are using the oposit way. So pairwise.adonis2(iris[,1:4] ~ Species,data=iris) Regards PEdro |
The error appears when using Vegan function adonis with the package "DescTools" loaded. This code works: Code from pairwise.adonis: But when loading "DescTools" the error appears: Strangely, if I unname the matrix, adonis works again: Session info:
This happens because R-studio loads the package via namespace automatically when opening scripts, as can be seen in sessionInfo() and is been discussed at #8072 |
Hi @JFMSilva thank you for the post, Error in eval(predvars, data, env) : Object 'factors' not found I dont understand were this is comming from, vegan or DescTools I will further inpect this. |
I take a look at the adonis function, and find out why it fails when LHS of the formula is a matrix. The error occurs in line 65 of the function:
I also looked up the sequence of packages imports to find the real culprit: DescTools > gld > e1071 > proxy, and sure enough, package proxy maskes as.dist and dist from stats and as.matrix from base. |
Thank you @JFMSilva for your work, this is very informative. "package proxy maskes as.dist and dist from stats and as.matrix from base..." OHG how brave one should be to mask functions from stats and base! |
I have updated both pairwise.adonis and pairwise.adonis2. They problem shoudl be solved now and you can close the issue. |
Thanks to all of you for your comments. I had the same, very frustrating issue @lkoest12 , and mine was also because 'DescTools' snuck in with rcompanion::cldList - just as it had for @JFMSilva . I still need to use rcompanion::cldList and these changes have allowed the rest of my workflow to remain unchanged. |
Hi, I had to reinstall my R and Phyloseq and now I am getting this error when trying to implement adonis. I have been googling it without any success. Any help will be much appreciated. Thanks!
R version 3.6.3
packageVersion("phyloseq")
[1] ‘1.30.0’
The text was updated successfully, but these errors were encountered: