{"action":"created","comment":{"url":"https://api.github.com/repos/ged-lab/khmer/pulls/comments/23345523","id":23345523,"diff_hunk":"@@ -93,5 +94,66 @@ std::string _revhash(HashIntoType hash, WordLength k)\n     return s;\n }\n \n+std::string _revcomp(const std::string& kmer)\n+{\n+    std::string out = kmer;\n+    size_t ksize = out.size();\n+\n+    for (int i=0; i < ksize; ++i) {\n+        char complement;\n+\n+        switch(kmer[i]) {\n+        case 'A':\n+            complement = 'T';\n+            break;\n+        case 'C':\n+            complement = 'G';\n+            break;\n+        case 'G':\n+            complement = 'C';\n+            break;\n+        case 'T':\n+            complement = 'A';\n+            break;\n+        default:\n+            throw khmer::khmer_exception(\"Invalid base in read\");\n+            break;\n+        }\n+        out[ksize - i - 1] = complement;\n+    }\n+    return out;\n+}\n+\n+HashIntoType _hash_murmur(const std::string& kmer)\n+{\n+    HashIntoType h = 0;\n+    HashIntoType r = 0;\n+\n+    return khmer::_hash_murmur(kmer, h, r);\n+}\n+\n+HashIntoType _hash_murmur(const std::string& kmer,\n+                          HashIntoType& h, HashIntoType& r)\n+{\n+    HashIntoType out[2];\n+    uint32_t seed = 0;\n+    MurmurHash3_x64_128((void *)kmer.c_str(), kmer.size(), seed, &out);\n+    h = out[0];\n+\n+    std::string rev = khmer::_revcomp(kmer);\n+    MurmurHash3_x64_128((void *)rev.c_str(), rev.size(), seed, &out);","path":"lib/kmer_hash.cc","position":67,"original_position":67,"commit_id":"57f2aa01efd563038316e0019aa4bbd427038d23","original_commit_id":"57f2aa01efd563038316e0019aa4bbd427038d23","user":{"login":"mr-c","id":1330696,"avatar_url":"https://avatars.githubusercontent.com/u/1330696?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-c","html_url":"https://github.com/mr-c","followers_url":"https://api.github.com/users/mr-c/followers","following_url":"https://api.github.com/users/mr-c/following{/other_user}","gists_url":"https://api.github.com/users/mr-c/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-c/subscriptions","organizations_url":"https://api.github.com/users/mr-c/orgs","repos_url":"https://api.github.com/users/mr-c/repos","events_url":"https://api.github.com/users/mr-c/events{/privacy}","received_events_url":"https://api.github.com/users/mr-c/received_events","type":"User","site_admin":false},"body":"`implicit conversion loses integer precision: 'size_type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]`","created_at":"2015-01-21T23:55:43Z","updated_at":"2015-01-21T23:55:43Z","html_url":"https://github.com/ged-lab/khmer/pull/257#discussion_r23345523","pull_request_url":"https://api.github.com/repos/ged-lab/khmer/pulls/257","_links":{"self":{"href":"https://api.github.com/repos/ged-lab/khmer/pulls/comments/23345523"},"html":{"href":"https://github.com/ged-lab/khmer/pull/257#discussion_r23345523"},"pull_request":{"href":"https://api.github.com/repos/ged-lab/khmer/pulls/257"}}},"pull_request":{"url":"https://api.github.com/repos/ged-lab/khmer/pulls/257","id":11511689,"html_url":"https://github.com/ged-lab/khmer/pull/257","diff_url":"https://github.com/ged-lab/khmer/pull/257.diff","patch_url":"https://github.com/ged-lab/khmer/pull/257.patch","issue_url":"https://api.github.com/repos/ged-lab/khmer/issues/257","number":257,"state":"open","locked":false,"title":"HyperLogLog Counter","user":{"login":"luizirber","id":6642,"avatar_url":"https://avatars.githubusercontent.com/u/6642?v=3","gravatar_id":"","url":"https://api.github.com/users/luizirber","html_url":"https://github.com/luizirber","followers_url":"https://api.github.com/users/luizirber/followers","following_url":"https://api.github.com/users/luizirber/following{/other_user}","gists_url":"https://api.github.com/users/luizirber/gists{/gist_id}","starred_url":"https://api.github.com/users/luizirber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luizirber/subscriptions","organizations_url":"https://api.github.com/users/luizirber/orgs","repos_url":"https://api.github.com/users/luizirber/repos","events_url":"https://api.github.com/users/luizirber/events{/privacy}","received_events_url":"https://api.github.com/users/luizirber/received_events","type":"User","site_admin":false},"body":"# HyperLogLog Counter\r\n\r\nThis implements #233. A HyperLogLog counter is a probabilistic counter capable of cardinality estimation (how many unique elements appears in a dataset) with very low memory consumption. In khmer it can be useful to give better guesses for hash size parameters (-x and -N).\r\n\r\n## References\r\n\r\n- svpcom/hyperloglog@f91ed5db8ca8f4cf7b364f2a54dd89e0a125a699\r\n-  http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf\r\n-  http://research.google.com/pubs/pub40671.html\r\n\r\n## TODO\r\n\r\n- [x] add tests\r\n- [x] implement Google paper suggestion (64 bits hash function, bias correction)\r\n    \r\n    Kinda done. Using a 64-bits SHA-1 or MurmurHash3, but should rerun bias correction analysis from paper for new constants. For now they work reasonably well.\r\n\r\n- [x] ask @mr-c and @camillescott about the right way to implement extensions\r\n- [x] think more about get_rho function\r\n- [x] parallel reading and HLL merges for better performance\r\n- [x] put constants in a separate header","created_at":"2014-01-14T21:30:17Z","updated_at":"2015-01-21T23:55:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad20b8368a32a1b0dee9cc25637d0d605db3d52e","assignee":{"login":"luizirber","id":6642,"avatar_url":"https://avatars.githubusercontent.com/u/6642?v=3","gravatar_id":"","url":"https://api.github.com/users/luizirber","html_url":"https://github.com/luizirber","followers_url":"https://api.github.com/users/luizirber/followers","following_url":"https://api.github.com/users/luizirber/following{/other_user}","gists_url":"https://api.github.com/users/luizirber/gists{/gist_id}","starred_url":"https://api.github.com/users/luizirber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luizirber/subscriptions","organizations_url":"https://api.github.com/users/luizirber/orgs","repos_url":"https://api.github.com/users/luizirber/repos","events_url":"https://api.github.com/users/luizirber/events{/privacy}","received_events_url":"https://api.github.com/users/luizirber/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ged-lab/khmer/milestones/12","labels_url":"https://api.github.com/repos/ged-lab/khmer/milestones/12/labels","id":739801,"number":12,"title":"1.3+","description":"","creator":{"login":"mr-c","id":1330696,"avatar_url":"https://avatars.githubusercontent.com/u/1330696?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-c","html_url":"https://github.com/mr-c","followers_url":"https://api.github.com/users/mr-c/followers","following_url":"https://api.github.com/users/mr-c/following{/other_user}","gists_url":"https://api.github.com/users/mr-c/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-c/subscriptions","organizations_url":"https://api.github.com/users/mr-c/orgs","repos_url":"https://api.github.com/users/mr-c/repos","events_url":"https://api.github.com/users/mr-c/events{/privacy}","received_events_url":"https://api.github.com/users/mr-c/received_events","type":"User","site_admin":false},"open_issues":70,"closed_issues":6,"state":"open","created_at":"2014-08-01T14:28:22Z","updated_at":"2015-01-19T19:34:33Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/ged-lab/khmer/pulls/257/commits","review_comments_url":"https://api.github.com/repos/ged-lab/khmer/pulls/257/comments","review_comment_url":"https://api.github.com/repos/ged-lab/khmer/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ged-lab/khmer/issues/257/comments","statuses_url":"https://api.github.com/repos/ged-lab/khmer/statuses/57f2aa01efd563038316e0019aa4bbd427038d23","head":{"label":"ged-lab:feature/hll-counter","ref":"feature/hll-counter","sha":"57f2aa01efd563038316e0019aa4bbd427038d23","user":{"login":"ged-lab","id":1740697,"avatar_url":"https://avatars.githubusercontent.com/u/1740697?v=3","gravatar_id":"","url":"https://api.github.com/users/ged-lab","html_url":"https://github.com/ged-lab","followers_url":"https://api.github.com/users/ged-lab/followers","following_url":"https://api.github.com/users/ged-lab/following{/other_user}","gists_url":"https://api.github.com/users/ged-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/ged-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ged-lab/subscriptions","organizations_url":"https://api.github.com/users/ged-lab/orgs","repos_url":"https://api.github.com/users/ged-lab/repos","events_url":"https://api.github.com/users/ged-lab/events{/privacy}","received_events_url":"https://api.github.com/users/ged-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":4331833,"name":"khmer","full_name":"ged-lab/khmer","owner":{"login":"ged-lab","id":1740697,"avatar_url":"https://avatars.githubusercontent.com/u/1740697?v=3","gravatar_id":"","url":"https://api.github.com/users/ged-lab","html_url":"https://github.com/ged-lab","followers_url":"https://api.github.com/users/ged-lab/followers","following_url":"https://api.github.com/users/ged-lab/following{/other_user}","gists_url":"https://api.github.com/users/ged-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/ged-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ged-lab/subscriptions","organizations_url":"https://api.github.com/users/ged-lab/orgs","repos_url":"https://api.github.com/users/ged-lab/repos","events_url":"https://api.github.com/users/ged-lab/events{/privacy}","received_events_url":"https://api.github.com/users/ged-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ged-lab/khmer","description":"In-memory nucleotide sequence k-mer counting, filtering, graph traversal and more","fork":false,"url":"https://api.github.com/repos/ged-lab/khmer","forks_url":"https://api.github.com/repos/ged-lab/khmer/forks","keys_url":"https://api.github.com/repos/ged-lab/khmer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ged-lab/khmer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ged-lab/khmer/teams","hooks_url":"https://api.github.com/repos/ged-lab/khmer/hooks","issue_events_url":"https://api.github.com/repos/ged-lab/khmer/issues/events{/number}","events_url":"https://api.github.com/repos/ged-lab/khmer/events","assignees_url":"https://api.github.com/repos/ged-lab/khmer/assignees{/user}","branches_url":"https://api.github.com/repos/ged-lab/khmer/branches{/branch}","tags_url":"https://api.github.com/repos/ged-lab/khmer/tags","blobs_url":"https://api.github.com/repos/ged-lab/khmer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ged-lab/khmer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ged-lab/khmer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ged-lab/khmer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ged-lab/khmer/statuses/{sha}","languages_url":"https://api.github.com/repos/ged-lab/khmer/languages","stargazers_url":"https://api.github.com/repos/ged-lab/khmer/stargazers","contributors_url":"https://api.github.com/repos/ged-lab/khmer/contributors","subscribers_url":"https://api.github.com/repos/ged-lab/khmer/subscribers","subscription_url":"https://api.github.com/repos/ged-lab/khmer/subscription","commits_url":"https://api.github.com/repos/ged-lab/khmer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ged-lab/khmer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ged-lab/khmer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ged-lab/khmer/issues/comments/{number}","contents_url":"https://api.github.com/repos/ged-lab/khmer/contents/{+path}","compare_url":"https://api.github.com/repos/ged-lab/khmer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ged-lab/khmer/merges","archive_url":"https://api.github.com/repos/ged-lab/khmer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ged-lab/khmer/downloads","issues_url":"https://api.github.com/repos/ged-lab/khmer/issues{/number}","pulls_url":"https://api.github.com/repos/ged-lab/khmer/pulls{/number}","milestones_url":"https://api.github.com/repos/ged-lab/khmer/milestones{/number}","notifications_url":"https://api.github.com/repos/ged-lab/khmer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ged-lab/khmer/labels{/name}","releases_url":"https://api.github.com/repos/ged-lab/khmer/releases{/id}","created_at":"2012-05-15T03:52:53Z","updated_at":"2015-01-20T02:07:01Z","pushed_at":"2015-01-21T23:35:01Z","git_url":"git://github.com/ged-lab/khmer.git","ssh_url":"git@github.com:ged-lab/khmer.git","clone_url":"https://github.com/ged-lab/khmer.git","svn_url":"https://github.com/ged-lab/khmer","homepage":"http://khmer.readthedocs.org/","size":147343,"stargazers_count":194,"watchers_count":194,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":146,"mirror_url":null,"open_issues_count":210,"forks":146,"open_issues":210,"watchers":194,"default_branch":"master"}},"base":{"label":"ged-lab:master","ref":"master","sha":"a61db952776b2d5c350d04a5a0d980ba3049b522","user":{"login":"ged-lab","id":1740697,"avatar_url":"https://avatars.githubusercontent.com/u/1740697?v=3","gravatar_id":"","url":"https://api.github.com/users/ged-lab","html_url":"https://github.com/ged-lab","followers_url":"https://api.github.com/users/ged-lab/followers","following_url":"https://api.github.com/users/ged-lab/following{/other_user}","gists_url":"https://api.github.com/users/ged-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/ged-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ged-lab/subscriptions","organizations_url":"https://api.github.com/users/ged-lab/orgs","repos_url":"https://api.github.com/users/ged-lab/repos","events_url":"https://api.github.com/users/ged-lab/events{/privacy}","received_events_url":"https://api.github.com/users/ged-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":4331833,"name":"khmer","full_name":"ged-lab/khmer","owner":{"login":"ged-lab","id":1740697,"avatar_url":"https://avatars.githubusercontent.com/u/1740697?v=3","gravatar_id":"","url":"https://api.github.com/users/ged-lab","html_url":"https://github.com/ged-lab","followers_url":"https://api.github.com/users/ged-lab/followers","following_url":"https://api.github.com/users/ged-lab/following{/other_user}","gists_url":"https://api.github.com/users/ged-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/ged-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ged-lab/subscriptions","organizations_url":"https://api.github.com/users/ged-lab/orgs","repos_url":"https://api.github.com/users/ged-lab/repos","events_url":"https://api.github.com/users/ged-lab/events{/privacy}","received_events_url":"https://api.github.com/users/ged-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ged-lab/khmer","description":"In-memory nucleotide sequence k-mer counting, filtering, graph traversal and more","fork":false,"url":"https://api.github.com/repos/ged-lab/khmer","forks_url":"https://api.github.com/repos/ged-lab/khmer/forks","keys_url":"https://api.github.com/repos/ged-lab/khmer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ged-lab/khmer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ged-lab/khmer/teams","hooks_url":"https://api.github.com/repos/ged-lab/khmer/hooks","issue_events_url":"https://api.github.com/repos/ged-lab/khmer/issues/events{/number}","events_url":"https://api.github.com/repos/ged-lab/khmer/events","assignees_url":"https://api.github.com/repos/ged-lab/khmer/assignees{/user}","branches_url":"https://api.github.com/repos/ged-lab/khmer/branches{/branch}","tags_url":"https://api.github.com/repos/ged-lab/khmer/tags","blobs_url":"https://api.github.com/repos/ged-lab/khmer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ged-lab/khmer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ged-lab/khmer/git/refs{/sha}","trees_url":"https://api.github.com/repos/ged-lab/khmer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ged-lab/khmer/statuses/{sha}","languages_url":"https://api.github.com/repos/ged-lab/khmer/languages","stargazers_url":"https://api.github.com/repos/ged-lab/khmer/stargazers","contributors_url":"https://api.github.com/repos/ged-lab/khmer/contributors","subscribers_url":"https://api.github.com/repos/ged-lab/khmer/subscribers","subscription_url":"https://api.github.com/repos/ged-lab/khmer/subscription","commits_url":"https://api.github.com/repos/ged-lab/khmer/commits{/sha}","git_commits_url":"https://api.github.com/repos/ged-lab/khmer/git/commits{/sha}","comments_url":"https://api.github.com/repos/ged-lab/khmer/comments{/number}","issue_comment_url":"https://api.github.com/repos/ged-lab/khmer/issues/comments/{number}","contents_url":"https://api.github.com/repos/ged-lab/khmer/contents/{+path}","compare_url":"https://api.github.com/repos/ged-lab/khmer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ged-lab/khmer/merges","archive_url":"https://api.github.com/repos/ged-lab/khmer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ged-lab/khmer/downloads","issues_url":"https://api.github.com/repos/ged-lab/khmer/issues{/number}","pulls_url":"https://api.github.com/repos/ged-lab/khmer/pulls{/number}","milestones_url":"https://api.github.com/repos/ged-lab/khmer/milestones{/number}","notifications_url":"https://api.github.com/repos/ged-lab/khmer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ged-lab/khmer/labels{/name}","releases_url":"https://api.github.com/repos/ged-lab/khmer/releases{/id}","created_at":"2012-05-15T03:52:53Z","updated_at":"2015-01-20T02:07:01Z","pushed_at":"2015-01-21T23:35:01Z","git_url":"git://github.com/ged-lab/khmer.git","ssh_url":"git@github.com:ged-lab/khmer.git","clone_url":"https://github.com/ged-lab/khmer.git","svn_url":"https://github.com/ged-lab/khmer","homepage":"http://khmer.readthedocs.org/","size":147343,"stargazers_count":194,"watchers_count":194,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":146,"mirror_url":null,"open_issues_count":210,"forks":146,"open_issues":210,"watchers":194,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ged-lab/khmer/pulls/257"},"html":{"href":"https://github.com/ged-lab/khmer/pull/257"},"issue":{"href":"https://api.github.com/repos/ged-lab/khmer/issues/257"},"comments":{"href":"https://api.github.com/repos/ged-lab/khmer/issues/257/comments"},"review_comments":{"href":"https://api.github.com/repos/ged-lab/khmer/pulls/257/comments"},"review_comment":{"href":"https://api.github.com/repos/ged-lab/khmer/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ged-lab/khmer/pulls/257/commits"},"statuses":{"href":"https://api.github.com/repos/ged-lab/khmer/statuses/57f2aa01efd563038316e0019aa4bbd427038d23"}}}}