veg / hyphy

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

Error: Internal error in ComputeBranchCache #1610

Closed noobcoder04 closed 10 months ago

noobcoder04 commented 1 year ago

Hello everyone,

I am trying to run the FEL model using the Hyphy package (version 2.5.5) for a codon-aware nucleotide alignment and its corresponding phylogenetic tree. However, I am running into the following issue. Any help would be appreciated. Thanks!

Error:Internal error 
Internal error in ComputeBranchCache (branch hrQeUqRR.tree_0.Node20427, eval #4887482 ) reversible model cached likelihood =   -256656.044235
9757, directly computed likelihood =   -256655.3639671005. This is most likely because a non-reversible model was incorrectly auto-detected (
or specified by the model file in environment variables; for smaller errors, this could be due to numerical instability of calculations for l
arger alignments).
spond commented 1 year ago

Dear @noobcoder04,

Can you confirm the version? 2.5.5 is quite old, and I would recommend upgrading to the latest version and trying it again. Later versions (for the past 2+ years) also support the

ENV="TOLERATE_NUMERICAL_ERRORS=1;" 

command line argument that demotes these messages from errors to warnings.

Best, Sergei

noobcoder04 commented 1 year ago

Dear @spond,

Thank you for your reply! Apologies for the typographical error in the version. I am currently running version '2.5.50'. I will try running it again with the latest version. Another simple question I had was with the number of undefined bases in my sequences, Do I have to remove the sequences with any number of N's? Will they have an impact on the model output?

spond commented 1 year ago

Dear @noobcoder04,

No need to remove sequences with N. These are treated as missing data; they won't add/remove any selection. Try version 2..5.51 -- I made some specific adjustments to reduce these types of errors. You should be able to run with the additional command line flag as well.

Best, Sergei

noobcoder04 commented 1 year ago

Dear @spond,

Thank you for clarifying my doubts! I really appreciate it! I will follow your suggestion and run the model with the latest version. Thanks again.

spond commented 1 year ago

Dear @noobcoder04,

Were you able to resolve the issue? If the errors/warnings still persist, would you mind sharing the data with me (privately if needed), so I can look into why the error is thrown?

Best, Sergei

liamfriar commented 1 year ago

This worked for me!

I was receiving a similar error

### Obtaining branch lengths and nucleotide substitution biases under the nucleotide GTR model
Error:
Internal error 
Internal error in ComputeBranchCache (branch j_LHnLGv.tree_0.reference_03179, eval #90 ) reversible model cached likelihood =   -24537.24910312732, directly computed likelihood =   -24537.07601794279. This is most likely because a non-reversible model was incorrectly auto-detected (or specified by the model file in environment variables; for smaller errors, this could be due to numerical instability of calculations for larger alignments).

Function call stack
1 :  [namespace = j_LHnLGv] Optimize(mles, likelihoodFunction);

        Keyword arguments:
                {
                 "reference":"reference"
                }
-------
2 :  [namespace = XxyMvLdI] return estimators.FitSingleModel_Ext(data_filter,tree,"models.DNA.GTR.ModelDescription",initial_values,run_options);

        Keyword arguments:
                {
                 "reference":"reference"
                }
-------
3 :  [namespace = oBQySAUY] return estimators.FitGTR_Ext(data_filter,tree,initial_values,{});

        Keyword arguments:
                {
                 "reference":"reference"
                }
-------
4 :  [namespace = relax] gtr_results=estimators.FitGTR(filter_names,trees,gtr_results);

        Keyword arguments:
                {
                 "reference":"reference"
                }
-------
5 :  [namespace = relax] doGTR("relax");

        Keyword arguments:
                {
                 "reference":"reference"
                }
-------
6 :  namespace 

Step 0.doGTR("relax");;

        Keyword arguments:
                {
                 "reference":"reference"
                }
-------

So I ran RELAX again using ENV="TOLERATE_NUMERICAL_ERRORS=1 as recommended above and also using the flags from #1581 which I was using to re-run some datasets that had convergence issues.

hyphy ENV="TOLERATE_NUMERICAL_ERRORS=1;" CPU=1 relax --starting-points 100 --grid-size 2000 --models Minimal --alignment msa.tmp \
--tree ${tree_dir}/${hog}_tree.labeled.txt --test "test" --reference "reference" --output $outfile > $stdoutfile

The output looks good and the only WARNING is about duplicate sequences.

github-actions[bot] commented 10 months ago

Stale issue message