Tuesday, January 31, 2017

Second video demo of tree.drawer in phytools

I'm getting a kick out of my new function tree.drawer to extract a phylogeny from an image of a plotted tree. Consequently, I couldn't resist posting another demo. This one is based on Figure 1 of Song et al. (2012).

If you'd like to try it yourself, just copy & past the following lines & click away:

library(phytools)
library(jpeg)
source("https://raw.githubusercontent.com/liamrevell/phytools/master/R/tree.drawer.R")
download.file("http://www.pnas.org/content/109/37/14942/F1.large.jpg", 
    "F1.large.jpg",mode="wb")
eutheria<-tree.drawer("F1.large.jpg")

The video also demonstrates the option GOBACK to remove the most recently added leaf from the tree & go back.

The result is as follows:

plotTree(eutheria)

plot of chunk unnamed-chunk-2

The video demo can also be seen embedded below:

New tree drawing method to extract phylogeny from a plotted figure

After yesterday posting a video illustrating how to build a tree by hand using bind.tip in the phytools package, it occurred to me that the next logical step would be a function that would allow the user to build a tree completely free-hand, including with edge lengths, on top of an image of a tree.

The following is some code that will do this, below which I've posted another video demo. For the example I have used the tree from Amemiya et al. (2013).

library(phytools)
library(jpeg)
get.treepos<-phytools:::get.treepos

tree.drawer<-function(img){
    par(fg=make.transparent("grey",0.8))
    img<-readJPEG(img)
    plot.new()
    par(mar=rep(0.1,4))
    plot.window(xlim=c(0,10),ylim=c(0,10))
    rasterImage(img,0,0,10,10)
    cat("  Click the position of the GLOBAL ROOT.\n")
    flush.console()
    root<-unlist(locator(1))
    cat("  Enter the name of a tip RIGHT of the root. > ")
    flush.console()
    right<-readLines(n=1)
    cat(paste("  Click on the position of ",right,".\n",sep=""))
    flush.console()
    right.xy<-unlist(locator(1))
    cat("  Enter the name of a tip LEFT of the root. > ")   
    flush.console()
    left<-readLines(n=1)
    cat(paste("  Click on the position of ",left,".\n",sep=""))
    flush.console()
    left.xy<-unlist(locator(n=1))
    left.xy
    tree<-list(edge=matrix(c(3,3,1,2),2,2),
        edge.length=c(right.xy[1]-root[1],left.xy[1]-root[1]),
        Nnode=1,tip.label=c(right,left))
    class(tree)<-"phylo"
    tips<-setNames(c(right.xy[2],left.xy[2]),tree$tip.label)
    names(tips)<-gsub(" ","_",names(tips))
    plotTree(tree,add=TRUE,tips=tips,xlim=c(0,10)-root[1],ylim=c(0,10),
        color=make.transparent("blue",0.4),lwd=4)
    tip<-0
    cat("  Enter the name of tip to add (or press ENTER). > ")
    flush.console()
    tip<-readLines(n=1)
    while(tip!=""){
        cat(paste("  Click on the position of ",tip,".\n",sep=""))
        flush.console()
        xy<-unlist(locator(1))
        cat("  Click on the position of its MRCA in the built tree.\n")
        flush.console()
        obj<-get.treepos(message=FALSE)
        tree<-bind.tip(tree,tip,edge.length=xy[1]-(nodeheight(tree,obj$where)-
        obj$pos),where=obj$where,position=obj$pos)
        tips<-c(tips,setNames(xy[2],tip))
        names(tips)<-gsub(" ","_",names(tips))
        plot.new()
        par(mar=rep(0.1,4))
        plot.window(xlim=c(0,10),ylim=c(0,10))
        rasterImage(img,0,0,10,10)
        plotTree(tree,add=TRUE,tips=tips,xlim=c(0,10)-root[1],ylim=c(0,10),
            color=make.transparent("blue",0.4),lwd=4)
        old<-tip
        cat("  Enter the name of tip to add (or press ENTER). > ")
        flush.console()
        tip<-readLines(n=1)
        while(tip=="GOBACK"){
            cat(paste("  Dropping ",old,".\n",sep=""))
            tree<-drop.tip(tree,old)
            plot.new()
            par(mar=rep(0.1,4))
            plot.window(xlim=c(0,10),ylim=c(0,10))
            rasterImage(img,0,0,10,10)
            plotTree(tree,add=TRUE,tips=tips,xlim=c(0,10)-root[1],ylim=c(0,10),
            color=make.transparent("blue",0.4),lwd=4)
            cat("  Enter the name of tip to add (or press ENTER). > ")
            flush.console()
            tip<-readLines(n=1)
        }   
    }
    par(fg="black")
    tree
}

