The bioBakery help forum

Maaslin2 outputs empty plots


I am trying to run Maaslin2 on my Humann3 gene pathway data. I have successfully imported my data into R and the data fit command seems to work, but the plots it generates are empty (just axes). The significant results tsv has many lines of significant results.

I do get some warnings when I run my data fit command.

Command: fit_data3=Maaslin2(
input_data = df_input_data,
input_metadata = map,
output = “symph_output”,
fixed_effects = c(“symph”)

Warning (I get 50+ of this warning): 1: In max(nchar(x_axis_labels), na.rm = TRUE) :
no non-missing arguments to max; returning -Inf

Any ideas why the plots are empty?


Hi Jack,

I have downloaded your data from the previous post and attempted to replicate this issue on my side and I was unable to get the errors or empty plots. Here is the command that I followed:

#Read in the features
f = read.csv("./<feature_table.tsv>", sep = "\t")
row.names(f) = row.names(f$SampleID)

#Hacky remove the special chacaters
f = data.frame(t(f))
f = data.frame(t(f))
#Remove the unknowns/SampleIDs
f = f[, -c(1:3)]
#Match the row.names to the metadata
row.names(f) = gsub("X", "", row.names(f))

#Read in the metadata
m = read.table("./<metadata.txt>", header = T)
row.names(m) = m$SampleID
m$SampleID = NULL

#Here I added some filtering to attempt to reduce any spurious hits, but otherwise this is the same command as above. 

Maaslin2(f, m, "test_forum_maaslin", 
         min_prevalence = 0.1,
         min_abundance = 0.001,
         plot_heatmap = TRUE,
         fixed_effects = c("<column_of_interest>"))

Does this command work for you? If not, can you let me know which version of R and MaAsLin you are working with?


1 Like

This code worked! Thank you!

Does Maaslin2 make plots only for the top 10 significant results? I have 12 results in the significant results file, but each time I tried maaslin2 for any different data set it gave me 10 figures only. Can we overcome this?
Thank you in advance.

Hi @Dhrati_Patangia,

You are correct, the code for MaAsLin only currently supports printing 10 png files per metadata. However, the pdf files produced will show all significant diagnostic plots. Currently, if you wanted the png version you could take the source code (in ggplot) and replicate the additional two plots.

For the next iteration of MaAsLin we plan to add a flag that would allow users to expand the number of png files printed.

I hope this helps!

Thank you very much.