{"action":"created","issue":{"url":"https://api.github.com/repos/veg/hyphy/issues/576","repository_url":"https://api.github.com/repos/veg/hyphy","labels_url":"https://api.github.com/repos/veg/hyphy/issues/576/labels{/name}","comments_url":"https://api.github.com/repos/veg/hyphy/issues/576/comments","events_url":"https://api.github.com/repos/veg/hyphy/issues/576/events","html_url":"https://github.com/veg/hyphy/issues/576","id":243236972,"number":576,"title":"mapping node index to father node index","user":{"login":"halabikeren","id":16238692,"avatar_url":"https://avatars3.githubusercontent.com/u/16238692?v=4","gravatar_id":"","url":"https://api.github.com/users/halabikeren","html_url":"https://github.com/halabikeren","followers_url":"https://api.github.com/users/halabikeren/followers","following_url":"https://api.github.com/users/halabikeren/following{/other_user}","gists_url":"https://api.github.com/users/halabikeren/gists{/gist_id}","starred_url":"https://api.github.com/users/halabikeren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halabikeren/subscriptions","organizations_url":"https://api.github.com/users/halabikeren/orgs","repos_url":"https://api.github.com/users/halabikeren/repos","events_url":"https://api.github.com/users/halabikeren/events{/privacy}","received_events_url":"https://api.github.com/users/halabikeren/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"spond","id":1018513,"avatar_url":"https://avatars3.githubusercontent.com/u/1018513?v=4","gravatar_id":"","url":"https://api.github.com/users/spond","html_url":"https://github.com/spond","followers_url":"https://api.github.com/users/spond/followers","following_url":"https://api.github.com/users/spond/following{/other_user}","gists_url":"https://api.github.com/users/spond/gists{/gist_id}","starred_url":"https://api.github.com/users/spond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spond/subscriptions","organizations_url":"https://api.github.com/users/spond/orgs","repos_url":"https://api.github.com/users/spond/repos","events_url":"https://api.github.com/users/spond/events{/privacy}","received_events_url":"https://api.github.com/users/spond/received_events","type":"User","site_admin":false},"assignees":[{"login":"spond","id":1018513,"avatar_url":"https://avatars3.githubusercontent.com/u/1018513?v=4","gravatar_id":"","url":"https://api.github.com/users/spond","html_url":"https://github.com/spond","followers_url":"https://api.github.com/users/spond/followers","following_url":"https://api.github.com/users/spond/following{/other_user}","gists_url":"https://api.github.com/users/spond/gists{/gist_id}","starred_url":"https://api.github.com/users/spond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spond/subscriptions","organizations_url":"https://api.github.com/users/spond/orgs","repos_url":"https://api.github.com/users/spond/repos","events_url":"https://api.github.com/users/spond/events{/privacy}","received_events_url":"https://api.github.com/users/spond/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2017-07-16T12:39:05Z","updated_at":"2017-07-19T03:03:53Z","closed_at":null,"body":"Dear Team,\r\n\r\nWe would like to create a map where the keys are node indices (not the post-order traversal indices but rather, the hyphy internal node indices) and the values are father node indices (also internal).\r\nBased on [Art's code example](http://www.hyphy.org/pubs/Nef/MapMutationsToTree.bf), we managed to obtain such a mapping by combining the branch-to-node map with the node-to-fatherTraversalId map. However, we were wondering if there's a more elegant way to achieve this, for example, by traversing the tree, each time going \"up\" a branch, extracting the lower (son) node index and the upper (father) node index and inserting the pair into a map.\r\nWe could not find a direct code for tree traversal (only the result of traversing the tree -- flat).\r\n\r\nThanks and regards,\r\nKeren and Eli "},"comment":{"url":"https://api.github.com/repos/veg/hyphy/issues/comments/316259398","html_url":"https://github.com/veg/hyphy/issues/576#issuecomment-316259398","issue_url":"https://api.github.com/repos/veg/hyphy/issues/576","id":316259398,"user":{"login":"spond","id":1018513,"avatar_url":"https://avatars3.githubusercontent.com/u/1018513?v=4","gravatar_id":"","url":"https://api.github.com/users/spond","html_url":"https://github.com/spond","followers_url":"https://api.github.com/users/spond/followers","following_url":"https://api.github.com/users/spond/following{/other_user}","gists_url":"https://api.github.com/users/spond/gists{/gist_id}","starred_url":"https://api.github.com/users/spond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spond/subscriptions","organizations_url":"https://api.github.com/users/spond/orgs","repos_url":"https://api.github.com/users/spond/repos","events_url":"https://api.github.com/users/spond/events{/privacy}","received_events_url":"https://api.github.com/users/spond/received_events","type":"User","site_admin":false},"created_at":"2017-07-19T03:03:52Z","updated_at":"2017-07-19T03:03:52Z","body":"Dear @halabikeren,\r\n\r\nYou could use something like this. \r\n\r\n```\r\nTree test_tree = ((((Pig:0.147969,Cow:0.213430):0.085099,Horse:0.165787,Cat:0.264806):0.058611,((RhMonkey{PR}:0.002015,Baboon{PR}:0.003108){PR}:0.022733,(Human{PR}:0.004349,Chimp{PR}:0.000799){PR}:0.011873){PR}:0.101856){PR}:0.340802,Rat:0.050958,Mouse:0.097950);\r\n\r\npost_order_dict = test_tree ^ 0;\r\n\r\nfprintf (stdout, post_order_dict);\r\n\r\n/*\r\n\r\n{\r\n \"1\":{\r\n   \"Name\":\"Pig\",\r\n   \"Length\":0.147969,\r\n   \"Depth\":4,\r\n   \"Parent\":3\r\n  },\r\n  \"2\":{\r\n   \"Name\":\"Cow\",\r\n   \"Length\":0.21343,\r\n   \"Depth\":4,\r\n   \"Parent\":3\r\n  },\r\n \"3\":{\r\n   \"Name\":\"Node3\",\r\n   \"Length\":0.08509899999999999,\r\n   \"Depth\":3,\r\n   \"Parent\":6,\r\n   \"Children\":{\r\n     \"0\":1,\r\n     \"1\":2\r\n    }\r\n  }\r\n  ...\r\n*/\r\n\r\nnode_parent_map = {};\r\n\r\nfor (node_index = 1; node_index < Abs (post_order_dict) - 1; node_index += 1) {\r\n    parent_index = (post_order_dict[node_index])[\"Parent\"];\r\n    node_parent_map [ (post_order_dict[node_index])[\"Name\"] ] = (post_order_dict[parent_index])[\"Name\"];\r\n}\r\n\r\nfprintf (stdout, node_parent_map);\r\n\r\n\r\n/*\r\n\r\n{\r\n \"Pig\":\"Node3\",\r\n \"Cow\":\"Node3\",\r\n \"Node3\":\"Node2\",\r\n \"Horse\":\"Node2\",\r\n \"Cat\":\"Node2\",\r\n \"Node2\":\"Node1\",\r\n \"RhMonkey\":\"Node9\",\r\n \"Baboon\":\"Node9\",\r\n \"Node9\":\"Node8\",\r\n \"Human\":\"Node12\",\r\n \"Chimp\":\"Node12\",\r\n \"Node12\":\"Node8\",\r\n \"Node8\":\"Node1\",\r\n \"Node1\":\"Node0\",\r\n \"Rat\":\"Node0\",\r\n \"Mouse\":\"Node0\"\r\n}\r\n\r\n*/\r\n```\r\n\r\nBest,\r\nSergei"}}
{"actor":{"display_login":"spond"}}