Update hmmsegment to attempt model fitting with depmixS4::fit() up to 5 times before failing.
Model fitting in hmmsegment() can sometime fails with an error like:
Error in fb(init = init, A = trDens, B = dens, ntimes = ntimes(object), :
NA/NaN/Inf in foreign function call (arg 10)
Calls: subcompartment ... <Anonymous> -> .local -> em -> eval -> eval -> em.depmix -> fb
Execution halted
This is a known issue (see depmixS4/issues). The workaround from this commit is a quick fix. In the issue linked above, depmixS4 authors suggest more robust ways to workaround this issue.
Update hmmsegment to attempt model fitting with
depmixS4::fit()
up to 5 times before failing.Model fitting in
hmmsegment()
can sometime fails with an error like:This is a known issue (see depmixS4/issues). The workaround from this commit is a quick fix. In the issue linked above, depmixS4 authors suggest more robust ways to workaround this issue.
If one is particularly unlucky, changing the default seed could also be an option (see https://github.com/ay-lab/dcHiC/pull/59)