tree<-tree.drawer(img="Amemiya_etal_2013-tree.jpg")

Here is our final tree:

plotTree(tree)

plot of chunk unnamed-chunk-2

The result, of course, is an object of class "phylo" that we can write to file or use in any other analysis that we might be interested in.

So far this only works for right-facing phylograms, but in principle one could extend to any plotting style - with a little work.

Astute readers may notice that the node rotations of the final tree are different than in the original tree - although the topology & branch lengths are correct. Well, should we be so inclined, we can 'fix' this using tipRotate as follows:

tip.order<-c("Elephant_shark","Little_skate","Spotted_catshark","Zebrafish",
    "Pufferfish","Tilapia","Coelecanth","Lungfish","Chinese_brown_frog",
    "Western_clawed_frog","Lizard","Zebra_finch","Turkey","Chicken","Platypus",
    "Opossum","Tammar_wallaby","Armadillo","Elephant","Mouse","Human","Dog")
tree<-tipRotate(tree,setNames(1:Ntip(tree),tip.order))
plotTree(tree)

plot of chunk unnamed-chunk-3

Neat.

Bug fix for write.simmap for "multiSimmap" object class

I just pushed a few small fixes (1, 2, 3) to repair an apparent bug in how the function write.simmap was handling objects of class "multiSimmap". (That is, the results from multiple stochastic mapping replicates.)

Here's a quick demo:

library(phytools)
packageVersion("phytools")
## [1] '0.5.71'
tree
## 
## Phylogenetic tree with 26 tips and 25 internal nodes.
## 
## Tip labels:
##  A, B, C, D, E, F, ...
## 
## Rooted; includes branch lengths.
x
##   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R 
## "a" "a" "a" "a" "a" "b" "b" "b" "b" "a" "b" "b" "a" "a" "a" "a" "a" "a" 
##   S   T   U   V   W   X   Y   Z 
## "a" "a" "a" "b" "b" "b" "b" "b"
## single stochastic map tree
mtree<-make.simmap(tree,x,nsim=1)
## make.simmap is sampling character histories conditioned on the transition matrix
## 
## Q =
##           a         b
## a -1.107452  1.107452
## b  1.107452 -1.107452
## (estimated using likelihood);
## and (mean) root node prior probabilities
## pi =
##   a   b 
## 0.5 0.5
## Done.
cols<-setNames(c("blue","red"),mapped.states(mtree))
plot(mtree,cols,lwd=3)
add.simmap.legend(colors=cols,prompt=FALSE,x=0.025,y=25,vertical=FALSE)

plot of chunk unnamed-chunk-1

