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

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

Hi @uqvirg ,

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

 reference = c("diagnosis,nonIBD"))

As done in the tutorial

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

Hi Kelsey,

Thank you very much !

Kind regards,

Virginie

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

2 Likes

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?