Browse code

clean up code

Guangchuang Yu authored on 30/01/2019 12:53:00
Showing 8 changed files

... ...
@@ -214,10 +214,12 @@ importFrom(rvcheck,get_aes_var)
214 214
 importFrom(rvcheck,get_fun_from_pkg)
215 215
 importFrom(tidyr,gather)
216 216
 importFrom(tidytree,MRCA)
217
+importFrom(tidytree,ancestor)
217 218
 importFrom(tidytree,as_tibble)
218 219
 importFrom(tidytree,groupClade)
219 220
 importFrom(tidytree,groupOTU)
220 221
 importFrom(tidytree,offspring)
222
+importFrom(tidytree,parent)
221 223
 importFrom(treeio,Nnode)
222 224
 importFrom(treeio,Ntip)
223 225
 importFrom(treeio,as.phylo)
... ...
@@ -1,5 +1,7 @@
1 1
 # ggtree 1.15.6
2 2
 
3
++ remove `getChild`, `getChild.df`, `getParent`, `getParent.df`, `getSibling`, `getAncestor` and `getAncestor.df`,
4
+  instead use `child`, `parent`, `sibling` and `ancestor` methods implemented in `tidytree` and `treeio` (2019-01-30, Wed)
3 5
 + remove `get.offspring.df` and `get.offspring.tip` and instead use `tidytree::offspring` (2019-01-28, Mon)
4 6
 + `facet_widths` function to set relative widths of facet panels (2019-01-28, Mon)
5 7
   - the output is `ggplotify::as.ggplot(grid_object)`, so it is not the original `ggtree` object.