write.simmap(mtree)
## [1] "(((A:{a,0.25053529},B:{a,0.11581254:b,0.07346707:a,0.06125568}):{a,0.03169585:b,0.63270202},((((C:{a,0.01992487:b,0.3054573},D:{a,0.13382305:b,0.19155912}):{b,0.24162371},((E:{a,0.0193957:b,0.14272098},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.05353225:b,0.09719692},K:{b,0.15072916}):{b,0.26281008},L:{b,0.41353925}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.15689809:b,0.20926822}):{b,0.24001946}):{b,0.08506684},((U:{a,0.22763904:b,0.10190143},V:{b,0.32954048}):{b,0.02882554:a,0.18177964},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.18424744:a,0.06492537}):{a,0.09100618:b,0.36884817});"
## multiple stochastic map trees
mtrees<-make.simmap(tree,x,nsim=10)
## make.simmap is sampling character histories conditioned on the transition matrix
## 
## Q =
##           a         b
## a -1.107452  1.107452
## b  1.107452 -1.107452
## (estimated using likelihood);
## and (mean) root node prior probabilities
## pi =
##   a   b 
## 0.5 0.5
## Done.
mtrees
## 10 phylogenetic trees with mapped discrete characters
write.simmap(mtrees)
##  [1] "(((A:{a,0.25053529},B:{a,0.25053529}):{a,0.51676637:b,0.1476315},((((C:{a,0.32538217},D:{a,0.15695849:b,0.10456901:a,0.06385466}):{a,0.09601922:b,0.01366343:a,0.00064297:b,0.13129809},((E:{a,0.03895781:b,0.12315887},F:{b,0.16211668}):{b,0.15425382:a,0.08768747:b,0.02527594},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.04253255:b,0.10819662},K:{b,0.15072916}):{b,0.26281008},L:{b,0.41353925}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.19624123:b,0.16992507}):{b,0.24001946}):{b,0.08506684},((U:{a,0.30359161:b,0.02594887},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});"            
##  [2] "(((A:{a,0.25053529},B:{a,0.25053529}):{a,0.23726073:b,0.42713714},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.03450288:b,0.20712084},((E:{a,0.13257671:b,0.02953997},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.04131148:b,0.10941768},K:{b,0.15072916}):{b,0.26281008},L:{b,0.41353925}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.23571196:b,0.13045434}):{b,0.24001946}):{b,0.08506684},((U:{a,0.25555401:b,0.07398647},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});"                                                                                         
##  [3] "(((A:{a,0.13679158:b,0.11374371},B:{a,0.00949266:b,0.24104263}):{b,0.45635424:a,0.02962952:b,0.1784141},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.23401982:b,0.00760389},((E:{a,0.09830006:b,0.06381662},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.15072916},K:{b,0.10874342:a,0.04198574}):{a,0.26281008},L:{b,0.11716685:a,0.2963724}):{a,0.05065153:b,0.14058076}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.06792356:b,0.10951556:a,0.01009779}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.01459063:b,0.35157568}):{b,0.24001946}):{b,0.08506684},((U:{a,0.10886701:b,0.22067347},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});"
##  [4] "(((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.02743683:a,0.13467985}):{a,0.2035796:b,0.06363763},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.01036741:a,0.12730455}):{a,0.03776566},((J:{a,0.05973579:b,0.02767148:a,0.06332189},K:{b,0.09212128:a,0.05860788}):{a,0.26281008},L:{b,0.06921247:a,0.34432678}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.32954048},V:{b,0.32915736:a,0.00038312}):{a,0.08053641:b,0.13006877},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.24615089:a,0.21370346});"                                       
##  [5] "(((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.11547218:b,0.20990998},D:{a,0.25244312:b,0.07293904}):{b,0.24162371},((E:{a,0.13306876:b,0.02904792},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.15072916},K:{b,0.04358752:a,0.10714164}):{a,0.13498845:b,0.12782163},L:{b,0.41353925}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.1745637:b,0.03956518:a,0.08367068}):{a,0.01094784},T:{a,0.3087474}):{a,0.15364766:b,0.21251865}):{b,0.16535136:a,0.0746681}):{a,0.08506684},((U:{a,0.10770562:b,0.22183486},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.00445011:a,0.45540424});"                          
##  [6] "(((A:{a,0.17354232:b,0.03438521:a,0.04260776},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.01066409:a,0.15145259}):{a,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.12104582:a,0.25564274}):{a,0.13767197}):{a,0.03776566},((J:{a,0.15072916},K:{b,0.0080808:a,0.14264837}):{a,0.26281008},L:{b,0.25106964:a,0.16246961}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.06186474:b,0.26767574},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.0503604:a,0.40949395});"                                                                  
##  [7] "(((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.17807285:b,0.06355087},((E:{a,0.02610133:b,0.13601535},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.0777036:b,0.07302557},K:{b,0.15072916}):{b,0.26281008},L:{b,0.19334739:a,0.06218253:b,0.15800933}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.03264799:b,0.33351831}):{b,0.0499709:a,0.19004856}):{a,0.05820292:b,0.02686392},((U:{a,0.32954048},V:{b,0.00733338:a,0.17779429:b,0.0734953:a,0.07091751}):{a,0.20358986:b,0.00701532},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});"              
##  [8] "(((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.10225926:a,0.05985742}):{a,0.15368047:b,0.11353676},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.12909327:a,0.0085787}):{a,0.03776566},((J:{a,0.15072916},K:{b,0.13885031:a,0.01187885}):{a,0.26281008},L:{b,0.3479546:a,0.06558464}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.32954048},V:{b,0.28030556:a,0.04923491}):{a,0.08424949:b,0.12635569},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.03560637:a,0.42424798});"                                                                  
##  [9] "(((A:{a,0.04184692:b,0.0768692:a,0.13181917},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.03335832:a,0.12875836}):{a,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.2626937:a,0.11399487}):{a,0.13767197}):{a,0.03776566},((J:{a,0.03184506:b,0.1188841},K:{b,0.15072916}):{b,0.12024958:a,0.14256051},L:{b,0.10470151:a,0.30883774}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.22819317:b,0.10134731},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.02551876:a,0.07509127:b,0.10249499},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.32164687:a,0.13820748});"                            
## [10] "(((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.06810962:b,0.17351409},((E:{a,0.16001215:b,0.00210453},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.02427047:a,0.01349519},((J:{a,0.00699224:b,0.01272506:a,0.13101187},K:{b,0.04602768:a,0.10470148}):{a,0.26281008},L:{b,0.09832003:a,0.31521922}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.32954048},V:{b,0.25778641:a,0.07175407}):{a,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.00073683:a,0.21541525:b,0.02745099},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.17117484:a,0.07799796}):{a,0.45985435});"

