Aldex2 plugin saying my data has more than 2 levels for the comparison I am making

I am trying to use the aldex2 plugin in a conda environment containing qiime2-2019.7 (as this package was initially tested in the version). Here is my YAML to create the environment:

I build the environment:

conda env create -n qiime2-2019.7 --file *.yml

I run this command:

qiime aldex2 aldex2 --i-table 20211008-table.qza --m-metadata-file 20211008-metadata.txt --m-metadata-column treatment --o-differentials treatment-differential.qza

I received an error message indicating that the plugin does not allow more than 2 comparisons. In my case, the factor, treatment, has 2 levels: control and ABX

My metadata does not have more than 2 levels in the treatment column, nor does it contain any blank spaces or NA values. I am perplexed (King George)
Will need to be saved as a text file because it will convert to xlsx when downloaded

I supposed the issue could also be from the input qza, so I have attached this as well:

Thank you in advance, and any insight would be greatly appreciated.

Hi @nasiegel,
Thank you for providing all the detailed information here.
I can confirm that you are right that your treatment column only has 2 variables with no blanks/NAs etc, so the error does seem a bit odd. The only thing I can think of right now is that your feature-table has 129 samples (includes 5 blanks) while your metadata file only has 124 samples (no blanks). I wonder if somehow Aldex2 is defaulting to add NAs to metadata related to those extra 5 samples instead of ignoring/filtering them out. If NAs are introduced that way then that error makes more sense. You can test this by filtering your feature-table to remove the blanks and re-run your code.

I'm also going to tag in the q2-aldex2 developer @dgiguer in case he's still involved with the project and has some thoughts here.

Keep us posted!

p.s 2019.7 is quite an old version of QIIME 2, I would consider updating to the newest version with so much improvements!

I looked over the metadata file again and noticed that one sample was classified as antibiotic and control. After fixing this issue and rerunning my scripts the problem was resolved. Thank you for your feedback.

I am running the analysis using Snakemake as a workflow manager so I am using more than one version of qiime. It was my understanding that qiime 2019.7 works best for ALDex2?

Hi @nasiegel ,
Glad you figured it out! However, I'm a bit confused, because the metadata file you linked above only had 2 groups in the treatment column:

> unique(df$treatment)
[1] "control" "ABX"  

And no NAs

> which(is.na(df$treatment))
integer(0)

Is it possible the file you posted was different than the one that actually got fed into q2-aldex2? I bring this up in case there is something funky in your snakemake workflow that is not feeding the right files.

Gotcha! 2019.7 was the last version that the developer's of q2-aldex2 tested their plugin with (according to their docs anyways), it doesn't mean it won't work with the latest Q2. I think I actually have used aldex2 without any issues on one of the more recent Q2 versions. That being said, if you're just using that version of Q2 for aldex2 specifically and using newer versions for other work then you're totally fine and just carry on :slight_smile:

Yes, it is possible it is entirely a snakemake issue and not a qiime issue. The metadata file I uploaded was definitely the one that was entered into aldex2. I am not sure how aldex2 handles other columns in the metadata but there was definitely an error when I constructed the metadata. I ended up skipping the aldex2 section of my workflow while I waited for a response on this thread and was only able to catch the error after importing qiime2 artifacts into R and realizing there was one extra sample for one time point.

If you look at the column to the left of the treatment column, the sample was defined as being part of 2 groups. I would assume this would not cause an issue as I instructed aldex2 to compare the treatment column.

Hi @nasiegel,

Agreed, I would be very surprised if q2-aldex2 looked at any other column aside from the id column and the treatment column you instructed it to, so it shouldn't have mattered if there was an error in the other column. I honestly am not sure what else could have caused this if you're sure the right metadata file was used :man_shrugging: , but at least the issue seems resolved :partying_face: