This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Convert Raxml Bootstrap Format To Phylonet Bootstrap Format

I'm attempting to pipe RAxML trees into PhyloNet; however, PhyloNet's input tree format differs from the RAxML output format. For instance, RAxML reads (... , ...)A:B where A is the bootstrap value and B is the branch length. PhyloNet expects (... , ...)B:A. Thus, I need to switch the position of any instance of a integer:decimal combination. Below is an example of a RAxML bootstrapped tree. Has anyone encountered this obstacle previously? Thanks!

(9907:0.00000109805126321607,(MO62:0.17915325940018508866,((((((P466:0.00000109805126321607,AQ4037:0.00000109805126321607)18:0.00000109805126321607,K5030:0.00000109805126321607)12:0.00000109805126321607,RIMD:0.00000109805126321607)14:0.00000109805126321607,AN5034:0.00000109805126321607)78:0.00361692984235871279,((AQ3810:0.00000109805126321607,10329:0.00000109805126321607)24:0.00000109805126321607,9037:0.00000109805126321607)36:0.00000109805126321607)36:0.00000109805126321607,((EX25:0.00000109805126321607,12G01:0.01092837093363076099)98:0.03322610568383993490,(N169:0.30268576131431829124,BA116:0.02960531354461843831)39:0.00877675312720228688)57:0.02111622283920037285)36:0.00362106188593958218)70:0.00000109805126321607,9909:0.00000109805126321607);

1 answer

Here's a sed command that might accomplish what you want:

sed 's/)\([0-9]*\):\([0-9]*\.[0-9]*\)/)\2:\1/g' < raxml_tree.tre > phylonet_tree.tre

It looks for an ending parenthesis followed by some digits, a colon, and some digits with a decimal point. It then flips the two sets of digits, so your tree becomes:

(9907:0.00000109805126321607,(MO62:0.17915325940018508866,((((((P466:0.00000109805126321607,AQ4037:0.00000109805126321607)0.00000109805126321607:18,K5030:0.00000109805126321607)0.00000109805126321607:12,RIMD:0.00000109805126321607)0.00000109805126321607:14,AN5034:0.00000109805126321607)0.00361692984235871279:78,((AQ3810:0.00000109805126321607,10329:0.00000109805126321607)0.00000109805126321607:24,9037:0.00000109805126321607)0.00000109805126321607:36)0.00000109805126321607:36,((EX25:0.00000109805126321607,12G01:0.01092837093363076099)0.03322610568383993490:98,(N169:0.30268576131431829124,BA116:0.02960531354461843831)0.00877675312720228688:39)0.02111622283920037285:57)0.00362106188593958218:36)0.00000109805126321607:70,9909:0.00000109805126321607);

You should test this out in PhyloNet before relying on it, naturally.

Thank you Christina! I'll try it and let you know how it works out.

Log in to answer this question.