Maaslin2 outputs empty plots

Hello,

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?

Thanks,
Jack

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. 
library(Maaslin2)

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?

Best,
Kelsey

1 Like

This code worked! Thank you!

@Kelsey_Thompson
Hi,
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.
DP

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!
Best,
Kelsey

Thank you very much.

Hi!

I’m having a similar issue and I can’t make it work. I do get significant results in a tsv file and the log even says “INFO::Writing heatmap of significant results to file: path3_output/heatmap.pdf” however neither the heatmap or any plots are generated.
My error message says:
“Error in xtfrm.data.frame(x) : cannot xtfrm data frames
In addition: Warning message:
In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) :
NAs introduced by coercion”

My code is:

input_data_path ← read.table(“pathways.txt”, header = T)
input_metadata_path ← read.table(“metadata_path.txt”, header = T)

#Running MaASLine2

fit_data = Maaslin2(input_data = input_data_path,
input_metadata = input_metadata_path,
min_prevalence = 0,
min_abundance = 0.001,
normalization = “NONE”,
plot_heatmap = TRUE,
output = “path_output”,
fixed_effects = c(“column_of_interest”))

Hello @MFTL

Can you kindly post the output from:

sessioninfo::session_info()

and

sessioninfo::session_info(pkgs = “Maaslin2”, dependencies = FALSE)

Thanks
Jacob