# Fixed effects no association plot in maaslin2

**URL:** <https://forum.biobakery.org/t/fixed-effects-no-association-plot-in-maaslin2/2774>\
**Category:** MaAsLin\
**Created:** [November 9, 2021, 6:50pm UTC](https://forum.biobakery.org/t/fixed-effects-no-association-plot-in-maaslin2/2774 "2021-11-09T18:50:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eo24a](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@eo24a](https://forum.biobakery.org/u/eo24a)\
**Post date:** [November 9, 2021, 6:50pm UTC](https://forum.biobakery.org/t/fixed-effects-no-association-plot-in-maaslin2/2774/1 "2021-11-09T18:50:56Z")

</div>

Hi,

I am using R for maaslin2 to create multiple associations with bacterial absolute counts and bunch of other features. I can only run maaslin2 for fixed effects up to 3 features. It does not calculate more than that. When fixed\_effects=NULL, then no associations found. However, I know there are associations in some features confirmed with one or up to 3 multiple effects, but when altogether combined no heatmap produced. I just dont understand why the program does not omit the non-associated feature effects and create heatmap. I can understand when all features combined maybe there is no association, but, why I can only run up to 3 features? The tutorial contains more than 3. Here is my code!

fit\_data = Maaslin2(  
input\_data = df\_input\_data,  
input\_metadata = df\_input\_metadata,  
output = “output\_noRM”,  
fixed\_effects = NULL, random\_effects = NULL, normalization = ‘NONE’, transform= “LOG”, standardize = TRUE, plot\_heatmap = TRUE, plot\_scatter = TRUE, heatmap\_first\_n = 50)

I tried every other possible options for normalization, transform and standardize.

---

<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:** [November 12, 2021, 10:26pm UTC](https://forum.biobakery.org/t/fixed-effects-no-association-plot-in-maaslin2/2774/2 "2021-11-12T22:26:41Z")

</div>

Hi @eo24a,

I’m not sure I understand your question. There are two ways to tell MaAsLin which values you want as fixed effects:

1. Leave the call for fixed effects blank (do not even put fixed\_effects = XYZ) and it will run every column in your metadata as a fixed effect. OR
2. Provide a list (e.g. fixed\_effects = `c(effect1, effect2, effect3, effect4, effect5)`) of the column names that you want MaAsLin to consider as fixed effects.

MaAsLin can certainly handle over three fixed effects. Have you tried to run MaAsLin in either of these two manners? Additionally, at times adding variables that correlate to the model can cause loss of power and you longer detect significant associations, this could also be what you are observing here. If that is the case - you would want to ask yourself what you are adding to the model with the additional regressions - is that additional variable something that you need to adjust for? Are you adding something that is completely confounded? etc.

If you are still stuck, can you provide a minimally reproducible example so that I can replicate what you are describing?

Best,  
Kelsey

---

<div class="post-metadata">

**Author:** ![eo24a](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@eo24a](https://forum.biobakery.org/u/eo24a)\
**Post date:** [November 15, 2021, 8:11pm UTC](https://forum.biobakery.org/t/fixed-effects-no-association-plot-in-maaslin2/2774/3 "2021-11-15T20:11:11Z")

</div>

Hi Kelsey,

Thank you for your response! I did try your suggestion 1. The output I am getting is that “There are no associations to plot”

Here is the output for that  
2021-11-15 12:05:37 INFO::Formula for fixed effects: expr ~ High.Oleic.Safflower.Oil + Coconut.Oil + High.Oleic.Sunflower.Oil + Palm.Oil + M…Alpina.Oil + Soy.Lecithin + Saturated + Monounsaturated + Polyunsaturated + Medium.Chain.Triglycerides + Linoleic.acid + Linolenic.acid + Dietary.Fiber + Lactose + Short.Chain.Fructooligosaccharide + Fucosyllactose + Corn.Syrup.Solids + Chicory.Root.Inulin + High.Amylose.Corn.Starch + Gum.Arabic + Microcrystaline.Cellulose + Soy.Fiber + Maltodextrin + Fat + Carbohydrate + Protein  
2021-11-15 12:05:37 INFO::Running selected normalization method: NONE  
2021-11-15 12:05:37 INFO::Filter data based on min abundance and min prevalence  
2021-11-15 12:05:37 INFO::Total samples in data: 5  
2021-11-15 12:05:37 INFO::Min samples required with min abundance for a feature not to be filtered: 0.500000  
2021-11-15 12:05:37 INFO::Total filtered features: 0  
2021-11-15 12:05:37 INFO::Filtered feature names:  
2021-11-15 12:05:37 INFO::Applying z-score to standardize continuous metadata  
2021-11-15 12:05:37 INFO::Running selected transform method: LOG  
2021-11-15 12:05:37 INFO::Running selected analysis method: LM  
| | 0 % ~calculating 2021-11-15 12:05:37 INFO::Fitting model to feature number 1, B. infantis  
|++++++ | 11% ~01s 2021-11-15 12:05:37 INFO::Fitting model to feature number 2, B. longum  
|++++++++++++ | 22% ~00s 2021-11-15 12:05:37 INFO::Fitting model to feature number 3, B. breve  
|+++++++++++++++++ | 33% ~00s 2021-11-15 12:05:37 INFO::Fitting model to feature number 4, B. vulgatus  
|+++++++++++++++++++++++ | 44% ~00s 2021-11-15 12:05:37 INFO::Fitting model to feature number 5, C. perfringens  
|++++++++++++++++++++++++++++ | 56% ~00s 2021-11-15 12:05:37 INFO::Fitting model to feature number 6, E. coli  
|++++++++++++++++++++++++++++++++++ | 67% ~00s 2021-11-15 12:05:37 INFO::Fitting model to feature number 7, E. faecalis  
|+++++++++++++++++++++++++++++++++++++++ | 78% ~00s 2021-11-15 12:05:37 INFO::Fitting model to feature number 8, K. pneumoniae  
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~00s 2021-11-15 12:05:38 INFO::Fitting model to feature number 9, B. fragilis  
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s  
2021-11-15 12:05:38 INFO::Counting total values for each feature  
2021-11-15 12:05:38 WARNING::Deleting existing residuals file: output\_nondigested\_ingredient\_noRM/residuals.rds  
2021-11-15 12:05:38 INFO::Writing residuals to file output\_nondigested\_ingredient\_noRM/residuals.rds  
2021-11-15 12:05:38 INFO::Writing all results to file (ordered by increasing q-values): output\_nondigested\_ingredient\_noRM/all\_results.tsv  
2021-11-15 12:05:38 INFO::Writing the significant results (those which are less than or equal to the threshold of 0.250000 ) to file (ordered by increasing q-values): output\_nondigested\_ingredient\_noRM/significant\_results.tsv  
2021-11-15 12:05:38 INFO::Writing heatmap of significant results to file: output\_nondigested\_ingredient\_noRM/heatmap.pdf  
[1] “There are no associations to plot!”  
2021-11-15 12:05:38 INFO::Writing association plots (one for each significant association) to output folder: output\_nondigested\_ingredient\_noRM  
[1] “There are no associations to plot!”

---

<div class="post-metadata">

**Author:** ![eo24a](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@eo24a](https://forum.biobakery.org/u/eo24a)\
**Post date:** [November 15, 2021, 8:17pm UTC](https://forum.biobakery.org/t/fixed-effects-no-association-plot-in-maaslin2/2774/4 "2021-11-15T20:17:53Z")

</div>

For the 2nd suggestion: I want to compare 4 factors. Here is my command:

> fit\_data = Maaslin2(

- 

```
input_data = df_input_data, 

```

- 

```
input_metadata = df_input_metadata, 

```

- 

```
output = "output_nondigested_ingredient_noRM", fixed_effects= c("Fat", "Carbohydrate", "Dietary.Fiber", "Protein"), random_effects = NULL, normalization = 'NONE', transform= "LOG", standardize = TRUE, plot_heatmap = TRUE, plot_scatter = TRUE, heatmap_first_n = 10)

```

In the output:  
2021-11-15 12:07:04 INFO::Formula for fixed effects: expr ~ Fat + Carbohydrate + Dietary.Fiber + Protein  
2021-11-15 12:07:04 INFO::Running selected normalization method: NONE  
2021-11-15 12:07:04 INFO::Filter data based on min abundance and min prevalence  
2021-11-15 12:07:04 INFO::Total samples in data: 5  
2021-11-15 12:07:04 INFO::Min samples required with min abundance for a feature not to be filtered: 0.500000  
2021-11-15 12:07:04 INFO::Total filtered features: 0  
2021-11-15 12:07:04 INFO::Filtered feature names:  
2021-11-15 12:07:04 INFO::Applying z-score to standardize continuous metadata  
2021-11-15 12:07:04 INFO::Running selected transform method: LOG  
2021-11-15 12:07:04 INFO::Running selected analysis method: LM  
| | 0 % ~calculating 2021-11-15 12:07:04 INFO::Fitting model to feature number 1, B. infantis  
|++++++ | 11% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 2, B. longum  
|++++++++++++ | 22% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 3, B. breve  
|+++++++++++++++++ | 33% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 4, B. vulgatus  
|+++++++++++++++++++++++ | 44% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 5, C. perfringens  
|++++++++++++++++++++++++++++ | 56% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 6, E. coli  
|++++++++++++++++++++++++++++++++++ | 67% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 7, E. faecalis  
|+++++++++++++++++++++++++++++++++++++++ | 78% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 8, K. pneumoniae  
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~00s 2021-11-15 12:07:04 INFO::Fitting model to feature number 9, B. fragilis  
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s  
2021-11-15 12:07:04 INFO::Counting total values for each feature  
2021-11-15 12:07:04 WARNING::Deleting existing residuals file: output\_nondigested\_ingredient\_noRM/residuals.rds  
2021-11-15 12:07:04 INFO::Writing residuals to file output\_nondigested\_ingredient\_noRM/residuals.rds  
2021-11-15 12:07:04 INFO::Writing all results to file (ordered by increasing q-values): output\_nondigested\_ingredient\_noRM/all\_results.tsv  
2021-11-15 12:07:04 INFO::Writing the significant results (those which are less than or equal to the threshold of 0.250000 ) to file (ordered by increasing q-values): output\_nondigested\_ingredient\_noRM/significant\_results.tsv  
2021-11-15 12:07:04 INFO::Writing heatmap of significant results to file: output\_nondigested\_ingredient\_noRM/heatmap.pdf  
2021-11-15 12:07:05 INFO::Writing association plots (one for each significant association) to output folder: output\_nondigested\_ingredient\_noRM  
2021-11-15 12:07:05 INFO::Plotting associations from most to least significant, grouped by metadata  
2021-11-15 12:07:05 INFO::Plotting data for metadata number 1, Dietary.Fiber  
2021-11-15 12:07:05 INFO::Creating scatter plot for continuous data, Dietary.Fiber vs C. perfringens  
2021-11-15 12:07:06 INFO::Creating scatter plot for continuous data, Dietary.Fiber vs B. vulgatus  
2021-11-15 12:07:06 INFO::Creating scatter plot for continuous data, Dietary.Fiber vs K. pneumoniae  
2021-11-15 12:07:06 INFO::Plotting data for metadata number 2, Fat  
2021-11-15 12:07:06 INFO::Creating scatter plot for continuous data, Fat vs C. perfringens  
2021-11-15 12:07:06 INFO::Creating scatter plot for continuous data, Fat vs B. longum  
2021-11-15 12:07:06 INFO::Creating scatter plot for continuous data, Fat vs B. breve  
2021-11-15 12:07:07 INFO::Creating scatter plot for continuous data, Fat vs K. pneumoniae  
2021-11-15 12:07:07 INFO::Creating scatter plot for continuous data, Fat vs B. vulgatus  
2021-11-15 12:07:07 INFO::Plotting data for metadata number 3, Carbohydrate  
2021-11-15 12:07:07 INFO::Creating scatter plot for continuous data, Carbohydrate vs C. perfringens  
2021-11-15 12:07:07 INFO::Creating scatter plot for continuous data, Carbohydrate vs B. breve  
2021-11-15 12:07:07 INFO::Creating scatter plot for continuous data, Carbohydrate vs E. faecalis  
2021-11-15 12:07:08 INFO::Creating scatter plot for continuous data, Carbohydrate vs B. fragilis  
2021-11-15 12:07:08 INFO::Creating scatter plot for continuous data, Carbohydrate vs B. longum  
2021-11-15 12:07:08 INFO::Creating scatter plot for continuous data, Carbohydrate vs K. pneumoniae

So it stops here and does not continue further. Plots only Fat, Dietary.Fiber, Carbohydrate but no Protein. Then, I change the order of the fixed effects in my command, putting protein earlier than dietary fiber

fit\_data = Maaslin2(  
input\_data = df\_input\_data,  
input\_metadata = df\_input\_metadata,  
output = “output\_nondigested\_ingredient\_noRM”, fixed\_effects= c(“Fat”, “Protein”, “Carbohydrate”, “Dietary.Fiber”), random\_effects = NULL, normalization = ‘NONE’, transform= “LOG”, standardize = TRUE, plot\_heatmap = TRUE, plot\_scatter = TRUE, heatmap\_first\_n = 10)

Then the plot is only fat, protein carbohydrate.  
2021-11-15 12:15:40 INFO::Writing association plots (one for each significant association) to output folder: output\_nondigested\_ingredient\_noRM  
2021-11-15 12:15:40 INFO::Plotting associations from most to least significant, grouped by metadata  
2021-11-15 12:15:40 INFO::Plotting data for metadata number 1, Fat  
2021-11-15 12:15:40 INFO::Creating scatter plot for continuous data, Fat vs C. perfringens  
2021-11-15 12:15:40 INFO::Creating scatter plot for continuous data, Fat vs B. vulgatus  
2021-11-15 12:15:40 INFO::Creating scatter plot for continuous data, Fat vs K. pneumoniae  
2021-11-15 12:15:40 INFO::Plotting data for metadata number 2, Protein  
2021-11-15 12:15:40 INFO::Creating scatter plot for continuous data, Protein vs C. perfringens  
2021-11-15 12:15:40 INFO::Creating scatter plot for continuous data, Protein vs B. vulgatus  
2021-11-15 12:15:41 INFO::Creating scatter plot for continuous data, Protein vs K. pneumoniae  
2021-11-15 12:15:41 INFO::Plotting data for metadata number 3, Carbohydrate  
2021-11-15 12:15:41 INFO::Creating scatter plot for continuous data, Carbohydrate vs C. perfringens  
2021-11-15 12:15:41 INFO::Creating scatter plot for continuous data, Carbohydrate vs B. vulgatus  
2021-11-15 12:15:41 INFO::Creating scatter plot for continuous data, Carbohydrate vs K. pneumoniae

What I am saying it does not run the 4th fixed effect no matter what it is.

I am including my data, see if you can replicate that. Am I missing something in my R command?  
[abundance\_lefse.txt](https://forum.biobakery.org/uploads/short-url/4LqxGCMFNk4CtFaEqmrYmGjcHeD.txt) (2.9 KB)  
[metadata\_noRM.txt](https://forum.biobakery.org/uploads/short-url/h6ORjt0bihMJdPJc3phZvOENg3R.txt) (878 Bytes)
