MAASLIN2 please how to write Rcode to insert several variables?

Dear Sir or Madam at the bioBakery Team,

We would like to analyze data from patients who have crohn’s disease by MAALSIN2.

We have got metadata related to Group (Remission (CR), Mildmoderate (CM) or Severe (CS)); Age (Numbers), Sex (M orF), BMI (Numbers), Smoking (No, Yes or Smoking History), Montreal L (L1; L2; L3 or L4). Montreal B : (B1; B2 or B3); Treatments as Infliximab (Yes or No), Adalimumab (Yes or No), Golimumab (Yes or No); Vedolizumab (Yes or No); Ustekinumab (Yes or No); Azathioprine (Yes or No). 6-mercaptopurine (Yes or No).

All theses variables (Sex, Age etc…) could change the microbiota in each group of Crohn’s disease (Remission (CR), Mildmoderate (CM), Severe (CS)).

Could you explain us how to write the Rcode to include all theses potential confunding variables when we analyse the group of Crohn’s disease ?

In summary, we used the R code described in your tutorial. It works with one variable as group. We choosed CR as the reference. And we don’t know how to insert the others variables with the group variable :
Maaslin2(input_data = otudonne,
input_metadata = metadonne,
output = “test”,
fixed_effects = c(“Group”),
reference = c(“Group,CR”),
heatmap_first_n = TRUE)

Thank you a lot for your help.

Hi @sbb,

If you want to include the rest of your variables you can include them as additional fixed effects in your data.

I.e. fixed_effects = c(“Group”, “var1”, “var2”) etc.

Then for variables that have more then 2 responses you will need to include one of the answers to that variable as a reference.


reference = c(“Group,CR”, “Smoking,No”)

Jacob Nearing

Dear Jacob Nearing,

It is clear for categorical variables. If I have well understood, with metadata including for example group (CR, CM, CS), Sex (M or F), Smoking (Yes, No, Smoking history), we have to write the Rcode as follows :
fixed_effects = c(“Group”, “Sex”, “Smoking)
and reference = c(“Group,CR”, “Smoking,No”).
Sex is not included in “reference” because there are only 2 possibilities : M or F.

We would like to include Age and BMI with group. Age and BMI are continuous variables.
How can we include Age or BMI as continuous variables in R code? If it is not possible to include continuous variables, we can convert Age or BMI into categorical data. Age can be convert in 7 categories as <18 years; 18-24; 25-34,;35-44; 45-54; 55-64 and > 65 or in 2 categories according to the mean age (< or >); BMI can be convert in 4 categories : <18,5; 18,5-24,9; 25-29,9; >30.

In summary, how to write Rcode to insert Group, Age and BMI?

Thank you very much for your help,
Kind regards,

Hi @sbb,

You would just include BMI and Age in your fixed effects parameter.

i.e. fixed_effects = c(“Group”, “Sex”, “Smoking”, “Age”, “BMI”)


Thank you again very much.
Kind regards