{"action":"created","issue":{"url":"https://api.github.com/repos/donkeyshot/phybreak/issues/1","repository_url":"https://api.github.com/repos/donkeyshot/phybreak","labels_url":"https://api.github.com/repos/donkeyshot/phybreak/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/donkeyshot/phybreak/issues/1/comments","events_url":"https://api.github.com/repos/donkeyshot/phybreak/issues/1/events","html_url":"https://github.com/donkeyshot/phybreak/issues/1","id":173927785,"number":1,"title":"tree$edge does not reconcile with phylotree() data.frame","user":{"login":"schultzm","id":5474971,"avatar_url":"https://avatars.githubusercontent.com/u/5474971?v=3","gravatar_id":"","url":"https://api.github.com/users/schultzm","html_url":"https://github.com/schultzm","followers_url":"https://api.github.com/users/schultzm/followers","following_url":"https://api.github.com/users/schultzm/following{/other_user}","gists_url":"https://api.github.com/users/schultzm/gists{/gist_id}","starred_url":"https://api.github.com/users/schultzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schultzm/subscriptions","organizations_url":"https://api.github.com/users/schultzm/orgs","repos_url":"https://api.github.com/users/schultzm/repos","events_url":"https://api.github.com/users/schultzm/events{/privacy}","received_events_url":"https://api.github.com/users/schultzm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-30T04:32:21Z","updated_at":"2016-08-31T04:19:41Z","closed_at":"2016-08-30T12:28:00Z","body":"Hi, \r\n\r\nThanks for the software.  It looks like it will be very useful for us.  \r\n\r\nI'm trying to use it to plot an MCC tree with posterior support values overlaid.   In the example below, I create the phybreak object using `phybreak(data, times)`.  I burnin with 1000 cycles and sample for 10000 cycles. \r\n\r\n```\r\nMCMCstate = phybreak(data=core_tab_chrmsm, times=d3)\r\nMCMCstate = burnin.phybreak(MCMCstate, ncycles = 1000)\r\nMCMCstate = sample.phybreak(MCMCstate, nsample=10000, thin=1)\r\n```\r\n\r\nThen, I get the the phylotree() data.frame and tree:\r\n```\r\nphylo_tree_matrix = phylotree(MCMCstate, support = \"proportion\")\r\nphylo_tree = phylotree(MCMCstate, support = \"proportion\", phylo.class = T)\r\n```\r\n\r\nMy aim is to overlay the posterior supports from the phylo_tree_matrix on the phylo_tree, but the `phylo_tree$edge` matrix and the `phylo_tree_matrix$parent` columns are irreconcilable, as can be found when comparing the plot of the tree (with `tiplabels()` and `nodelabels()`) with the following two tables:\r\n\r\n```\r\nplot(phylo_tree)\r\nnodelabels() #these are the blue squares\r\ntiplabels() #these are the yellow squares\r\n```\r\n![screen shot 2016-08-30 at 14 19 03](https://cloud.githubusercontent.com/assets/5474971/18076105/4c90ce26-6ebe-11e6-942f-288c70e13a85.png)\r\n\r\nThat is, the parent-child relationships between the following two tables do not align.  Here is the edge table (the blue squares are column 1 and the yellow squares are column 2):\r\n```\r\n> phylo_tree$edge\r\n      [,1] [,2]\r\n [1,]   26   27\r\n [2,]   27   28\r\n [3,]   28   29\r\n [4,]   29   30\r\n [5,]   30   33\r\n [6,]   33   38\r\n [7,]   38   36\r\n [8,]   36   37\r\n [9,]   37   35\r\n[10,]   35   41\r\n[11,]   41   44\r\n[12,]   44   45\r\n[13,]   45   48\r\n[14,]   48    9\r\n[15,]   48   12\r\n[16,]   45   14\r\n[17,]   44   49\r\n[18,]   49   46\r\n[19,]   46   11\r\n[20,]   46   13\r\n[21,]   49   10\r\n[22,]   41   18\r\n[23,]   35   22\r\n[24,]   37   42\r\n[25,]   42   19\r\n[26,]   42   24\r\n[27,]   36   16\r\n[28,]   38   39\r\n[29,]   39   43\r\n[30,]   43    6\r\n[31,]   43   17\r\n[32,]   39   47\r\n[33,]   47   21\r\n[34,]   47   23\r\n[35,]   33    3\r\n[36,]   30    1\r\n[37,]   29   31\r\n[38,]   31    2\r\n[39,]   31   15\r\n[40,]   28   34\r\n[41,]   34    4\r\n[42,]   34    7\r\n[43,]   27   40\r\n[44,]   40    5\r\n[45,]   40   20\r\n[46,]   26   32\r\n[47,]   32    8\r\n[48,]   32   25\r\n```\r\n\r\n  And here is the data.frame (rows 35, 36, 38, 39, 42, 43, 47 have bad parent-child relationships, where child is the row-name and parent is the corresponding cell value in column 1) :\r\n```\r\n> phylo_tree_matrix\r\n   parent    support node.times.mean node.times.sd node.times.mc.tree\r\n1      30 1.00000000      0.00000000    0.00000000         0.00000000\r\n2      31 1.00000000      0.30000000    0.00000000         0.30000000\r\n3      33 1.00000000      0.40000000    0.00000000         0.40000000\r\n4      34 1.00000000      0.81000000    0.00000000         0.81000000\r\n5      40 1.00000000      0.86000000    0.00000000         0.86000000\r\n6      43 1.00000000      0.90000000    0.00000000         0.90000000\r\n7      34 1.00000000      0.94000000    0.00000000         0.94000000\r\n8      32 1.00000000      1.56000000    0.00000000         1.56000000\r\n9      48 1.00000000      1.88000000    0.00000000         1.88000000\r\n10     49 1.00000000      2.26000000    0.00000000         2.26000000\r\n11     46 1.00000000      2.38000000    0.00000000         2.38000000\r\n12     48 1.00000000      2.52000000    0.00000000         2.52000000\r\n13     46 1.00000000      2.55000000    0.00000000         2.55000000\r\n14     45 1.00000000      2.79000000    0.00000000         2.79000000\r\n15     31 1.00000000      0.71000000    0.00000000         0.71000000\r\n16     38 1.00000000      0.88000000    0.00000000         0.88000000\r\n17     43 1.00000000      0.90000000    0.00000000         0.90000000\r\n18     41 1.00000000      0.90000000    0.00000000         0.90000000\r\n19     42 1.00000000      0.90000000    0.00000000         0.90000000\r\n20     40 1.00000000      0.90000000    0.00000000         0.90000000\r\n21     47 1.00000000      0.91000000    0.00000000         0.91000000\r\n22     35 1.00000000      0.91000000    0.00000000         0.91000000\r\n23     38 1.00000000      0.92000000    0.00000000         0.92000000\r\n24     42 1.00000000      0.92000000    0.00000000         0.92000000\r\n25     32 1.00000000      1.56000000    0.00000000         1.56000000\r\n26      0 1.00000000     -1.51126789    0.90524149        -1.67566591\r\n27     26 0.65118812     -1.42796803    0.61749479        -1.29354997\r\n28     27 0.74316832     -1.11291185    0.59893442        -1.05383677\r\n29     28 0.99732673     -0.49866271    0.39040749        -0.53178046\r\n30     29 0.41752475     -0.29407567    0.17194680        -0.21870728\r\n31     29 0.52405941     -0.21429529    0.25190572        -0.14663459\r\n32     26 0.99940594     -0.04581645    0.65440055        -0.41669197\r\n33     30 0.96425743      0.16568535    0.19175916         0.13751129\r\n34     28 0.99732673     -0.21341553    0.35359052        -0.36316498\r\n35     39 0.09653465      0.78918218    0.07259913         0.78166042\r\n36     33 0.71603960      0.43536170    0.11343933         0.28688438\r\n37     36 0.03366337      0.56681280    0.10266716         0.36312121\r\n38     37 0.08178218      0.63215878    0.11109348         0.76105123\r\n39     37 0.03792079      0.63332049    0.10035708         0.58598696\r\n40     27 0.99930693      0.07795032    0.40078764         0.03305225\r\n41     35 0.21554455      0.88923055    0.01873173         0.89209207\r\n42     39 0.10227723      0.73601620    0.11624829         0.75397219\r\n43     47 0.97485149      0.73915054    0.12418226         0.71125887\r\n44     41 0.80980198      1.28028753    0.26203872         1.01338487\r\n45     44 0.70732673      1.50948099    0.27434150         1.49648718\r\n46     49 0.99782178      2.15139832    0.20358827         1.88874520\r\n47     36 0.06138614      0.50711223    0.31232034         0.48576206\r\n48     45 0.80425743      1.64236086    0.30733507         1.58391568\r\n49     44 0.99930693      1.74499925    0.31908351         1.62513775\r\n\r\n```\r\n\r\nI have seen in http://rpackages.ianhowson.com/cran/phybreak/man/phylotree.html that the phylotree data.frame should be: \"A `data.frame` with per item (=node) its parent and support per clade, and optionally summary node times. The first `n` nodes are the samples, the last `n-1` nodes are the internal nodes.\"  But, still, this does not seem to add up correctly.  \r\n\r\nIs this an error or am I missing something?  Could you please add a feature that adds these posterior support values to the tree (phylo) object `tree$node.label` so that I don't need to manually try to do this myself?  \r\n\r\nAlso, will be adding more to the documentation and providing tutorials?  This would also be very helpful.  \r\n\r\nAll the best, \r\n\r\nMark\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/donkeyshot/phybreak/issues/comments/243654417","html_url":"https://github.com/donkeyshot/phybreak/issues/1#issuecomment-243654417","issue_url":"https://api.github.com/repos/donkeyshot/phybreak/issues/1","id":243654417,"user":{"login":"schultzm","id":5474971,"avatar_url":"https://avatars.githubusercontent.com/u/5474971?v=3","gravatar_id":"","url":"https://api.github.com/users/schultzm","html_url":"https://github.com/schultzm","followers_url":"https://api.github.com/users/schultzm/followers","following_url":"https://api.github.com/users/schultzm/following{/other_user}","gists_url":"https://api.github.com/users/schultzm/gists{/gist_id}","starred_url":"https://api.github.com/users/schultzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schultzm/subscriptions","organizations_url":"https://api.github.com/users/schultzm/orgs","repos_url":"https://api.github.com/users/schultzm/repos","events_url":"https://api.github.com/users/schultzm/events{/privacy}","received_events_url":"https://api.github.com/users/schultzm/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T04:19:41Z","updated_at":"2016-08-31T04:19:41Z","body":"Fixed! Thanks Don.  "}}
{"actor":{"display_login":"schultzm"}}