veg / hyphy

HyPhy: Hypothesis testing using Phylogenies
http://www.hyphy.org
Other
201 stars 68 forks source link

GARD Internal error in _LikelihoodFunction::GradientLocateTheBump #1606

Closed morggen13 closed 1 year ago

morggen13 commented 1 year ago

While running this gard command hyphy gard --alignment env_seq.fasta --rv Gamma
I got the following error: Internal error in _LikelihoodFunction::GradientLocateTheBump: in the Brent loop iteration 1. -21012391.17418955 / -21012321.85947149. I saw in a previous issue that this is likely because the sequences are too divergent. This was something I was worried about because my sequences were sampled over several decades (1990s to 2020s). Is there a way for me to figure out if this is what is causing this error? Or something I could do to remedy the issue?

spond commented 1 year ago

Dear @morggen13,

Try adding ENV="TOLERATE_NUMERICAL_ERRORS=1" to the command line, like

hyphy gard --alignment env_seq.fasta --rv Gamma ENV="TOLERATE_NUMERICAL_ERRORS=1;"

Errors like this indicate some soft of numerical instability, and generally can be ignored unless a fatal irrecoverable error is generated.

Best, Sergei

morggen13 commented 1 year ago

Thank you! I'm running this now. Is there something I could be doing to speed up the analysis? I'm working with 382 HIV-1 envelope sequences. I saw in previous versions you could limit the max number of breakpoints but it looks like that's not supported any more.

spond commented 1 year ago

Dear @morggen13,

Couple of things.

  1. GARD really benefits from MPI, even on a desktop/laptop. If you have OpenMPI installed, try something like (N = number of cores).
mpirun -np N HYPHYMPI gard...
  1. Use the --mode Faster flag.
  2. Use maximum number of breakpoint limit (--max-breakpoints K); make sure you are using the latest version of HyPhy.
  3. Perhaps the most important: reduce your dataset.

GARD has a sweet spot of ~20-50 sequences both in terms of speed and breakpoint resolution. The more sequences you give it, the larger the recombination event has to be for it to detect it (more nts per partition, for example).

A simple approach to do this is outlined in https://github.com/veg/hyphy/issues/1448

Best, Sergei

github-actions[bot] commented 1 year ago

Stale issue message