newick2phylog              package:ade4              R Documentation

_C_r_e_a_t_e _p_h_y_l_o_g_e_n_y

_D_e_s_c_r_i_p_t_i_o_n:

     The first three functions ensure to create object of class
     'phylog' from either a character string in Newick format
     ('newick2phylog') or an object of class ''hclust''
     ('hclust2phylog') or a taxonomy ('taxo2phylog'). The function
     'newick2phylog.addtools' is an internal function called by
     'newick2phylog', 'hclust2phylog' and 'taxo2phylog' when
     'newick2phylog.addtools' = TRUE. It adds some items in ''phylog''
     objects.

_U_s_a_g_e:

     newick2phylog(x.tre, add.tools = TRUE, call = match.call())
     hclust2phylog(hc, add.tools = TRUE)
     taxo2phylog(taxo, add.tools = TRUE)
     newick2phylog.addtools(res, tol = 1e-07)

_A_r_g_u_m_e_n_t_s:

   x.tre: a character string corresponding to a phylogenetic tree in
          Newick format
           (<URL:
          http://evolution.genetics.washington.edu/phylip/newicktree.ht
          ml>)

add.tools: if TRUE, executes the function 'newick2phylog.addtools'

    call: call

      hc: an object of class 'hclust'

    taxo: an object of class 'taxo'

     res: an object of class 'phylog' (an internal argument of the
          function 'newick2phylog')

     tol: used in case 3 of 'method' as a tolerance threshold for null
          eigenvalues

_V_a_l_u_e:

     Return object of class 'phylog'.

_A_u_t_h_o_r(_s):

     Daniel Chessel chessel@biomserv.univ-lyon1.fr 
      Sbastien Ollier ollier@biomserv.univ-lyon1.fr

_S_e_e _A_l_s_o:

     'phylog', 'plot.phylog', 'as.taxo'

_E_x_a_m_p_l_e_s:

      w <- "((((,,),,(,)),),(,));"
      w.phy <- newick2phylog(w)
      print(w.phy)
      plot(w.phy)

     ## Not run: 
     # newick2phylog
     data(newick.eg)
     radial.phylog(newick2phylog(newick.eg[[8]], FALSE), cnode = 1,
      clabel.l = 0.8)

     w <- NULL
     w[1] <- "(,((((((((((((((((,,(,(,))),),(((,(,)),(,)),),(,(,)),(,)),((((("
     w[2] <- ",(,)),),),(,)),((((,((,),((,(,)),))),(,)),(,(,),,((,),(,)),)),("
     w[3] <- "(((((,),),(,(,))),),(,)),(((,),),)))),((,,((,),)),(,)),((,),(,)"
     w[4] <- ")),(((((((((,,),),,),),((,),)),(,),((,),)),),(((((,),),),((,),)"
     w[5] <- "),(((,(,(,(,)))),(,)),(((,),(((((((,),),),,),(,)),(,)),)),((,)"
     w[6] <- ",))))),(,((,),(,)),((,(,)),)))),((((,(,(,))),((,(,)),,((,(,)),)"
     w[7] <- ",)),(((,),),(((,),),))),((,),))),((((((((((,,,,(,)),),((,),)),("
     w[8] <- ",(,))),(((((((((,(,)),(,)),((((,((,),(,(,(,))))),((,),(,(,)))),"
     w[9] <- "),((,),))),(((((((((,(,)),((,),(,))),),),),(((,((,),)),),((,((,"
     w[10] <- "),)),)),(,)),(,(,(,)))),((((,(,)),(,)),(((,),(,)),(,),,(,))),(,"
     w[11] <- "))),(,,,))),((((,),),),(((,(,(,))),((,),)),(,)))),(,)),),(,((,("
     w[12] <- ",)),),(((,),),))),),(((,),),(,),(,(,))),(((,),(,)),((,),(,)))),"
     w[13] <- "(((,),((,),)),(((((,,,,,),(,)),(,)),(,((,),))),))),(,(((((,(((("
     w[14] <- ",(,)),),),)),),((,((,),((,((,),(,))),))),)),((((,),(((,),(,(,))"
     w[15] <- "),)),),)),((,),)))),(((,((,,((,),)),)),),((,),))),((,),(,))),(("
     w[16] <- ",),)),(((((,),((,(,)),(((,(,)),(,(((,),),))),))),(,),,),),),,(,"
     w[17] <- ")),((((,),,),),((,,,),((,),((,),))))),((((((,(,)),,(,)),,(,),(,"
     w[18] <- "),),(((((,(,(,),)),(((,),,),(,))),),),),,,((,),)),),)),(((((,),"
     w[19] <- "(,(,)),),((,((,),),,),)),(((((((,),((((,,,),(,(,))),(((,(,)),),"
     w[20] <- "(,))),)),),),),(,)),),),((,),))),((,),)),(((((((((((,),),(((((("
     w[21] <- ",),),((,),)),(,)),),)),(,)),),((((((,),),(((,),),)),(,)),),(,))"
     w[22] <- ",),),),),(,)),),((,),(,),,,)),(,(,(,)))),),(,)),),);"
     phy1 <- newick2phylog(w,FALSE)
     phy1
     radial.phylog(phy1, clabel.l = 0, circle = 2.2, clea = 0.5,
      cnod = 0.5)
     data(newick.eg)
     radial.phylog(newick2phylog(newick.eg[[8]], FALSE), cnode = 1,
      clabel.l = 0.8)

     # hclust2phylog
     data(USArrests)
     hc <- hclust(dist(USArrests), "ave")
     par(mfrow = c(1,2))
     plot(hc, hang = -1)
     phy <- hclust2phylog(hc)
     plot.phylog(phy, clabel.l = 0.75, clabel.n = 0.6, f = 0.75)

     par(mfrow = c(1,1))
     row.names(USArrests) 
     names(phy$leaves) #WARNING not the same for two reasons
     row.names(USArrests) <- gsub(" ","_",row.names(USArrests))
     row.names(USArrests) 
     names(phy$leaves) #WARNING not the same for one reason
     USArrests <- USArrests[names(phy$leaves),]
     row.names(USArrests) 
     names(phy$leaves) #the same
     table.phylog(data.frame(scalewt(USArrests)), phy, csi = 2.5,
      clabel.r = 0.75, f = 0.7)

     #taxo2phylog
     data(taxo.eg)
     tax <- as.taxo(taxo.eg[[1]])
     tax.phy <- taxo2phylog(as.taxo(taxo.eg[[1]]))
     par(mfrow = c(1,2))
     plot.phylog(tax.phy, clabel.l = 1.25, clabel.n = 1.25, f = 0.75)
     plot.phylog(taxo2phylog(as.taxo(taxo.eg[[1]][sample(15),])),
      clabel.l = 1.25, clabel.n = 1.25, f = 0.75)

     par(mfrow=c(1,1))
     plot.phylog(taxo2phylog(as.taxo(taxo.eg[[2]])), clabel.l = 1,
      clabel.n = 0.75, f = 0.65)
     ## End(Not run)

