veg / hyphy-analyses

HyPhy standalone analyses
MIT License
37 stars 17 forks source link

Labeling phylogenetic tree programatically #40

Open KittyMurphy opened 1 year ago

KittyMurphy commented 1 year ago

Hello,

Thanks for such a great tool for phylogenomic analyses!

I was wondering if there was a way of labelling the branch of the last common ancestor of two species in a phylogenetic tree programatically? I need to do this for >3,000 genes that don't always have the same species in their trees due to pruning based on the multiple sequence alignment.

Many thanks, Kitty.

spond commented 1 year ago

Dear @KittyMurphy,

Just that one branch? For example the orange branch in the following example?

image

Best, Sergei

KittyMurphy commented 1 year ago

Dear @spond,

Yes exactly, and I want to do this for several pairs of species before running hyphy absrel.

Best, Kitty

spond commented 1 year ago

Dear @KittyMurphy,

I can modify the tree labeling script to do this. How do you anticipate specifying the two species? Would something like the following work?

hyphy label-mrca.bf --tree tree.nwk --species species_a --species species_b 

You would be able to specify two or more species, including those which are not present in the tree.

Best, Sergei

KittyMurphy commented 1 year ago

Dear @spond,

That would be fantastic, thank you.

Yes that looks suitable, would I have to run this separately for each set of species that I want to label the last common ancestor for? Or would it be possible to do this as a one-liner, e.g.

hyphy label-mrca.bf --tree tree.nwk --species BFNKILLIFISH, GOLDFISH --species LOOSEJAW, ZEBRAFISH

Best, Kitty

spond commented 1 year ago

Dear @KittyMurphy,

Are you looking to label all MRCAs with the same label or with different labels? I can definitely implement something like what you suggested above, optionally with a tag, like so

hyphy label-mrca.bf --tree tree.nwk --tag MRCA --species "BFNKILLIFISH,GOLDFISH" --species "LOOSEJAW,ZEBRAFISH,MRCA2"

So, if there are two comma-separated values, the default tag (MRCA here) is applied, otherwise a pair-specific tag is applied.

Best, Sergei

KittyMurphy commented 1 year ago

Yes, I would like to label all MRCAs of interest as foreground branches to use with aBSREL. This looks great though, thank you for your help @spond!

Best, Kitty

spond commented 1 year ago

Dear @KittyMurphy,

Please see https://github.com/veg/hyphy-analyses/blob/master/LabelTrees/README-mrca.md

Best, Sergei

KittyMurphy commented 1 year ago

Dear @spond ,

This is fantastic, I'll test it out today. Thank you so much!

Best, Kitty

spond commented 1 year ago

Dear @KittyMurphy,

Great. Please let me know if you discover any issues.

Best, Sergei