... ...
@@ -145,10 +145,12 @@ expand <- function(tree_view=NULL, node) {
145 145
     root <- which(df$node == df$parent)
146 146
     pp <- node
147 147
     while(any(pp != root)) {
148
-        df[pp, "y"] <- mean(df$y[getChild.df(df, pp)])
148
+        ## df[pp, "y"] <- mean(df$y[getChild.df(df, pp)])
149
+        df[pp, "y"] <- mean(tidytree::child(df, pp)$y)
149 150
         pp <- df$parent[pp]
150 151
     }
151
-    j <- getChild.df(df, pp)
152
+    ## j <- getChild.df(df, pp)
153
+    j <- tidytree::child(df, pp)$node
152 154
     j <- j[j!=pp]
153 155
     df[pp, "y"] <- mean(df$y[j])
154 156
 
... ...
@@ -260,10 +262,11 @@ flip <- function(tree_view=NULL, node1, node2) {
260 262
     ## yy <- df$y[-c(sp1, sp2)]
261 263
     ## df$y[-c(sp1, sp2)] <- yy + ((min(sp2.df$y, na.rm=TRUE) - max(yy)) - (min(yy) - max(sp1.df$y, na.rm=TRUE)))/2
262 264
 
263
-    anc <- getAncestor.df(df, node1)
265
+    anc <- ancestor(df, node1)$node
264 266
     ii <- match(anc, df$node)
265 267
     df[ii, "y"] <- NA
266
-    currentNode <- unlist(as.vector(sapply(anc, getChild.df, df=df)))
268
+    ## currentNode <- unlist(as.vector(sapply(anc, getChild.df, df=df)))
269
+    currentNode <- unlist(as.vector(sapply(anc, function(.node) tidytree::child(df, .node)$node)))
267 270
     currentNode <- currentNode[!currentNode %in% anc]
268 271
 
269 272
     tree_view$data <- re_assign_ycoord_df(df, currentNode)
... ...
@@ -295,7 +298,7 @@ scaleClade <- function(tree_view=NULL, node, scale=1, vertical_only=TRUE) {
295 298
     df <- tree_view$data
296 299
     ## sp <- get.offspring.df(df, node)
297 300
     ## sp.df <- df[sp,]
298
-    sp.df <- offspring(sp, node)
301
+    sp.df <- offspring(df, node)
299 302
     sp <- sp.df$node
300 303
     
301 304
     ## sp_nr <- nrow(sp.df)
... ...
@@ -350,10 +353,12 @@ reassign_y_from_node_to_root <- function(df, node) {
350 353
     root <- which(df$node == df$parent)
351 354
     pp <- df$parent[node]
352 355
     while(any(pp != root)) {
353
-        df[pp, "y"] <- mean(df$y[getChild.df(df, pp)])
356
+        ## df[pp, "y"] <- mean(df$y[getChild.df(df, pp)])
357
+        df[pp, "y"] <- mean(tidytree::child(df, pp)$y)
354 358
         pp <- df$parent[pp]
355 359
     }
356
-    j <- getChild.df(df, pp)
360
+    ## j <- getChild.df(df, pp)
361
+    j <- tidytree::child(df, pp)$node
357 362
     j <- j[j!=pp]
358 363
     df[pp, "y"] <- mean(df$y[j])
359 364
     return(df)
... ...
@@ -181,7 +181,8 @@ get_balance_position <- function(treeview, node, direction) {
181 181
 }
182 182
 
183 183
 get_balance_position_ <- function(data, node, direction) {
184
-    ch <- tryCatch(getChild.df(data, node), error=function(e) NULL)
184
+    ## ch <- tryCatch(getChild.df(data, node), error=function(e) NULL)
185
+    ch <- tryCatch(tidytree::child(data, node)$node, error=function(e) NULL)
185 186
 
186 187
     if (length(ch) < 2 || is.null(ch)){
187 188
         stop('balance cannot be a tip')
... ...
@@ -120,7 +120,7 @@ scale_color_ <- function(phylo, by, low=NULL, high=NULL, na.color=NULL, default.
120 120
     if (is.null(na.color)) {
121 121
         nodes <- getNodes_by_postorder(tree)
122 122
         for (curNode in nodes) {
123
-            children <- getChild(tree, curNode)
123
+            children <- treeio::child(tree, curNode)
124 124
             if (length(children) == 0) {
125 125
                 next
126 126
             }
... ...
@@ -80,7 +80,8 @@ layoutEqualAngle <- function(model, branch.length ){
80 80
 
81 81
     ## Get number of tips for each node in tree.
82 82
   ## nb.sp <- sapply(1:N, function(i) length(get.offspring.tip(tree, i)))
83
-  nb.sp <- sapply(1:N, function(i) length(offspring(tree, i, tiponly = TRUE)))
83
+  ## self_include = TRUE to return itself if the input node is a tip
84
+  nb.sp <- sapply(1:N, function(i) length(offspring(tree, i, tiponly = TRUE, self_include = TRUE)))
84 85
     ## Get list of node id's.
85 86
     nodes <- getNodes_by_postorder(tree)
86 87
 
... ...
@@ -88,7 +89,8 @@ layoutEqualAngle <- function(model, branch.length ){
88 89
         ## Get number of tips for current node.
89 90
         curNtip <- nb.sp[curNode]
90 91
         ## Get array of child node indexes of current node.
91
-        children <- getChild(tree, curNode)
92
+        ## children <- getChild(tree, curNode)
93
+        children <- treeio::child(tree, curNode)
92 94
 
93 95
         ## Get "start" and "end" angles of a segment for current node in the data.frame.
94 96
         start <- df[curNode, "start"]
... ...
@@ -120,7 +122,9 @@ layoutEqualAngle <- function(model, branch.length ){
120 122
             start <- start + alpha
121 123
         }
122 124
     }
123
-    df
125
+  tree_df <- as_tibble(df)
126
+  class(tree_df) <- c("tbl_tree", class(tree_df))
127
+  return(tree_df)
124 128
 }
125 129
 
126 130
 ##' Equal daylight layout method for unrooted trees.
... ...
@@ -182,8 +186,9 @@ layoutDaylight <- function(model, branch.length, MAX_COUNT=5 ){
182 186
         if (ave_change <= MINIMUM_AVERAGE_ANGLE_CHANGE) break
183 187
     }
184 188
 
185
-    return(tree_df)
186
-
189
+  tree_df <- as_tibble(tree_df)
190
+  class(tree_df) <- c("tbl_tree", class(tree_df))
191
+  return(tree_df)
187 192
 }
188 193
 
189 194
 ##' Apply the daylight alorithm to adjust the spacing between the subtrees and tips of the
... ...
@@ -303,14 +308,16 @@ getTreeArcAngles <- function(df, origin_id, subtree) {
303 308
     subtree_node_ids <- subtree$subtree
304 309
     ## Initialise angle from origin node to parent node.
305 310
     ## If subtree_root_id is child of origin_id
306
-    if (subtree_root_id %in% getChild.df(df, origin_id)) {
311
+    ## if (subtree_root_id %in% getChild.df(df, origin_id)) {
312
+    if (subtree_root_id %in% tidytree::child(df, origin_id)$node) {
307 313
         ## get angle from original node to parent of subtree.
308 314
         theta_left <- getNodeAngle.vector(x_origin, y_origin, df_x[subtree_root_id], df_y[subtree_root_id])
309 315
         theta_right <- theta_left
310 316
     } else if( subtree_root_id == origin_id ){
311 317
         ## Special case.
312 318
         ## get angle from parent of subtree to children
313
-        children_ids <- getChild.df(df, subtree_root_id)
319
+        ## children_ids <- getChild.df(df, subtree_root_id)
320
+        children_ids <- tidytree::child(df, subtree_root_id)$node
314 321
         if(length(children_ids) == 2){
315 322
             ## get angles from parent to it's two children.
316 323
             theta1 <- getNodeAngle.vector(x_origin, y_origin, df_x[children_ids[1]], df_y[children_ids[1]])
... ...
@@ -364,7 +371,8 @@ getTreeArcAngles <- function(df, origin_id, subtree) {
364 371
   for(parent_id in subtree_node_ids){
365 372
     # Get angle from origin node to parent node.
366 373
     theta_parent <- getNodeAngle.vector(x_origin, y_origin, df_x[parent_id], df_y[parent_id])
367
-    children_ids <- getChild.df(df, parent_id)
374
+      ## children_ids <- getChild.df(df, parent_id)
375
+      children_ids <- tidytree::child(df, parent_id)$node
368 376
     # Skip if child is parent node of subtree.
369 377
     children_ids = children_ids[children_ids != origin_id]
370 378
     for(child_id in children_ids){
... ...
@@ -503,15 +511,16 @@ getNodeEuclDistances <- function(df, node){
503 511
 ##' @return list of all child node id's from starting node.
504 512
 getSubtree <- function(tree, node){
505 513
 
506
-  subtree <- c(node)
507
-  i <- 1
508
-  while( i <= length(subtree)){
509
-    subtree <- c(subtree, getChild(tree, subtree[i]))
510
-    # remove any '0' root nodes
511
-    subtree <- subtree[subtree != 0]
512
-    i <- i + 1
513
-  }
514
-  return(subtree)
514
+  ## subtree <- c(node)
515
+  ## i <- 1
516
+  ## while( i <= length(subtree)){
517
+  ##   subtree <- c(subtree, treeio::child(tree, subtree[i]))
518
+  ##   # remove any '0' root nodes
519
+  ##   subtree <- subtree[subtree != 0]
520
+  ##   i <- i + 1
521
+  ## }
522
+    ## return(subtree)
523
+    tidytree::offspring(tree, node, self_include = TRUE)
515 524
 }
516 525
 
517 526
 ##' Get all children of node from df tree using breath-first.
... ...
@@ -521,13 +530,15 @@ getSubtree <- function(tree, node){
521 530
 ##' @param node id of starting node.
522 531
 ##' @return list of all child node id's from starting node.
523 532
 getSubtree.df <- function(df, node){
524
-  subtree <- node[node != 0]
525
-  i <- 1
526
-  while( i <= length(subtree)){
527
-    subtree <- c(subtree, getChild.df(df, subtree[i]))
528
-    i <- i + 1
529
-  }
530
-  subtree
533
+  ## subtree <- node[node != 0]
534
+  ## i <- 1
535
+  ## while( i <= length(subtree)){
536
+  ##     ## subtree <- c(subtree, getChild.df(df, subtree[i]))
537
+  ##     subtree <- c(subtree, tidytree::child(df, subtree[i])$node)
538
+  ##   i <- i + 1
539
+  ## }
540
+    ## subtree
541
+    tidytree:::offspring.tbl_tree(df, node, self_include = TRUE)$node
531 542
 }
532 543
 
533 544
 ##' Get all subtrees of specified node. This includes all ancestors and relatives of node and
... ...
@@ -539,7 +550,7 @@ getSubtree.df <- function(df, node){
539 550
 ##' @return named list of subtrees with the root id of subtree and list of node id's making up subtree.
540 551
 getSubtreeUnrooted <- function(tree, node){
541 552
   # if node leaf, return nothing.
542
-  if( isTip(tree, node) ){
553
+  if( treeio::isTip(tree, node) ){
543 554
     # return NA
544 555
     return(NA)
545 556
   }
... ...
@@ -547,7 +558,8 @@ getSubtreeUnrooted <- function(tree, node){
547 558
   subtrees <- list()
548 559
 
549 560
   # get subtree for each child node.
550
-  children_ids <- getChild(tree, node)
561
+    ## children_ids <- getChild(tree, node)
562
+    children_ids <- treeio::child(tree, node)
551 563
 
552 564
   remaining_nodes <- getNodes_by_postorder(tree)
553 565
   # Remove current node from remaining_nodes list.
... ...
@@ -564,7 +576,7 @@ getSubtreeUnrooted <- function(tree, node){
564 576
 
565 577
   # The remaining nodes that are not found in the child subtrees are the remaining subtree nodes.
566 578
   # ie, parent node and all other nodes. We don't care how they are connect, just their ids.
567
-  parent_id <- getParent(tree, node)
579
+  parent_id <- parent(tree, node)
568 580
   # If node is not root, add remainder of tree nodes as subtree.
569 581
   if( parent_id != 0 & length(remaining_nodes) >= 1){
570 582
     subtrees[[length(subtrees)+1]] <- list( node = parent_id, subtree = remaining_nodes)
... ...
@@ -579,10 +591,12 @@ getSubtreeUnrooted <- function(tree, node){
579 591
 ##' @title getSubtreeUnrooted
580 592
 ##' @param df tree data.frame
581 593
 ##' @param node is the tree node id from which the subtrees are derived.
594
+##' @importFrom tidytree parent
582 595
 ##' @return named list of subtrees with the root id of subtree and list of node id's making up subtree.
583 596
 getSubtreeUnrooted.df <- function(df, node){
584 597
   # get subtree for each child node.
585
-  children_ids <- getChild.df(df, node)
598
+                                        # children_ids <- getChild.df(df, node)
599
+    children_ids <- tidytree::child(df, node)$node
586 600
   if (length(children_ids) == 0L) return(NULL)
587 601
   # if node leaf, return nothing.
588 602
 
... ...
@@ -594,7 +608,7 @@ getSubtreeUnrooted.df <- function(df, node){
594 608
 
595 609
   # The remaining nodes that are not found in the child subtrees are the remaining subtree nodes.
596 610
   # ie, parent node and all other nodes. We don't care how they are connected, just their id.
597
-  parent_id <- getParent.df(df, node)
611
+  parent_id <- parent(df, node)$node
598 612
   # If node is not root.
599 613
   if ((length(parent_id) > 0) & (length(remaining_nodes) > 0)) {
600 614
     subtrees = tibble::add_row(subtrees, node = parent_id, subtree = list(remaining_nodes))
... ...
@@ -622,19 +636,6 @@ getRoot.df <- function(df, node){
622 636
 
623 637
 
624 638
 
625
-isTip <- function(tr, node) {
626
-  children_ids <- getChild(tr, node)
627
-  #length(children_ids) == 0 ## getChild returns 0 if nothing found.
628
-  return( length(children_ids) == 0 | any(children_ids == 0) )
629
-}
630
-
631
-isTip.df <- function(df, node) {
632
-  # df may not have the isTip structure.
633
-  # return(df[node, 'isTip'])
634
-  # Tip has no children.
635
-  children_ids <- getChild.df(df, node)
636
-  length(children_ids) == 0
637
-}
638 639
 
639 640
 
640 641
 
... ...
@@ -646,7 +647,7 @@ isTip.df <- function(df, node) {
646 647
 getNodesBreadthFirst.df <- function(df){
647 648
 
648 649
   root <- getRoot.df(df)
649
-  if(isTip.df(df, root)){
650
+  if(treeio::isTip(df, root)){
650 651
     return(root)
651 652
   }
652 653
 
... ...
@@ -660,12 +661,12 @@ getNodesBreadthFirst.df <- function(df){
660 661
     i <- i + 1
661 662
 
662 663
     # Skip if parent is a tip.
663
-    if(isTip.df(df, parent)){
664
+    if(treeio::isTip(df, parent)){
664 665
       next
665 666
     }
666 667
 
667 668
     # get children of current parent.
668
-    children <- getChild.df(df,parent)
669
+    children <- tidytree::child(df,parent)$node
669 670
 
670 671
     # add children to result
671 672
     res <- c(res, children)
... ...
@@ -708,137 +709,6 @@ nodeid.gg <- function(p, label) {
708 709
 
709 710
 
710 711
 
711
-##' Get parent node id of child node.
712
-##'
713
-##' @title getParent.df
714
-##' @param df tree data.frame
715
-##' @param node is the node id of child in tree.
716
-##' @return integer node id of parent
717
-getParent.df <- function(df, node) {
718
-    parent_id <- df$parent[df$node == node]
719
-    parent_id[parent_id != node]
720
-}
721
-
722
-
723
-getAncestor.df <- function(df, node) {
724
-    anc <- getParent.df(df, node)
725
-    i <- 1
726
-    while(i<= length(anc)) {
727
-        anc <- c(anc, getParent.df(df, anc[i]))
728
-        i <- i+1
729
-    }
730
-    return(anc)
731
-}
732
-
733
-
734
-
735
-##' Get list of child node id numbers of parent node
736
-##'
737
-##' @title getChild.df
738
-##' @param df tree data.frame
739
-##' @param node is the node id of child in tree.
740
-##' @return list of child node ids of parent
741
-getChild.df <- function(df, node) {
742
-    res <- df$node[df$parent == node]
743
-    res[res != node] ## node may root
744
-}
745
-
746
-## get.offspring.df <- function(df, node) {
747
-##     ## sp <- getChild.df(df, node)
748
-##     ## i <- 1
749
-##     ## while(i <= length(sp)) {
750
-##     ##     sp <- c(sp, getChild.df(df, sp[i]))
751
-##     ##     i <- i + 1
752
-##     ## }
753
-##     ## return(sp)
754
-##     tidytree::offspring(df, node)$node
755
-## }
756
-
757
-
758
-
759
-## ##' extract offspring tips
760
-## ##'
761
-## ##'
762
-## ##' @title get.offspring.tip
763
-## ##' @param tr tree
764
-## ##' @param node node
765
-## ##' @return tip label
766
-## ##' @author ygc
767
-## ##' @importFrom ape extract.clade
768
-## ##' @export
769
-## get.offspring.tip <- function(tr, node) {
770
-##     ## if ( ! node %in% tr$edge[,1]) {
771
-##     ##     ## return itself
772
-##     ##     return(tr$tip.label[node])
773
-##     ## }
774
-##     ## clade <- extract.clade(tr, node)
775
-##     ## clade$tip.label
776
-##     tid <- offspring(tr, node, tiponly = TRUE)
777
-##     tr$tip.label[tid]
778
-## }
779
-
780
-
781
-
782
-
783
-getParent <- function(tr, node) {
784
-    if ( node == getRoot(tr) )
785
-        return(0)
786
-    edge <- tr[["edge"]]
787
-    parent <- edge[,1]
788
-    child <- edge[,2]
789
-    res <- parent[child == node]
790
-    if (length(res) == 0) {
791
-        stop("cannot found parent node...")
792
-    }
793
-    if (length(res) > 1) {
794
-        stop("multiple parent found...")
795
-    }
796
-    return(res)
797
-}
798
-
799
-
800
-
801
-
802
-getChild <- function(tr, node) {
803
-    # Get edge matrix from phylo object.
804
-    edge <- tr[["edge"]]
805
-    # Select all rows that match "node".
806
-    res <- edge[edge[,1] == node, 2]
807
-    ## if (length(res) == 0) {
808
-    ##     ## is a tip
809
-    ##     return(NA)
810
-    ## }
811
-    return(res)
812
-}
813
-
814
-
815
-getSibling <- function(tr, node) {
816
-    root <- getRoot(tr)
817
-    if (node == root) {
818
-        return(NA)
819
-    }
820
-
821
-    parent <- getParent(tr, node)
822
-    child <- getChild(tr, parent)
823
-    sib <- child[child != node]
824
-    return(sib)
825
-}
826
-
827
-
828
-getAncestor <- function(tr, node) {
829
-    root <- getRoot(tr)
830
-    if (node == root) {
831
-        return(NA)
832
-    }
833
-    parent <- getParent(tr, node)
834
-    res <- parent
835
-    while(parent != root) {
836
-        parent <- getParent(tr, parent)
837
-        res <- c(res, parent)
838
-    }
839
-    return(res)
840
-}
841
-
842 712
 
843 713
 isRoot <- function(tr, node) {
844 714
     getRoot(tr) == node
... ...
@@ -874,12 +744,13 @@ get.trunk <- function(tr) {
874 744
 ##' @param from start node
875 745
 ##' @param to end node
876 746
 ##' @return node vectot
747
+##' @importFrom tidytree ancestor
877 748
 ##' @export
878 749
 ##' @author Guangchuang Yu
879 750
 get.path <- function(phylo, from, to) {
880
-    anc_from <- getAncestor(phylo, from)
751
+    anc_from <- ancestor(phylo, from)
881 752
     anc_from <- c(from, anc_from)
882
-    anc_to <- getAncestor(phylo, to)
753
+    anc_to <- ancestor(phylo, to)
883 754
     anc_to <- c(to, anc_to)
884 755
     mrca <- intersect(anc_from, anc_to)[1]
885 756
 
... ...
@@ -1132,7 +1003,7 @@ getYcoord_scale2 <- function(tr, df, yscale) {
1132 1003
     ii <- 1
1133 1004
     ntip <- length(ordered_tip)
1134 1005
     while(ii < ntip) {
1135
-        sib <- getSibling(tr, ordered_tip[ii])
1006
+        sib <- tidytree::sibling(tr, ordered_tip[ii])
1136 1007
         if (length(sib) == 0) {
1137 1008
             ii <- ii + 1
1138 1009
             next
... ...
@@ -1155,7 +1026,7 @@ getYcoord_scale2 <- function(tr, df, yscale) {
1155 1026
     }
1156 1027
 
1157 1028
 
1158
-    long_branch <- getAncestor(tr, ordered_tip[1]) %>% rev
1029
+    long_branch <- ancestor(tr, ordered_tip[1]) %>% rev
1159 1030
     long_branch <- c(long_branch, ordered_tip[1])
1160 1031
 
1161 1032
     N <- getNodeNum(tr)
... ...
@@ -1223,7 +1094,7 @@ getYcoord_scale_numeric <- function(tr, df, yscale, ...) {
1223 1094
         tree <- get.tree(tr)
1224 1095
         nodes <- getNodes_by_postorder(tree)
1225 1096
         for (curNode in nodes) {
1226
-            children <- getChild(tree, curNode)
1097
+            children <- treeio::child(tree, curNode)
1227 1098
             if (length(children) == 0) {
1228 1099
                 next
1229 1100
             }
... ...
@@ -1249,13 +1120,13 @@ getYcoord_scale_numeric <- function(tr, df, yscale, ...) {
1249 1120
         tree <- get.tree(tr)
1250 1121
         nodes <- rev(getNodes_by_postorder(tree))
1251 1122
         for (curNode in nodes) {
1252
-            parent <- getParent(tree, curNode)
1123
+            parent <- parent(tree, curNode)
1253 1124
             if (parent == 0) { ## already reach root
1254 1125
                 next
1255 1126
             }
1256 1127
             idx <- which(is.na(yy[parent]))
1257 1128
             if (length(idx) > 0) {
1258
-                child <- getChild(tree, parent)
1129
+                child <- treeio::child(tree, parent)
1259 1130
                 yy[parent[idx]] <- mean(yy[child], na.rm=TRUE)
1260 1131
             }
1261 1132
         }
1262 1133
deleted file mode 100644
... ...
@@ -1,19 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/tree-utilities.R
3
-\name{getChild.df}
4
-\alias{getChild.df}
5
-\title{getChild.df}
6
-\usage{
7
-getChild.df(df, node)
8
-}
9
-\arguments{
10
-\item{df}{tree data.frame}
11
-
12
-\item{node}{is the node id of child in tree.}
13
-}
14
-\value{
15
-list of child node ids of parent
16
-}
17
-\description{
18
-Get list of child node id numbers of parent node
19
-}
20 0
deleted file mode 100644
... ...
@@ -1,19 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/tree-utilities.R
3
-\name{getParent.df}
4
-\alias{getParent.df}
5
-\title{getParent.df}
6
-\usage{
7
-getParent.df(df, node)
8
-}
9
-\arguments{
10
-\item{df}{tree data.frame}
11
-
12
-\item{node}{is the node id of child in tree.}
13
-}
14
-\value{
15
-integer node id of parent
16
-}
17
-\description{
18
-Get parent node id of child node.
19
-}