FrederickHuangLin / ANCOMBC

Differential abundance (DA) and correlation analyses for microbial absolute abundance data
https://www.nature.com/articles/s41467-020-17041-7
107 stars 29 forks source link

Warning from function lme4::lmer: restarting interrupted promise evaluation? #116

Closed gabrielet closed 1 year ago

gabrielet commented 1 year ago

So, I am running ANCOMBC2 on a phyloseq object and I am seeing this warning thrown multiple times:

In lme4::lmer(formula = tformula, data = df, control = lme_control) : restarting interrupted promise evaluation

I searched for some hints and found a post in the ANCOM page. This thread suggested that the warning was not a problem because the person asking was not using random effects. However, I am using random effect so I was wondering if this is an actual problem or not.

Maybe there are issues in how I set ancombc2() parameters but they are mostly set as default so I believe they should be ok. What is going on, then?

ancom_output <- ancombc2(data=phylo_dna,
        assay_name="counts",
        tax_level="Phylum",
        fix_formula="Treatment * TimePoint",
        rand_formula="CollectionSite",
        p_adj_method="holm",
        pseudo=0,
        pseudo_sens=TRUE,
        prv_cut=0.10,
        lib_cut=0,
        s0_perc=0.05,
        group="Treatment",
        struc_zero=TRUE,
        neg_lb=FALSE,
        alpha=signif_t,
        n_cl=2,
        verbose=FALSE,
        global=FALSE,
        pairwise=FALSE,
        dunnet=FALSE,
        trend=FALSE,
        iter_control=list(tol=1e-2, max_iter=20, verbose=FALSE),
        em_control=list(tol=1e-5, max_iter=100),
        lme_control=lme4::lmerControl(),
        mdfdr_control=list(fwer_ctrl_method="holm", B=100)
)

Maybe it's because the variable Treatment has only two levels and I am passing it as group?

EDIT:

i am doing some experiments with ancombc2, and from time to time I get another warning:

In for (i in 1L:d2) { : closing unused connection 4 (<-localhost:11833)

which I don't understand.

FrederickHuangLin commented 1 year ago

Hi @gabrielet,

I think the correct way of specifying random effects in your case is

rand_formula = "(1 | CollectionSite)",

Could you try and see if the issue remains?

ANCOM-BC2 follows the lmerTest package in formulating the random effects. For more details, I recommend reading their paper.

Also the closing unused connection 4 warning message you saw is likely that the ancombc2 was stopped manually ealier. This is not a warning message from ancombc2 but from the parallel computing procedure. You can run the following function to solve the issue

unregister_dopar <- function() {
  env <- foreach:::.foreachGlobals
  rm(list=ls(name=env), pos=env)
}

or simply restart your RStudio or R.

Best, Huang

gabrielet commented 1 year ago

Hello @FrederickHuangLin,

so, as you pointed out this:

rand_formula = "(1 | CollectionSite)"

seems to be the way of specifying random effects, according to the lmerTest package. As they mention in the manual, regarding the lmer() function, in the formula:

Random-effects terms are distinguished by vertical bars (|) separating expressions for design matrices from grouping factors.

My bad for not having double-checked the lmer() function and thank you for your suggestions!