Adjust_batch() error

Hello,

I am trying to adjust for study effects between two microbiome studies and their abundance data using adjust_batch(), but am receiving the following error:

“Error in relocate_scale(s_data, l_params_shrink, batchmod, n_batch, l_ind) : Features determined to be eligible for batch estimation do not agree with the ones with valid per-batch shrinked parameters!”.

I’m not sure exactly what this means or how to troubleshoot. If this helps, here is the verbose output:

“feature_abd is counts
Found 2 batches
Adjusting for covariate(s) or covariate(s) level(s)
Pseudo count is not specified and set to half of minimal non-zero value: 5e-01
Adjusting for (after filtering) 6583 features
Standardizing data across features
Estimating batch difference parameters and EB priors
Performing shrinkage adjustments on batch difference parameters
Performing batch corrections
Error in relocate_scale(s_data, l_params_shrink, batchmod, n_batch, l_ind) :
Features determined to be eligible for batch estimation do not agree with the ones with valid per-batch shrinked parameters!
In addition: Warning message:
In check_batch(df_batch[[batch]], min_n_batch = 2) :
Batch variable is not a factor as provided and will be converted to one.”

Any guidance would be appreciated! Thank you
-Mary

Hi -

This is rare situation where something went gone wrong during estimating per-batch shifting and scaling parameters. Would you mind sharing your input data with me? You can reach me at syma.research@gmail.com.

Thanks!
Siyuan

Hi Siyuan.

Thanks for the response. I sent my input data to your email. Let me know if you need anything else!

-Mary

Hi Mary,

Thanks for sending the data. It seems the error was caused by some rare cases where a feature has zero variance in non-zero values in a single batch. I’ve fixed this and pushed the change to Bioconductor. It’ll take a day or two for the new build to be sync’ed (the new version should be 1.4.2 instead of 1.4.1). Alternatively, you can install the fix directly from GitHub:

devtools::install_github("biobakery/MMUPHin")

Let me know if this solves the issue.

Thanks,
Siyuan

Hi Siyuan,
It seems to be working now! Thank you again for the quick responses. I appreciate it.
-Mary

Hello,

I am having the same issue with the error + warnings below using MMUPHin version 1.6.2:

Error in relocate_scale(s_data, l_params_shrink, batchmod, n_batch, l_ind) :
Features determined to be eligible for batch estimation do not agree with the ones with valid per-batch shrinked parameters!
In addition: Warning messages:
1: In max(abs(g.new - g.old)/g.old, abs(d.new - d.old)/d.old, na.rm = TRUE) :
no non-missing arguments to max; returning -Inf
2: In max(abs(g.new - g.old)/g.old, abs(d.new - d.old)/d.old, na.rm = TRUE) :
no non-missing arguments to max; returning -Inf

I’d greatly appreciate any further advice with this problem and would be happy to share more info on my data.

AF

Hi -

Would you mind sharing the data? Feel free to email me at syma.research@gmail.com.

Best,
Siyuan

To follow up: the issue has been fixed in GitHub MMUPHin 1.9.1. Update has been pushed to to Bioc release and should be available soon (version 1.8.1).

Hi Siyuan,

I also seem to be getting the same error even after the update (I’ve pasted it below). I’m not sure what to, especially that I know I’ve got 4 batches.

feature_abd is counts
Found 4 batches
Adjusting for covariate(s) or covariate(s) level(s)
Pseudo count is not specified and set to half of minimal non-zero value: 1e+00
Adjusting for (after filtering) 90 features
Standardizing data across features
Estimating batch difference parameters and EB priors
Error in if (s2 == 0) s2 ← 1 : missing value where TRUE/FALSE needed
In addition: Warning message:
In check_batch(df_batch[[batch]], min_n_batch = 2) :
Batch variable is not a factor as provided and will be converted to one.

Thanks a lot!

Salma

Hi - if you are comfortable, could you email me your data? Thanks, Siyuan
syma.research@gmail.com