veg / hyphy

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

aBSREL excludes root branches from selection testing #1622

Closed casparbein closed 1 year ago

casparbein commented 1 year ago

Hi,

thank you very much for developing this very useful suite. I have used it extensively without a problem so far. Recently, however, I tried to run aBRESL on a dataset where it always excluded two internal branches (root branch and a branch removed one degree from the root) from the analysis.

As Input, I used a tree where only the tips where labelled, and inserted node labels for internal nodes using tree_doctor, which assignes names in a format like Seq1-Seq2. Since aBSREL cannot handle dashes, I exchanged them for underscores, so the general structure of internal branch labels looks like Seq1_Seq2.

In my dataset, I have 25 sequences (tips) and 24 internal branches, for a total of 49 branches that could be tested for selection. As stated, only 47 of 49 branches are tested for selection.

I believe that the problem here is that absrel unroots the tree internally and then only analyses one of the three branches that make up the root (related to https://github.com/veg/hyphy/issues/317#issuecomment-128745648).

I have attached a figure with the tree in question and the two branches left out of the analysis marked by red arrows.

The command used was: hyphy absrel --alignment input_alignment.fa --tree input_tree.nh --output test.json

This is the input tree:

((((((((((((Seq1:1,Seq2:1)Seq1_Seq2:1,Seq7:1)Seq1_Seq7:1,Seq8:1)Seq1_Seq8:1,Seq9:1)Seq1_Seq9:1,(Seq10:1,Seq13:1)Seq10_Seq13:1)Seq1_Seq10:1,(Seq20:1,(Seq19:1,Seq18:1)Seq19_Seq18:1)Seq20_Seq19:1)Seq1_Seq20:1,(Seq17:1,(Seq16:1,Seq15:1)Seq16_Seq15:1)Seq17_Seq16:1)Seq1_Seq17:1,((Seq14:1,Seq21:1)Seq14_Seq21:1,Seq12:1)Seq14_Seq12:1)Seq1_Seq14:1,(Seq11:1,Seq24:1)Seq11_Seq24:1)Seq1_Seq11:1,Seq23:1)Seq1_Seq23:1,(Seq25:1,Seq22:1)Seq25_Seq22:1)Seq1_Seq25:1,((Seq6:1,(Seq5:1,Seq4:1)Seq5_Seq4:1)Seq6_Seq5:1,Seq3:1)Seq6_Seq3:1)Seq1_Seq6:1;

Branches Seq1_Seq6 and Seq1_Seq25 (in bold) were not included in the analysis

Is that a known issue or does it have to do with the input files I provided? What would you suggest to do to get results also for the left out branches (at least the one that is not the root)? The issue occured both with hyphy version 2.5.32 and 2.5.8.

Thanks a lot in advance!

grafik

spond commented 1 year ago

Dear @casparbein,

(please note that 2.5.8 and 2.5.36 are quite old versions; I would recommend using more recent versions for the best experience; not directly relevant to your issue).

HyPhy will generally "unroot" trees like the one you provided, because aBSREL (and most, but not all, other analyses) use time-reversible models, which means that rooted trees and their unrooted equivalents have the same likelihood and parameter estimates. "Unrooting" the tree is what you see: for N tips, you will have N-3 internal branches.

Best, Sergei

casparbein commented 1 year ago

Thanks for clarifying the issue! I will try to include another outgroup to get rate estimates for the branches in question.