{"action":"created","comment":{"url":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments/45010070","id":45010070,"diff_hunk":"@@ -8,14 +8,118 @@\n \n from __future__ import absolute_import, division, print_function\n \n+from functools import partial\n+\n import numpy as np\n+import pandas as pd\n from scipy.special import gammaln\n from scipy.optimize import fmin_powell, minimize_scalar\n \n+import skbio\n from skbio.stats import subsample_counts\n from skbio.util._decorator import experimental\n from skbio.diversity._base import (_validate_counts_vector,\n-                                   _validate_otu_ids_and_tree)\n+                                   _validate_otu_ids_and_tree,\n+                                   _vectorize_counts_and_tree)\n+\n+\n+# need to figure out how to better factor this. as it stands, it's a big\n+# duplication of .__init__.__all__\n+def _get_alpha_diversity_metrics():\n+    return {'ace': skbio.diversity.alpha.ace,\n+            'chao1': skbio.diversity.alpha.chao1,\n+            'chao1_ci': skbio.diversity.alpha.chao1_ci,\n+            'berger_parker_d': berger_parker_d, 'brillouin_d': brillouin_d,\n+            'dominance': dominance, 'doubles': doubles, 'enspie': enspie,\n+            'esty_ci': esty_ci, 'faith_pd': faith_pd,\n+            'fisher_alpha': fisher_alpha, 'goods_coverage': goods_coverage,\n+            'heip_e': heip_e, 'kempton_taylor_q': kempton_taylor_q,\n+            'margalef': margalef, 'mcintosh_d': mcintosh_d,\n+            'mcintosh_e': mcintosh_e, 'menhinick': menhinick,\n+            'michaelis_menten_fit': michaelis_menten_fit,\n+            'observed_otus': observed_otus, 'osd': osd, 'pielou_e': pielou_e,\n+            'robbins': robbins, 'shannon': shannon, 'simpson': simpson,\n+            'simpson_e': simpson_e, 'singles': singles, 'strong': strong,\n+            'gini_index': skbio.diversity.alpha.gini_index,\n+            'lladser_pe': skbio.diversity.alpha.lladser_pe,\n+            'lladser_ci': skbio.diversity.alpha.lladser_ci\n+            }\n+\n+\n+@experimental(as_of=\"0.4.0\")","path":"skbio/diversity/alpha/_base.py","position":null,"original_position":43,"commit_id":"8d28c88a6786f8b2bffe7d98753d68ddc9ea9d58","original_commit_id":"844e813f12cadb31499960ddbd130402b580f056","user":{"login":"gregcaporaso","id":192372,"avatar_url":"https://avatars.githubusercontent.com/u/192372?v=3","gravatar_id":"","url":"https://api.github.com/users/gregcaporaso","html_url":"https://github.com/gregcaporaso","followers_url":"https://api.github.com/users/gregcaporaso/followers","following_url":"https://api.github.com/users/gregcaporaso/following{/other_user}","gists_url":"https://api.github.com/users/gregcaporaso/gists{/gist_id}","starred_url":"https://api.github.com/users/gregcaporaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregcaporaso/subscriptions","organizations_url":"https://api.github.com/users/gregcaporaso/orgs","repos_url":"https://api.github.com/users/gregcaporaso/repos","events_url":"https://api.github.com/users/gregcaporaso/events{/privacy}","received_events_url":"https://api.github.com/users/gregcaporaso/received_events","type":"User","site_admin":false},"body":"done","created_at":"2015-11-17T01:07:05Z","updated_at":"2015-11-17T01:07:05Z","html_url":"https://github.com/biocore/scikit-bio/pull/1040#discussion_r45010070","pull_request_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040","_links":{"self":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments/45010070"},"html":{"href":"https://github.com/biocore/scikit-bio/pull/1040#discussion_r45010070"},"pull_request":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040"}}},"pull_request":{"url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040","id":42083676,"html_url":"https://github.com/biocore/scikit-bio/pull/1040","diff_url":"https://github.com/biocore/scikit-bio/pull/1040.diff","patch_url":"https://github.com/biocore/scikit-bio/pull/1040.patch","issue_url":"https://api.github.com/repos/biocore/scikit-bio/issues/1040","number":1040,"state":"open","locked":false,"title":"Fast UniFrac","user":{"login":"wasade","id":474290,"avatar_url":"https://avatars.githubusercontent.com/u/474290?v=3","gravatar_id":"","url":"https://api.github.com/users/wasade","html_url":"https://github.com/wasade","followers_url":"https://api.github.com/users/wasade/followers","following_url":"https://api.github.com/users/wasade/following{/other_user}","gists_url":"https://api.github.com/users/wasade/gists{/gist_id}","starred_url":"https://api.github.com/users/wasade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wasade/subscriptions","organizations_url":"https://api.github.com/users/wasade/orgs","repos_url":"https://api.github.com/users/wasade/repos","events_url":"https://api.github.com/users/wasade/events{/privacy}","received_events_url":"https://api.github.com/users/wasade/received_events","type":"User","site_admin":false},"body":"Laying the ground work for a Fast UniFrac implementation in scikit-bio. Right now, the code appears to work for unweighted UniFrac in a couple of one-off tests. Weighted still has some tinkering with. For the most part, all I've done is pulled out the minimal set of functionality from PyCogent based on observed function calls, and done some general maintenance to get the code to operate with scikit-bio's `TreeNode`. \r\n\r\nThere is a lot left to do (outlining below). A review is not necessary at this time. It is not assured that this PR will be merged once the code is in shape as that is contingent on benchmarking. The algorithm that backs Fast UniFrac should offer a reasonable performance benefit over UniFrac, the downside being that the code is more complex. If this gets merged it may make sense to adopt a strategy similar to the aligners where there is an educational implementation with an `EfficiencyWarning` and a more performing one that is recommended for general use.\r\n\r\n- [x] adapt weighted unifrac code\r\n- [x] adapt PD\r\n- [x] tie into the unifrac interface defined in #1027\r\n- [x] tie into the test code defined in #1027\r\n- [x] tie PD into test code defined in #1027 \r\n- [x] benchmark against educational implementation (see [here](https://github.com/wasade/yummy-octo-duck/blob/master/ipynb/UniFrac%20benchmarking.ipynb))\r\n- [x] benchmark against QIIME\r\n\r\nIf the benchmarks pan out, then the next (minimal) steps necessary are:\r\n\r\n- [x] profile, as there may be hotspots given the time since the original implementation\r\n- [x] optimize unweighted unifrac\r\n- [x] optimize weighted unifrac\r\n- [x] continue optimization of normalized weighted unifrac (currently ~10x slower than weighted)\r\n- [x] optimize faith's pd\r\n- [x] implement a driver for Faith's PD and other alpha diversity metrics that can compute samples at once (``skbio.diversity.alpha.alpha_diversity``)\r\n- [x] add stability decorators\r\n- [x] refresh docstrings to be in numpydoc\r\n- [x] include examples in the docstrings\r\n- [x] optimize implementation to the API\r\n- [x] migrate PD method call from `skbio.diversity.beta` to `skbio.diversity.alpha`\r\n- [x] create new issue to implement a block distance matrix method, linking to @wasade's stubbed out example (#1181)\r\n- [ ] squash commits (all of @wasade's commits should be squashed to one, and then all of @gregcaporaso's commits should be squashed to one, to ensure proper attribution since both of us spent a lot of time on this one)\r\n- [x] changelog mention\r\n","created_at":"2015-08-11T01:16:19Z","updated_at":"2015-11-17T01:07:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38ecfc70f197894b288ffec26b4f7b015a2b2d17","assignee":{"login":"gregcaporaso","id":192372,"avatar_url":"https://avatars.githubusercontent.com/u/192372?v=3","gravatar_id":"","url":"https://api.github.com/users/gregcaporaso","html_url":"https://github.com/gregcaporaso","followers_url":"https://api.github.com/users/gregcaporaso/followers","following_url":"https://api.github.com/users/gregcaporaso/following{/other_user}","gists_url":"https://api.github.com/users/gregcaporaso/gists{/gist_id}","starred_url":"https://api.github.com/users/gregcaporaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregcaporaso/subscriptions","organizations_url":"https://api.github.com/users/gregcaporaso/orgs","repos_url":"https://api.github.com/users/gregcaporaso/repos","events_url":"https://api.github.com/users/gregcaporaso/events{/privacy}","received_events_url":"https://api.github.com/users/gregcaporaso/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/biocore/scikit-bio/milestones/14","html_url":"https://github.com/biocore/scikit-bio/milestones/0.4.1","labels_url":"https://api.github.com/repos/biocore/scikit-bio/milestones/14/labels","id":1389454,"number":14,"title":"0.4.1","description":"This release will have Python 2 and Python 3 support. ","creator":{"login":"gregcaporaso","id":192372,"avatar_url":"https://avatars.githubusercontent.com/u/192372?v=3","gravatar_id":"","url":"https://api.github.com/users/gregcaporaso","html_url":"https://github.com/gregcaporaso","followers_url":"https://api.github.com/users/gregcaporaso/followers","following_url":"https://api.github.com/users/gregcaporaso/following{/other_user}","gists_url":"https://api.github.com/users/gregcaporaso/gists{/gist_id}","starred_url":"https://api.github.com/users/gregcaporaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregcaporaso/subscriptions","organizations_url":"https://api.github.com/users/gregcaporaso/orgs","repos_url":"https://api.github.com/users/gregcaporaso/repos","events_url":"https://api.github.com/users/gregcaporaso/events{/privacy}","received_events_url":"https://api.github.com/users/gregcaporaso/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":5,"state":"open","created_at":"2015-11-02T17:11:28Z","updated_at":"2015-11-12T21:31:06Z","due_on":"2015-12-09T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040/commits","review_comments_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040/comments","review_comment_url":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biocore/scikit-bio/issues/1040/comments","statuses_url":"https://api.github.com/repos/biocore/scikit-bio/statuses/8d28c88a6786f8b2bffe7d98753d68ddc9ea9d58","head":{"label":"wasade:fast_unifrac","ref":"fast_unifrac","sha":"8d28c88a6786f8b2bffe7d98753d68ddc9ea9d58","user":{"login":"wasade","id":474290,"avatar_url":"https://avatars.githubusercontent.com/u/474290?v=3","gravatar_id":"","url":"https://api.github.com/users/wasade","html_url":"https://github.com/wasade","followers_url":"https://api.github.com/users/wasade/followers","following_url":"https://api.github.com/users/wasade/following{/other_user}","gists_url":"https://api.github.com/users/wasade/gists{/gist_id}","starred_url":"https://api.github.com/users/wasade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wasade/subscriptions","organizations_url":"https://api.github.com/users/wasade/orgs","repos_url":"https://api.github.com/users/wasade/repos","events_url":"https://api.github.com/users/wasade/events{/privacy}","received_events_url":"https://api.github.com/users/wasade/received_events","type":"User","site_admin":false},"repo":{"id":17808144,"name":"scikit-bio","full_name":"wasade/scikit-bio","owner":{"login":"wasade","id":474290,"avatar_url":"https://avatars.githubusercontent.com/u/474290?v=3","gravatar_id":"","url":"https://api.github.com/users/wasade","html_url":"https://github.com/wasade","followers_url":"https://api.github.com/users/wasade/followers","following_url":"https://api.github.com/users/wasade/following{/other_user}","gists_url":"https://api.github.com/users/wasade/gists{/gist_id}","starred_url":"https://api.github.com/users/wasade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wasade/subscriptions","organizations_url":"https://api.github.com/users/wasade/orgs","repos_url":"https://api.github.com/users/wasade/repos","events_url":"https://api.github.com/users/wasade/events{/privacy}","received_events_url":"https://api.github.com/users/wasade/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wasade/scikit-bio","description":"Core objects, functions and statistics for working with biological data in Python.","fork":true,"url":"https://api.github.com/repos/wasade/scikit-bio","forks_url":"https://api.github.com/repos/wasade/scikit-bio/forks","keys_url":"https://api.github.com/repos/wasade/scikit-bio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wasade/scikit-bio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wasade/scikit-bio/teams","hooks_url":"https://api.github.com/repos/wasade/scikit-bio/hooks","issue_events_url":"https://api.github.com/repos/wasade/scikit-bio/issues/events{/number}","events_url":"https://api.github.com/repos/wasade/scikit-bio/events","assignees_url":"https://api.github.com/repos/wasade/scikit-bio/assignees{/user}","branches_url":"https://api.github.com/repos/wasade/scikit-bio/branches{/branch}","tags_url":"https://api.github.com/repos/wasade/scikit-bio/tags","blobs_url":"https://api.github.com/repos/wasade/scikit-bio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wasade/scikit-bio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wasade/scikit-bio/git/refs{/sha}","trees_url":"https://api.github.com/repos/wasade/scikit-bio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wasade/scikit-bio/statuses/{sha}","languages_url":"https://api.github.com/repos/wasade/scikit-bio/languages","stargazers_url":"https://api.github.com/repos/wasade/scikit-bio/stargazers","contributors_url":"https://api.github.com/repos/wasade/scikit-bio/contributors","subscribers_url":"https://api.github.com/repos/wasade/scikit-bio/subscribers","subscription_url":"https://api.github.com/repos/wasade/scikit-bio/subscription","commits_url":"https://api.github.com/repos/wasade/scikit-bio/commits{/sha}","git_commits_url":"https://api.github.com/repos/wasade/scikit-bio/git/commits{/sha}","comments_url":"https://api.github.com/repos/wasade/scikit-bio/comments{/number}","issue_comment_url":"https://api.github.com/repos/wasade/scikit-bio/issues/comments{/number}","contents_url":"https://api.github.com/repos/wasade/scikit-bio/contents/{+path}","compare_url":"https://api.github.com/repos/wasade/scikit-bio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wasade/scikit-bio/merges","archive_url":"https://api.github.com/repos/wasade/scikit-bio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wasade/scikit-bio/downloads","issues_url":"https://api.github.com/repos/wasade/scikit-bio/issues{/number}","pulls_url":"https://api.github.com/repos/wasade/scikit-bio/pulls{/number}","milestones_url":"https://api.github.com/repos/wasade/scikit-bio/milestones{/number}","notifications_url":"https://api.github.com/repos/wasade/scikit-bio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wasade/scikit-bio/labels{/name}","releases_url":"https://api.github.com/repos/wasade/scikit-bio/releases{/id}","created_at":"2014-03-16T20:13:28Z","updated_at":"2014-06-25T14:53:19Z","pushed_at":"2015-11-17T01:05:50Z","git_url":"git://github.com/wasade/scikit-bio.git","ssh_url":"git@github.com:wasade/scikit-bio.git","clone_url":"https://github.com/wasade/scikit-bio.git","svn_url":"https://github.com/wasade/scikit-bio","homepage":"https://github.com/biocore/scikit-bio","size":20378,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"biocore:master","ref":"master","sha":"450dd55438041525a829d5ec5c341f5876c71e7e","user":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"repo":{"id":15168264,"name":"scikit-bio","full_name":"biocore/scikit-bio","owner":{"login":"biocore","id":6241857,"avatar_url":"https://avatars.githubusercontent.com/u/6241857?v=3","gravatar_id":"","url":"https://api.github.com/users/biocore","html_url":"https://github.com/biocore","followers_url":"https://api.github.com/users/biocore/followers","following_url":"https://api.github.com/users/biocore/following{/other_user}","gists_url":"https://api.github.com/users/biocore/gists{/gist_id}","starred_url":"https://api.github.com/users/biocore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biocore/subscriptions","organizations_url":"https://api.github.com/users/biocore/orgs","repos_url":"https://api.github.com/users/biocore/repos","events_url":"https://api.github.com/users/biocore/events{/privacy}","received_events_url":"https://api.github.com/users/biocore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biocore/scikit-bio","description":"scikit-bio is an open-source, BSD-licensed, Python package providing data structures, algorithms, and educational resources for bioinformatics.","fork":false,"url":"https://api.github.com/repos/biocore/scikit-bio","forks_url":"https://api.github.com/repos/biocore/scikit-bio/forks","keys_url":"https://api.github.com/repos/biocore/scikit-bio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biocore/scikit-bio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biocore/scikit-bio/teams","hooks_url":"https://api.github.com/repos/biocore/scikit-bio/hooks","issue_events_url":"https://api.github.com/repos/biocore/scikit-bio/issues/events{/number}","events_url":"https://api.github.com/repos/biocore/scikit-bio/events","assignees_url":"https://api.github.com/repos/biocore/scikit-bio/assignees{/user}","branches_url":"https://api.github.com/repos/biocore/scikit-bio/branches{/branch}","tags_url":"https://api.github.com/repos/biocore/scikit-bio/tags","blobs_url":"https://api.github.com/repos/biocore/scikit-bio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biocore/scikit-bio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biocore/scikit-bio/git/refs{/sha}","trees_url":"https://api.github.com/repos/biocore/scikit-bio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biocore/scikit-bio/statuses/{sha}","languages_url":"https://api.github.com/repos/biocore/scikit-bio/languages","stargazers_url":"https://api.github.com/repos/biocore/scikit-bio/stargazers","contributors_url":"https://api.github.com/repos/biocore/scikit-bio/contributors","subscribers_url":"https://api.github.com/repos/biocore/scikit-bio/subscribers","subscription_url":"https://api.github.com/repos/biocore/scikit-bio/subscription","commits_url":"https://api.github.com/repos/biocore/scikit-bio/commits{/sha}","git_commits_url":"https://api.github.com/repos/biocore/scikit-bio/git/commits{/sha}","comments_url":"https://api.github.com/repos/biocore/scikit-bio/comments{/number}","issue_comment_url":"https://api.github.com/repos/biocore/scikit-bio/issues/comments{/number}","contents_url":"https://api.github.com/repos/biocore/scikit-bio/contents/{+path}","compare_url":"https://api.github.com/repos/biocore/scikit-bio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biocore/scikit-bio/merges","archive_url":"https://api.github.com/repos/biocore/scikit-bio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biocore/scikit-bio/downloads","issues_url":"https://api.github.com/repos/biocore/scikit-bio/issues{/number}","pulls_url":"https://api.github.com/repos/biocore/scikit-bio/pulls{/number}","milestones_url":"https://api.github.com/repos/biocore/scikit-bio/milestones{/number}","notifications_url":"https://api.github.com/repos/biocore/scikit-bio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biocore/scikit-bio/labels{/name}","releases_url":"https://api.github.com/repos/biocore/scikit-bio/releases{/id}","created_at":"2013-12-13T16:24:41Z","updated_at":"2015-11-11T19:43:52Z","pushed_at":"2015-11-17T01:05:51Z","git_url":"git://github.com/biocore/scikit-bio.git","ssh_url":"git@github.com:biocore/scikit-bio.git","clone_url":"https://github.com/biocore/scikit-bio.git","svn_url":"https://github.com/biocore/scikit-bio","homepage":"http://scikit-bio.org","size":42235,"stargazers_count":170,"watchers_count":170,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":88,"mirror_url":null,"open_issues_count":158,"forks":88,"open_issues":158,"watchers":170,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040"},"html":{"href":"https://github.com/biocore/scikit-bio/pull/1040"},"issue":{"href":"https://api.github.com/repos/biocore/scikit-bio/issues/1040"},"comments":{"href":"https://api.github.com/repos/biocore/scikit-bio/issues/1040/comments"},"review_comments":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040/comments"},"review_comment":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biocore/scikit-bio/pulls/1040/commits"},"statuses":{"href":"https://api.github.com/repos/biocore/scikit-bio/statuses/8d28c88a6786f8b2bffe7d98753d68ddc9ea9d58"}}}}