# Error in Maaslin2(input\_data = input\_data, input\_metadata = input\_metadata, : Please provide the reference for the variable 'diagnosis' which includes more than 2 levels: UC, CD, nonIBD

**URL:** <https://forum.biobakery.org/t/error-in-maaslin2-input-data-input-data-input-metadata-input-metadata-please-provide-the-reference-for-the-variable-diagnosis-which-includes-more-than-2-levels-uc-cd-nonibd/1998>\
**Category:** MaAsLin\
**Created:** [April 23, 2021, 3:04pm UTC](https://forum.biobakery.org/t/error-in-maaslin2-input-data-input-data-input-metadata-input-metadata-please-provide-the-reference-for-the-variable-diagnosis-which-includes-more-than-2-levels-uc-cd-nonibd/1998 "2021-04-23T15:04:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![uqvirg](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/uqvirg/32/747_2.png) [@uqvirg](https://forum.biobakery.org/u/uqvirg)\
**Post date:** [April 23, 2021, 3:04pm UTC](https://forum.biobakery.org/t/error-in-maaslin2-input-data-input-data-input-metadata-input-metadata-please-provide-the-reference-for-the-variable-diagnosis-which-includes-more-than-2-levels-uc-cd-nonibd/1998/1 "2021-04-23T15:04:02Z")

</div>

Hi,  
thank for your package.  
I’ve just done a small test and had the error:

> fit\_data = Maaslin2(

- input\_data = input\_data,
- input\_metadata = input\_metadata,
- output = “demo\_output”,
- fixed\_effects = c(“diagnosis”, “dysbiosis”))  
[1] “Creating output folder”  
[1] “Creating output figures folder”  
2021-04-23 16:56:06 INFO::Writing function arguments to log file  
2021-04-23 16:56:06 INFO::Verifying options selected are valid  
2021-04-23 16:56:06 INFO::Determining format of input files  
2021-04-23 16:56:06 INFO::Input format is data samples as rows and metadata samples as rows  
2021-04-23 16:56:06 INFO::Formula for fixed effects: expr ~ diagnosis + dysbiosis  
Error in Maaslin2(input\_data = input\_data, input\_metadata = input\_metadata, :  
Please provide the reference for the variable ‘diagnosis’ which includes more than 2 levels: UC, CD, nonIBD

Can you let me know how I can resolve this error before to use my own data.  
Thank you,  
Virgg

---

<div class="post-metadata">

**Author:** ![Kelsey\_Thompson](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/kelsey_thompson/32/65_2.png) [@Kelsey\_Thompson](https://forum.biobakery.org/u/Kelsey_Thompson)\
**Post date:** [April 23, 2021, 3:24pm UTC](https://forum.biobakery.org/t/error-in-maaslin2-input-data-input-data-input-metadata-input-metadata-please-provide-the-reference-for-the-variable-diagnosis-which-includes-more-than-2-levels-uc-cd-nonibd/1998/2 "2021-04-23T15:24:57Z")

</div>

Hi @uqvirg ,

Thanks for using our tool! I believe all that is missing here is that you need to add the line

```auto
 reference = c("diagnosis,nonIBD"))

```

As done in the [tutorial](https://github.com/biobakery/biobakery/wiki/maaslin2#32-running-maaslin2)

Please let me know if that does not solve this issue. The reference level call was a newer addition to the tool based on some user feedback.

Best,  
Kelsey

---

<div class="post-metadata">

**Author:** ![uqvirg](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/uqvirg/32/747_2.png) [@uqvirg](https://forum.biobakery.org/u/uqvirg)\
**Post date:** [April 27, 2021, 4:21am UTC](https://forum.biobakery.org/t/error-in-maaslin2-input-data-input-data-input-metadata-input-metadata-please-provide-the-reference-for-the-variable-diagnosis-which-includes-more-than-2-levels-uc-cd-nonibd/1998/3 "2021-04-27T04:21:52Z")

</div>

Hi Kelsey,

Thank you very much !

Kind regards,

Virginie

---

<div class="post-metadata">

**Author:** ![tamburin](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@tamburin](https://forum.biobakery.org/u/tamburin)\
**Post date:** [June 11, 2021, 9:49pm UTC](https://forum.biobakery.org/t/error-in-maaslin2-input-data-input-data-input-metadata-input-metadata-please-provide-the-reference-for-the-variable-diagnosis-which-includes-more-than-2-levels-uc-cd-nonibd/1998/4 "2021-06-11T21:49:49Z")

</div>

I think some confusion might be arising because the main maaslin2 github readme ([GitHub - biobakery/Maaslin2: MaAsLin2: Microbiome Multivariate Association with Linear Models](https://github.com/biobakery/Maaslin2)) doesn’t include this line, it might be helpful to have a link to the tutorial there, too 😀

---

<div class="post-metadata">

**Author:** ![B.fragilis](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@B.fragilis](https://forum.biobakery.org/u/B.fragilis)\
**Post date:** [February 23, 2024, 2:25pm UTC](https://forum.biobakery.org/t/error-in-maaslin2-input-data-input-data-input-metadata-input-metadata-please-provide-the-reference-for-the-variable-diagnosis-which-includes-more-than-2-levels-uc-cd-nonibd/1998/5 "2024-02-23T14:25:54Z")

</div>

I encountered the same problem, and I solved it thanks to the guidance provided here. However, I encounter the same issue when running it through the command line. Should I add the reference in the Maaslin2.R script within the Maaslin2 function?
