hyphy-analyses icon indicating copy to clipboard operation
hyphy-analyses copied to clipboard

Labeling phylogenetic tree programatically

Open KittyMurphy opened this issue 1 year ago • 9 comments

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.

KittyMurphy avatar Jun 19 '23 14:06 KittyMurphy

Dear @KittyMurphy,

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

image

Best, Sergei

spond avatar Jun 19 '23 18:06 spond

Dear @spond,

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

Best, Kitty

KittyMurphy avatar Jun 20 '23 07:06 KittyMurphy

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

spond avatar Jun 26 '23 23:06 spond

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

KittyMurphy avatar Jul 03 '23 10:07 KittyMurphy

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

spond avatar Jul 03 '23 16:07 spond

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

KittyMurphy avatar Jul 03 '23 18:07 KittyMurphy

Dear @KittyMurphy,

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

Best, Sergei

spond avatar Jul 11 '23 22:07 spond

Dear @spond ,

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

Best, Kitty

KittyMurphy avatar Jul 12 '23 07:07 KittyMurphy

Dear @KittyMurphy,

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

Best, Sergei

spond avatar Jul 12 '23 15:07 spond