{"action":"opened","issue":{"url":"https://api.github.com/repos/naturalis/supersmart/issues/74","labels_url":"https://api.github.com/repos/naturalis/supersmart/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/naturalis/supersmart/issues/74/comments","events_url":"https://api.github.com/repos/naturalis/supersmart/issues/74/events","html_url":"https://github.com/naturalis/supersmart/issues/74","id":93812070,"number":74,"title":"Speeding up re-rooting","user":{"login":"rvosa","id":106490,"avatar_url":"https://avatars.githubusercontent.com/u/106490?v=3","gravatar_id":"","url":"https://api.github.com/users/rvosa","html_url":"https://github.com/rvosa","followers_url":"https://api.github.com/users/rvosa/followers","following_url":"https://api.github.com/users/rvosa/following{/other_user}","gists_url":"https://api.github.com/users/rvosa/gists{/gist_id}","starred_url":"https://api.github.com/users/rvosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvosa/subscriptions","organizations_url":"https://api.github.com/users/rvosa/orgs","repos_url":"https://api.github.com/users/rvosa/repos","events_url":"https://api.github.com/users/rvosa/events{/privacy}","received_events_url":"https://api.github.com/users/rvosa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/naturalis/supersmart/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/naturalis/supersmart/milestones/2","html_url":"https://github.com/naturalis/supersmart/milestones/v2.0","labels_url":"https://api.github.com/repos/naturalis/supersmart/milestones/2/labels","id":1065159,"number":2,"title":"v2.0","description":"Milestone for all the enhancements that are deferred till after v1.0. For now this may become a gathering place for all blue sky thinking about things such as:\r\n* automatic harvesting of fossil calibrations through a web service API: this functionality simply doesn't exist yet so there is no client for us to write.\r\n* recursive inference: this constitutes a pretty big enhancement/rewrite which we don't yet need for the scale at which we are working now, but it'll become important later down the line.\r\n* inclusion of NGS data: too much work for now, defer.","creator":{"login":"rvosa","id":106490,"avatar_url":"https://avatars.githubusercontent.com/u/106490?v=3","gravatar_id":"","url":"https://api.github.com/users/rvosa","html_url":"https://github.com/rvosa","followers_url":"https://api.github.com/users/rvosa/followers","following_url":"https://api.github.com/users/rvosa/following{/other_user}","gists_url":"https://api.github.com/users/rvosa/gists{/gist_id}","starred_url":"https://api.github.com/users/rvosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvosa/subscriptions","organizations_url":"https://api.github.com/users/rvosa/orgs","repos_url":"https://api.github.com/users/rvosa/repos","events_url":"https://api.github.com/users/rvosa/events{/privacy}","received_events_url":"https://api.github.com/users/rvosa/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":4,"state":"open","created_at":"2015-04-13T14:26:30Z","updated_at":"2015-07-08T15:01:10Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-07-08T15:01:10Z","updated_at":"2015-07-08T15:01:10Z","closed_at":null,"body":"`smrt bbreroot` takes a bit too long for my taste. I think we can speed it up at least in the following ways:\r\n\r\n- collapse the set of trees into distinct topologies and only reroot those. A number of different considerations come into play here: i) do all the tools that create sets of trees ladderize them in the same order? It might make sense to ensure that the InferenceService classes all do this uniformly so that topological identity could be discovered by simple string comparisons, ii) how to deal with identical topologies that have different branch lengths. Would it indeed be faster to reroot once for each topology and then apply the respective branch length patterns?\r\n\r\n- by parallelization. However, the right tree order must be retained, so it would have to be something like:\r\n\r\n```perl\r\n    my $i = 0;\r\n    my @sorted = map { $_->[1] } # fetch and return second element\r\n        # sort numerically on the first element\r\n        sort { $a->[0] <=> $b->[0] } \r\n        # do the rerooting on each second element, i.e. the tree object\r\n        pmap { reroot($_->[1]) } \r\n        # assign rank order to each tree using 2-element array refs\r\n        map { [ $i++, $_ ] } @trees;\r\n```"}}