veg / hyphy-analyses

HyPhy standalone analyses
MIT License
38 stars 17 forks source link

label-tree.bf is rerooting trees when I do not want it to #48

Open liamfriar opened 11 months ago

liamfriar commented 11 months ago

N9.HOG0000289_tree.labeled.txt N9.HOG0000289.pruned_tree.txt test_list.txt Input and output files are attached. The function call is below. Maybe I could use the --reroot flag and give it the original root, but I just used gotree rename instead, which works great. Also, label-tree.bf always generates output files that lack a \n at the end of the file, which causes problems for some later steps in my pipeline. Again, gotree rename is a good alternative.

'HYPHY 2.5.51(MP) for Linux on x86_64'

logfile=log.tmp
hyphy label-tree.bf --internal-nodes None --list test_list.txt --label "test" --tree $in_tree --output $out_tree >> $logfile
spond commented 11 months ago

Dear @liamfriar,

HyPhy is not exactly rerooting, but rather unrooting the tree here. That's mostly because tree-label.bf is meant as preprocessor for downstream analyses in HyPhy, which (for the most part) deals with time-reversible models, and thereby unrooted trees. From the standpoint of HyPhy, these trees are equivalent.

That said, if you add ENV="ACCEPT_ROOTED_TREES=1;" to the command line, input rooted trees should remain rooted. You could add a newline to the output by doing something like this (which is not the prettiest solution, but does the job with minimal fuss).

logfile=log.tmp
hyphy label-tree.bf --internal-nodes None --list test_list.txt --label "test" --tree $in_tree --output $out_tree ENV="ACCEPT_ROOTED_TREES=1; >> $logfile; echo "\n" >>  $out_tree 

I am sure that purpose-build tree manipulators (like gotree) will do a better job that my scrips:)

Best, Sergei

liamfriar commented 11 months ago

Hi Sergei, as usual, thank you for the quick and informative reply! I am only using the labeled trees for hyphy RELAX so it sounds like the unrooting would not affect things.

liamfriar commented 10 months ago

Hi again @spond et al, I reran my analysis using gotree rename instead of hyphy label-tree.bf to keep the tree rooted because I was curious if it would make a difference. Out of 2079 genes that I ran hyphy RELAX on, 61 had the ultimate result of relaxation, intensification, not_significant flip (using the default p-value<0.5 for each). If you are curious, I am happy to send you the trees and the sequences for a couple of those genes via email.