{"action":"created","comment":{"url":"https://api.github.com/repos/genome/genome/pulls/comments/42175565","id":42175565,"diff_hunk":"@@ -0,0 +1,84 @@\n+package Genome::Model::Build::ReferenceSequence::Buckets;\n+\n+use strict;\n+use warnings;\n+\n+use Genome;\n+use Algorithm::Bucketizer;\n+use List::Util qw(max);\n+\n+class Genome::Model::Build::ReferenceSequence::Buckets {\n+    is => 'Genome::SoftwareResult::StageableSimple',\n+    has_input => [\n+        reference_sequence_build => {\n+            is => 'Genome::Model::Build::ReferenceSequence',\n+            doc => 'The reference to bucketize',\n+        },\n+    ],\n+    has_metric => [\n+        count => {\n+            is => 'Number',\n+            doc => 'The number of buckets for this reference',\n+        },\n+    ],\n+};\n+\n+sub bucket_list {\n+    my $self = shift;\n+\n+    my @buckets;\n+    for my $bucket (1..$self->count) {\n+        push @buckets, $self->bucket($bucket);\n+    }\n+\n+    return \\@buckets;\n+}\n+\n+sub bucket {\n+    my $self = shift;\n+    my $bucket = shift;\n+\n+    my $output_dir = $self->output_dir;\n+\n+    my $bucket_file = File::Spec->join($output_dir, $bucket);\n+    my @items = Genome::Sys->read_file($bucket_file);\n+    chomp @items;\n+\n+    return \\@items;\n+}\n+\n+sub _run {\n+    my $self = shift;\n+\n+    my $chr_lengths = $self->reference_sequence_build->chromosomes_with_lengths;\n+    my $max_length = max( map $_->[1], @$chr_lengths );\n+\n+    my $bucketizer = Algorithm::Bucketizer->new(bucketsize => $max_length);\n+    for my $chr_with_length (@$chr_lengths) {\n+        $bucketizer->add_item( @$chr_with_length );\n+    }\n+\n+    #skip optimization to preserve order\n+    $bucketizer->optimize(maxrounds => 100_000);","path":"lib/perl/Genome/Model/Build/ReferenceSequence/Buckets.pm","position":62,"original_position":62,"commit_id":"192e98799c61a157db82f96d137f58d29aa4cde5","original_commit_id":"192e98799c61a157db82f96d137f58d29aa4cde5","user":{"login":"dufeiyu","id":142284,"avatar_url":"https://avatars.githubusercontent.com/u/142284?v=3","gravatar_id":"","url":"https://api.github.com/users/dufeiyu","html_url":"https://github.com/dufeiyu","followers_url":"https://api.github.com/users/dufeiyu/followers","following_url":"https://api.github.com/users/dufeiyu/following{/other_user}","gists_url":"https://api.github.com/users/dufeiyu/gists{/gist_id}","starred_url":"https://api.github.com/users/dufeiyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dufeiyu/subscriptions","organizations_url":"https://api.github.com/users/dufeiyu/orgs","repos_url":"https://api.github.com/users/dufeiyu/repos","events_url":"https://api.github.com/users/dufeiyu/events{/privacy}","received_events_url":"https://api.github.com/users/dufeiyu/received_events","type":"User","site_admin":false},"body":"just wanna make sure that 100k here means skip.","created_at":"2015-10-15T20:26:30Z","updated_at":"2015-10-15T20:26:30Z","html_url":"https://github.com/genome/genome/pull/1044#discussion_r42175565","pull_request_url":"https://api.github.com/repos/genome/genome/pulls/1044","_links":{"self":{"href":"https://api.github.com/repos/genome/genome/pulls/comments/42175565"},"html":{"href":"https://github.com/genome/genome/pull/1044#discussion_r42175565"},"pull_request":{"href":"https://api.github.com/repos/genome/genome/pulls/1044"}}},"pull_request":{"url":"https://api.github.com/repos/genome/genome/pulls/1044","id":47430493,"html_url":"https://github.com/genome/genome/pull/1044","diff_url":"https://github.com/genome/genome/pull/1044.diff","patch_url":"https://github.com/genome/genome/pull/1044.patch","issue_url":"https://api.github.com/repos/genome/genome/issues/1044","number":1044,"state":"open","locked":false,"title":"New SR to create \"buckets\" of chromosomes for a reference.","user":{"login":"tmooney","id":187262,"avatar_url":"https://avatars.githubusercontent.com/u/187262?v=3","gravatar_id":"","url":"https://api.github.com/users/tmooney","html_url":"https://github.com/tmooney","followers_url":"https://api.github.com/users/tmooney/followers","following_url":"https://api.github.com/users/tmooney/following{/other_user}","gists_url":"https://api.github.com/users/tmooney/gists{/gist_id}","starred_url":"https://api.github.com/users/tmooney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmooney/subscriptions","organizations_url":"https://api.github.com/users/tmooney/orgs","repos_url":"https://api.github.com/users/tmooney/repos","events_url":"https://api.github.com/users/tmooney/events{/privacy}","received_events_url":"https://api.github.com/users/tmooney/received_events","type":"User","site_admin":false},"body":"This PR is part of adding the HaplotypeCaller to the pipeline.  The buckets will be used to parallelize the task into roughly equal-sized tasks rather than by chromosomes whose sizes vary significantly.","created_at":"2015-10-12T15:09:11Z","updated_at":"2015-10-15T20:26:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33e0da10d2749ab20975e4b0fda4e36f82056f70","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/genome/genome/pulls/1044/commits","review_comments_url":"https://api.github.com/repos/genome/genome/pulls/1044/comments","review_comment_url":"https://api.github.com/repos/genome/genome/pulls/comments{/number}","comments_url":"https://api.github.com/repos/genome/genome/issues/1044/comments","statuses_url":"https://api.github.com/repos/genome/genome/statuses/192e98799c61a157db82f96d137f58d29aa4cde5","head":{"label":"tmooney:reference_sequence_buckets","ref":"reference_sequence_buckets","sha":"192e98799c61a157db82f96d137f58d29aa4cde5","user":{"login":"tmooney","id":187262,"avatar_url":"https://avatars.githubusercontent.com/u/187262?v=3","gravatar_id":"","url":"https://api.github.com/users/tmooney","html_url":"https://github.com/tmooney","followers_url":"https://api.github.com/users/tmooney/followers","following_url":"https://api.github.com/users/tmooney/following{/other_user}","gists_url":"https://api.github.com/users/tmooney/gists{/gist_id}","starred_url":"https://api.github.com/users/tmooney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmooney/subscriptions","organizations_url":"https://api.github.com/users/tmooney/orgs","repos_url":"https://api.github.com/users/tmooney/repos","events_url":"https://api.github.com/users/tmooney/events{/privacy}","received_events_url":"https://api.github.com/users/tmooney/received_events","type":"User","site_admin":false},"repo":{"id":23662236,"name":"genome","full_name":"tmooney/genome","owner":{"login":"tmooney","id":187262,"avatar_url":"https://avatars.githubusercontent.com/u/187262?v=3","gravatar_id":"","url":"https://api.github.com/users/tmooney","html_url":"https://github.com/tmooney","followers_url":"https://api.github.com/users/tmooney/followers","following_url":"https://api.github.com/users/tmooney/following{/other_user}","gists_url":"https://api.github.com/users/tmooney/gists{/gist_id}","starred_url":"https://api.github.com/users/tmooney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmooney/subscriptions","organizations_url":"https://api.github.com/users/tmooney/orgs","repos_url":"https://api.github.com/users/tmooney/repos","events_url":"https://api.github.com/users/tmooney/events{/privacy}","received_events_url":"https://api.github.com/users/tmooney/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tmooney/genome","description":"","fork":true,"url":"https://api.github.com/repos/tmooney/genome","forks_url":"https://api.github.com/repos/tmooney/genome/forks","keys_url":"https://api.github.com/repos/tmooney/genome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tmooney/genome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tmooney/genome/teams","hooks_url":"https://api.github.com/repos/tmooney/genome/hooks","issue_events_url":"https://api.github.com/repos/tmooney/genome/issues/events{/number}","events_url":"https://api.github.com/repos/tmooney/genome/events","assignees_url":"https://api.github.com/repos/tmooney/genome/assignees{/user}","branches_url":"https://api.github.com/repos/tmooney/genome/branches{/branch}","tags_url":"https://api.github.com/repos/tmooney/genome/tags","blobs_url":"https://api.github.com/repos/tmooney/genome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tmooney/genome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tmooney/genome/git/refs{/sha}","trees_url":"https://api.github.com/repos/tmooney/genome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tmooney/genome/statuses/{sha}","languages_url":"https://api.github.com/repos/tmooney/genome/languages","stargazers_url":"https://api.github.com/repos/tmooney/genome/stargazers","contributors_url":"https://api.github.com/repos/tmooney/genome/contributors","subscribers_url":"https://api.github.com/repos/tmooney/genome/subscribers","subscription_url":"https://api.github.com/repos/tmooney/genome/subscription","commits_url":"https://api.github.com/repos/tmooney/genome/commits{/sha}","git_commits_url":"https://api.github.com/repos/tmooney/genome/git/commits{/sha}","comments_url":"https://api.github.com/repos/tmooney/genome/comments{/number}","issue_comment_url":"https://api.github.com/repos/tmooney/genome/issues/comments{/number}","contents_url":"https://api.github.com/repos/tmooney/genome/contents/{+path}","compare_url":"https://api.github.com/repos/tmooney/genome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tmooney/genome/merges","archive_url":"https://api.github.com/repos/tmooney/genome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tmooney/genome/downloads","issues_url":"https://api.github.com/repos/tmooney/genome/issues{/number}","pulls_url":"https://api.github.com/repos/tmooney/genome/pulls{/number}","milestones_url":"https://api.github.com/repos/tmooney/genome/milestones{/number}","notifications_url":"https://api.github.com/repos/tmooney/genome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tmooney/genome/labels{/name}","releases_url":"https://api.github.com/repos/tmooney/genome/releases{/id}","created_at":"2014-09-04T12:55:03Z","updated_at":"2015-08-04T14:50:40Z","pushed_at":"2015-10-15T20:25:46Z","git_url":"git://github.com/tmooney/genome.git","ssh_url":"git@github.com:tmooney/genome.git","clone_url":"https://github.com/tmooney/genome.git","svn_url":"https://github.com/tmooney/genome","homepage":"","size":173379,"stargazers_count":0,"watchers_count":0,"language":"Perl6","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"genome:master","ref":"master","sha":"db969f1d5743c23b97d48e86587b98721e65aa05","user":{"login":"genome","id":318108,"avatar_url":"https://avatars.githubusercontent.com/u/318108?v=3","gravatar_id":"","url":"https://api.github.com/users/genome","html_url":"https://github.com/genome","followers_url":"https://api.github.com/users/genome/followers","following_url":"https://api.github.com/users/genome/following{/other_user}","gists_url":"https://api.github.com/users/genome/gists{/gist_id}","starred_url":"https://api.github.com/users/genome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genome/subscriptions","organizations_url":"https://api.github.com/users/genome/orgs","repos_url":"https://api.github.com/users/genome/repos","events_url":"https://api.github.com/users/genome/events{/privacy}","received_events_url":"https://api.github.com/users/genome/received_events","type":"Organization","site_admin":false},"repo":{"id":23442737,"name":"genome","full_name":"genome/genome","owner":{"login":"genome","id":318108,"avatar_url":"https://avatars.githubusercontent.com/u/318108?v=3","gravatar_id":"","url":"https://api.github.com/users/genome","html_url":"https://github.com/genome","followers_url":"https://api.github.com/users/genome/followers","following_url":"https://api.github.com/users/genome/following{/other_user}","gists_url":"https://api.github.com/users/genome/gists{/gist_id}","starred_url":"https://api.github.com/users/genome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genome/subscriptions","organizations_url":"https://api.github.com/users/genome/orgs","repos_url":"https://api.github.com/users/genome/repos","events_url":"https://api.github.com/users/genome/events{/privacy}","received_events_url":"https://api.github.com/users/genome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/genome/genome","description":"Core modules used by the GMS","fork":false,"url":"https://api.github.com/repos/genome/genome","forks_url":"https://api.github.com/repos/genome/genome/forks","keys_url":"https://api.github.com/repos/genome/genome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/genome/genome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/genome/genome/teams","hooks_url":"https://api.github.com/repos/genome/genome/hooks","issue_events_url":"https://api.github.com/repos/genome/genome/issues/events{/number}","events_url":"https://api.github.com/repos/genome/genome/events","assignees_url":"https://api.github.com/repos/genome/genome/assignees{/user}","branches_url":"https://api.github.com/repos/genome/genome/branches{/branch}","tags_url":"https://api.github.com/repos/genome/genome/tags","blobs_url":"https://api.github.com/repos/genome/genome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/genome/genome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/genome/genome/git/refs{/sha}","trees_url":"https://api.github.com/repos/genome/genome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/genome/genome/statuses/{sha}","languages_url":"https://api.github.com/repos/genome/genome/languages","stargazers_url":"https://api.github.com/repos/genome/genome/stargazers","contributors_url":"https://api.github.com/repos/genome/genome/contributors","subscribers_url":"https://api.github.com/repos/genome/genome/subscribers","subscription_url":"https://api.github.com/repos/genome/genome/subscription","commits_url":"https://api.github.com/repos/genome/genome/commits{/sha}","git_commits_url":"https://api.github.com/repos/genome/genome/git/commits{/sha}","comments_url":"https://api.github.com/repos/genome/genome/comments{/number}","issue_comment_url":"https://api.github.com/repos/genome/genome/issues/comments{/number}","contents_url":"https://api.github.com/repos/genome/genome/contents/{+path}","compare_url":"https://api.github.com/repos/genome/genome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/genome/genome/merges","archive_url":"https://api.github.com/repos/genome/genome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/genome/genome/downloads","issues_url":"https://api.github.com/repos/genome/genome/issues{/number}","pulls_url":"https://api.github.com/repos/genome/genome/pulls{/number}","milestones_url":"https://api.github.com/repos/genome/genome/milestones{/number}","notifications_url":"https://api.github.com/repos/genome/genome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/genome/genome/labels{/name}","releases_url":"https://api.github.com/repos/genome/genome/releases{/id}","created_at":"2014-08-28T20:59:19Z","updated_at":"2015-10-01T21:38:19Z","pushed_at":"2015-10-15T19:17:44Z","git_url":"git://github.com/genome/genome.git","ssh_url":"git@github.com:genome/genome.git","clone_url":"https://github.com/genome/genome.git","svn_url":"https://github.com/genome/genome","homepage":"","size":196990,"stargazers_count":9,"watchers_count":9,"language":"Perl6","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":13,"forks":40,"open_issues":13,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/genome/genome/pulls/1044"},"html":{"href":"https://github.com/genome/genome/pull/1044"},"issue":{"href":"https://api.github.com/repos/genome/genome/issues/1044"},"comments":{"href":"https://api.github.com/repos/genome/genome/issues/1044/comments"},"review_comments":{"href":"https://api.github.com/repos/genome/genome/pulls/1044/comments"},"review_comment":{"href":"https://api.github.com/repos/genome/genome/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/genome/genome/pulls/1044/commits"},"statuses":{"href":"https://api.github.com/repos/genome/genome/statuses/192e98799c61a157db82f96d137f58d29aa4cde5"}}}}