The bioBakery help forum

Error in ztransform

Hi there!

I am trying to run melonnpan.train on several sets of measured microbes and metabolites. Running your example works for me, but on my own data sets I get one of these two error messages (depending on which dataset I’m using):

Error in ztransform(formula, data, family) : trait is monomorphic
Error in ztransform(formula, data, family) : trait is binary

What is causing this and how could I fix this?

Best regards,
Isis Meij

Okay, so I made a for loop which runs ztransform on each column and print the columns number as well. Whenever my columns only contain zeros (so only one unique number) or only a zero and one other value (so two unique values), it will stop and return the corresponding error. So I could (theoretically, did not try this yet) simply change one or two values in such columns to a really small value and then ztransform should work. Do you have any further tips/recommendations to handle this?

Ideally, you would like to filter those features for which the rank-based inverse normal transformation is not valid. Give it a try after you have filtered those almost binary features out. Thanks!

Thanks! After filtering those features out, MelonnPan does not give the error and runs as it is supposed to do. However, if I run it on my dataset including 85 metabolites (of which none get filtered out), my results only contain 55 metabolites. Why is that?

MelonnPan outputs only those metabolites that are well-predicted according the q-value threshold. If you set the threshold to 1, you will possibly see all the metabolites in the output. Hope this makes sense.

Hi! That’s indeed what I thought as well, but if I set the threshold to 1, my results will only include 61 metabolites. Any more tips?

If the some of the metabolites predicted are mostly constant (i.e. no metagenomic feature is selected during CV) the p-value calculation will return NA and those will be removed before aggregating results.