veg / hyphy-analyses

HyPhy standalone analyses
MIT License
37 stars 17 forks source link

Branch specific dN/dS values #52

Closed sophie-03 closed 1 month ago

sophie-03 commented 1 month ago

Hi,

I would like to calculate dN/dS values for every branch branch in my phylogenetic tree. I have looked into the different hyphy commands and I am struggling to identify which would be best. I have tried absrel but I am unclear on the output. Am I correct in using the absrel function if I would like to to obtain an average dN/dS value for every branch of the tree? If so, is there any documentation that explains the output?

Thanks.

stevenweaver commented 1 month ago

Dear @sophie-03,

For calculating dN/dS values for every branch in your phylogenetic tree, using aBSREL (Adaptive Branch-Site Random Effects Likelihood) in HyPhy is appropriate. aBSREL is designed to detect episodic diversifying selection at the level of individual branches and provides a distribution of dN/dS ratios for each branch.

If you navigate your browser to http://vision.hyphy.org/absrel, we can take a look at the phylogenetic tree plot.

Screenshot 2024-07-08 at 11 03 28

Plot Explanation

1. Color Scale for ω (dN/dS) Values:

2. Branch Coloring:

3. Branch Lengths:

4. Tips of the Tree:

Interpretation of the Plot

Summary

If you would like to analyze the raw JSON output of aBSREL, documentation is found at https://hyphy.org/resources/json-fields.pdf.

If you would like a more complete introduction to HyPhy, please see the reference page on the site, https://hyphy.org/resources/.

Best, Steven

sophie-03 commented 1 month ago

Hi Steven,

Thank you for your quick reply! I am analyzing the raw JSON output of aBSREL and the documentation you have provided is extremely helpful.

As I understand, the "Rate Distributions" in the JSON file provides [dN, dS]. In cases where there are multiple rate classes per branch, e.g:

"Acomys_russatus":{ "Baseline MG94xREV":0.1196449279632862, "Baseline MG94xREV omega ratio":0.2705796782649418, "Corrected P-value":1, "Full adaptive model":0.1279178311081131, "Full adaptive model (non-synonymous subs/site)":0.05740613156446553, "Full adaptive model (synonymous subs/site)":0.07051169954364771, "LRT":0.143041824165266, "Nucleotide GTR":0.1085061998445977, "Rate Distributions": [ [0.06427985734759363, 0.8408782328367194], [1.646025487703998, 0.1591217671632806] ], "Rate classes":2, "Uncorrected P-value":0.4203481545500983, "original name":"Acomys_russatus", "posterior": etc...

How would dN/dS be calculated?

stevenweaver commented 1 month ago

Dear @sophie-03,

I see. For an explanation with the caveats please see @spond's comment in this thread: https://github.com/veg/hyphy/issues/1198#issuecomment-687215651.

Best, Steven

spond commented 1 month ago

Dear @sophie-03,

In addition to @stevenweaver excellent points, I would point out that if all you want are MEAN per-branch dN/dS, you might want to use FitMG94.bf. See https://github.com/veg/hyphy-analyses/issues/47 for example or https://github.com/veg/hyphy/issues/1659

Best, Sergei

sophie-03 commented 1 month ago

Thank you both, @stevenweaver @spond, for your quick responses and helpful comments. I think that FitMG94.bf is exactly what I am looking for.

Thanks again, Sophie