Or to file:

obj<-write.simmap(mtrees,file="31Jan17-post.tre")
cat(readLines("31Jan17-post.tre",10),sep="\n")
## (((A:{a,0.25053529},B:{a,0.25053529}):{a,0.51676637:b,0.1476315},((((C:{a,0.32538217},D:{a,0.15695849:b,0.10456901:a,0.06385466}):{a,0.09601922:b,0.01366343:a,0.00064297:b,0.13129809},((E:{a,0.03895781:b,0.12315887},F:{b,0.16211668}):{b,0.15425382:a,0.08768747:b,0.02527594},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.04253255:b,0.10819662},K:{b,0.15072916}):{b,0.26281008},L:{b,0.41353925}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.19624123:b,0.16992507}):{b,0.24001946}):{b,0.08506684},((U:{a,0.30359161:b,0.02594887},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});
## (((A:{a,0.25053529},B:{a,0.25053529}):{a,0.23726073:b,0.42713714},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.03450288:b,0.20712084},((E:{a,0.13257671:b,0.02953997},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.04131148:b,0.10941768},K:{b,0.15072916}):{b,0.26281008},L:{b,0.41353925}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.23571196:b,0.13045434}):{b,0.24001946}):{b,0.08506684},((U:{a,0.25555401:b,0.07398647},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});
## (((A:{a,0.13679158:b,0.11374371},B:{a,0.00949266:b,0.24104263}):{b,0.45635424:a,0.02962952:b,0.1784141},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.23401982:b,0.00760389},((E:{a,0.09830006:b,0.06381662},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.15072916},K:{b,0.10874342:a,0.04198574}):{a,0.26281008},L:{b,0.11716685:a,0.2963724}):{a,0.05065153:b,0.14058076}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.06792356:b,0.10951556:a,0.01009779}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.01459063:b,0.35157568}):{b,0.24001946}):{b,0.08506684},((U:{a,0.10886701:b,0.22067347},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});
## (((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.02743683:a,0.13467985}):{a,0.2035796:b,0.06363763},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.01036741:a,0.12730455}):{a,0.03776566},((J:{a,0.05973579:b,0.02767148:a,0.06332189},K:{b,0.09212128:a,0.05860788}):{a,0.26281008},L:{b,0.06921247:a,0.34432678}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.32954048},V:{b,0.32915736:a,0.00038312}):{a,0.08053641:b,0.13006877},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.24615089:a,0.21370346});
## (((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.11547218:b,0.20990998},D:{a,0.25244312:b,0.07293904}):{b,0.24162371},((E:{a,0.13306876:b,0.02904792},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.15072916},K:{b,0.04358752:a,0.10714164}):{a,0.13498845:b,0.12782163},L:{b,0.41353925}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.1745637:b,0.03956518:a,0.08367068}):{a,0.01094784},T:{a,0.3087474}):{a,0.15364766:b,0.21251865}):{b,0.16535136:a,0.0746681}):{a,0.08506684},((U:{a,0.10770562:b,0.22183486},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.00445011:a,0.45540424});
## (((A:{a,0.17354232:b,0.03438521:a,0.04260776},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.01066409:a,0.15145259}):{a,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.12104582:a,0.25564274}):{a,0.13767197}):{a,0.03776566},((J:{a,0.15072916},K:{b,0.0080808:a,0.14264837}):{a,0.26281008},L:{b,0.25106964:a,0.16246961}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.06186474:b,0.26767574},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.0503604:a,0.40949395});
## (((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.17807285:b,0.06355087},((E:{a,0.02610133:b,0.13601535},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.03776566},((J:{a,0.0777036:b,0.07302557},K:{b,0.15072916}):{b,0.26281008},L:{b,0.19334739:a,0.06218253:b,0.15800933}):{b,0.19123229}):{b,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.03264799:b,0.33351831}):{b,0.0499709:a,0.19004856}):{a,0.05820292:b,0.02686392},((U:{a,0.32954048},V:{b,0.00733338:a,0.17779429:b,0.0734953:a,0.07091751}):{a,0.20358986:b,0.00701532},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.45985435});
## (((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.10225926:a,0.05985742}):{a,0.15368047:b,0.11353676},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.12909327:a,0.0085787}):{a,0.03776566},((J:{a,0.15072916},K:{b,0.13885031:a,0.01187885}):{a,0.26281008},L:{b,0.3479546:a,0.06558464}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.32954048},V:{b,0.28030556:a,0.04923491}):{a,0.08424949:b,0.12635569},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.03560637:a,0.42424798});
## (((A:{a,0.04184692:b,0.0768692:a,0.13181917},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.24162371},((E:{a,0.16211668},F:{b,0.03335832:a,0.12875836}):{a,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.2626937:a,0.11399487}):{a,0.13767197}):{a,0.03776566},((J:{a,0.03184506:b,0.1188841},K:{b,0.15072916}):{b,0.12024958:a,0.14256051},L:{b,0.10470151:a,0.30883774}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.22819317:b,0.10134731},V:{b,0.32954048}):{b,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.24360307},(Y:{b,0.02551876:a,0.07509127:b,0.10249499},Z:{b,0.20310502}):{b,0.08786783}):{b,0.2491728}):{b,0.32164687:a,0.13820748});
## (((A:{a,0.25053529},B:{a,0.25053529}):{a,0.66439787},((((C:{a,0.32538217},D:{a,0.32538217}):{a,0.06810962:b,0.17351409},((E:{a,0.16001215:b,0.00210453},F:{b,0.16211668}):{b,0.26721723},(G:{b,0.05264535},(H:{b,0.00292458},I:{b,0.00292458}):{b,0.04972077}):{b,0.37668856}):{b,0.13767197}):{b,0.02427047:a,0.01349519},((J:{a,0.00699224:b,0.01272506:a,0.13101187},K:{b,0.04602768:a,0.10470148}):{a,0.26281008},L:{b,0.09832003:a,0.31521922}):{a,0.19123229}):{a,0.07014216},(((((M:{a,0.07042374},(N:{a,0.01112899},O:{a,0.01112899}):{a,0.05929475}):{a,0.0295138},P:{a,0.09993755}):{a,0.17293408},(Q:{a,0.08533472},R:{a,0.08533472}):{a,0.18753691}):{a,0.02492793},S:{a,0.29779956}):{a,0.01094784},T:{a,0.3087474}):{a,0.3661663}):{a,0.24001946}):{a,0.08506684},((U:{a,0.32954048},V:{b,0.25778641:a,0.07175407}):{a,0.21060518},((W:{b,0.04736978},X:{b,0.04736978}):{b,0.00073683:a,0.21541525:b,0.02745099},(Y:{b,0.20310502},Z:{b,0.20310502}):{b,0.08786783}):{b,0.17117484:a,0.07799796}):{a,0.45985435});

That's it.