{"action":"created","comment":{"url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/comments/42438003","id":42438003,"diff_hunk":"@@ -0,0 +1,107 @@\n+// Copyright (c) 2014-2015, Pacific Biosciences of California, Inc.\n+//\n+// All rights reserved.\n+//\n+// Redistribution and use in source and binary forms, with or without\n+// modification, are permitted (subject to the limitations in the\n+// disclaimer below) provided that the following conditions are met:\n+//\n+//  * Redistributions of source code must retain the above copyright\n+//    notice, this list of conditions and the following disclaimer.\n+//\n+//  * Redistributions in binary form must reproduce the above\n+//    copyright notice, this list of conditions and the following\n+//    disclaimer in the documentation and/or other materials provided\n+//    with the distribution.\n+//\n+//  * Neither the name of Pacific Biosciences nor the names of its\n+//    contributors may be used to endorse or promote products derived\n+//    from this software without specific prior written permission.\n+//\n+// NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE\n+// GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC\n+// BIOSCIENCES AND ITS CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED\n+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n+// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n+// DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR ITS\n+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n+// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n+// SUCH DAMAGE.\n+\n+// Author: Yuan Li\n+\n+#ifdef USE_PBBAM\n+#include \"pbbam/SequentialZmwGroupQuery.h\"\n+#include \"CompositeBamReader.h\"\n+#include <boost/optional.hpp>\n+#include <cassert>\n+using namespace PacBio;\n+using namespace PacBio::BAM;\n+using namespace PacBio::BAM::internal;\n+using namespace std;\n+\n+struct SequentialZmwGroupQuery::SequentialZmwGroupQueryPrivate\n+{\n+public:\n+    SequentialZmwGroupQueryPrivate(const DataSet& dataset)\n+        : reader_(new SequentialCompositeBamReader(dataset))\n+        , nextRecord_(boost::none)\n+    { }\n+\n+    bool GetNext(vector<BamRecord>& records)\n+    {\n+        records.clear();\n+\n+        string movieName;\n+        uint32_t holeNumber;\n+\n+        if (nextRecord_.is_initialized()) {\n+            BamRecord r = nextRecord_.get();\n+            movieName = r.MovieName();\n+            holeNumber = r.HoleNumber();\n+            records.push_back(std::move(r));\n+            nextRecord_ = boost::none;\n+        }\n+\n+        BamRecord record;\n+        while (reader_->GetNext(record)) {\n+            if (records.empty()) {\n+                movieName = record.MovieName();\n+                holeNumber = record.HoleNumber();\n+                records.push_back(record);\n+            }\n+            else {\n+                assert(!records.empty());\n+                if (record.MovieName() == movieName and record.HoleNumber() == holeNumber)\n+                    records.push_back(record);\n+                else {\n+                    nextRecord_ = record;\n+                    return true;\n+                }\n+            }\n+        }\n+        return !records.empty();","path":"alignment/query/SequentialZmwGroupQuery.cpp","position":88,"original_position":88,"commit_id":"69448ed67605e4129f35a185ee886d37e4632829","original_commit_id":"69448ed67605e4129f35a185ee886d37e4632829","user":{"login":"pb-cdunn","id":12086299,"avatar_url":"https://avatars.githubusercontent.com/u/12086299?v=3","gravatar_id":"","url":"https://api.github.com/users/pb-cdunn","html_url":"https://github.com/pb-cdunn","followers_url":"https://api.github.com/users/pb-cdunn/followers","following_url":"https://api.github.com/users/pb-cdunn/following{/other_user}","gists_url":"https://api.github.com/users/pb-cdunn/gists{/gist_id}","starred_url":"https://api.github.com/users/pb-cdunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pb-cdunn/subscriptions","organizations_url":"https://api.github.com/users/pb-cdunn/orgs","repos_url":"https://api.github.com/users/pb-cdunn/repos","events_url":"https://api.github.com/users/pb-cdunn/events{/privacy}","received_events_url":"https://api.github.com/users/pb-cdunn/received_events","type":"User","site_admin":false},"body":"The caller can test this herself. It's not clear to me that this method really needs the boolean return-value at all. But if it's meant to aid some iteration pattern, then it's ok.","created_at":"2015-10-19T23:13:02Z","updated_at":"2015-10-19T23:13:02Z","html_url":"https://github.com/PacificBiosciences/blasr_libcpp/pull/83#discussion_r42438003","pull_request_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/comments/42438003"},"html":{"href":"https://github.com/PacificBiosciences/blasr_libcpp/pull/83#discussion_r42438003"},"pull_request":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83","id":48131671,"html_url":"https://github.com/PacificBiosciences/blasr_libcpp/pull/83","diff_url":"https://github.com/PacificBiosciences/blasr_libcpp/pull/83.diff","patch_url":"https://github.com/PacificBiosciences/blasr_libcpp/pull/83.patch","issue_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/issues/83","number":83,"state":"closed","locked":false,"title":"Add SequentialZmwGroupQuery and PbiFilterZmwGroupQuery","user":{"login":"ylipacbio","id":3189673,"avatar_url":"https://avatars.githubusercontent.com/u/3189673?v=3","gravatar_id":"","url":"https://api.github.com/users/ylipacbio","html_url":"https://github.com/ylipacbio","followers_url":"https://api.github.com/users/ylipacbio/followers","following_url":"https://api.github.com/users/ylipacbio/following{/other_user}","gists_url":"https://api.github.com/users/ylipacbio/gists{/gist_id}","starred_url":"https://api.github.com/users/ylipacbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ylipacbio/subscriptions","organizations_url":"https://api.github.com/users/ylipacbio/orgs","repos_url":"https://api.github.com/users/ylipacbio/repos","events_url":"https://api.github.com/users/ylipacbio/events{/privacy}","received_events_url":"https://api.github.com/users/ylipacbio/received_events","type":"User","site_admin":false},"body":"Moved  bug 28882 p4 CL 164057 to blasr_libcpp.\r\n\r\n    SequentialZmwGroupQuery returns a vector of bam records of a zmw at a time.\r\n\r\n    PbiFilterZmwGroupQuery returns a vector of bam records of a zmw at a time and respects filters in dataset.\r\n\r\nNote that both classes require bam records of a zmw to be stored next to one another.\r\nNote that we will switch to Derek's pbbam APIs when they are available.","created_at":"2015-10-19T21:53:40Z","updated_at":"2015-10-19T23:13:02Z","closed_at":"2015-10-19T22:29:59Z","merged_at":"2015-10-19T22:29:59Z","merge_commit_sha":"bfc6ebc0b919e18501856c6948b36542d6d554d3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83/commits","review_comments_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83/comments","review_comment_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/issues/83/comments","statuses_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/statuses/69448ed67605e4129f35a185ee886d37e4632829","head":{"label":"ylipacbio:support-dataset","ref":"support-dataset","sha":"69448ed67605e4129f35a185ee886d37e4632829","user":{"login":"ylipacbio","id":3189673,"avatar_url":"https://avatars.githubusercontent.com/u/3189673?v=3","gravatar_id":"","url":"https://api.github.com/users/ylipacbio","html_url":"https://github.com/ylipacbio","followers_url":"https://api.github.com/users/ylipacbio/followers","following_url":"https://api.github.com/users/ylipacbio/following{/other_user}","gists_url":"https://api.github.com/users/ylipacbio/gists{/gist_id}","starred_url":"https://api.github.com/users/ylipacbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ylipacbio/subscriptions","organizations_url":"https://api.github.com/users/ylipacbio/orgs","repos_url":"https://api.github.com/users/ylipacbio/repos","events_url":"https://api.github.com/users/ylipacbio/events{/privacy}","received_events_url":"https://api.github.com/users/ylipacbio/received_events","type":"User","site_admin":false},"repo":{"id":38722460,"name":"blasr_libcpp","full_name":"ylipacbio/blasr_libcpp","owner":{"login":"ylipacbio","id":3189673,"avatar_url":"https://avatars.githubusercontent.com/u/3189673?v=3","gravatar_id":"","url":"https://api.github.com/users/ylipacbio","html_url":"https://github.com/ylipacbio","followers_url":"https://api.github.com/users/ylipacbio/followers","following_url":"https://api.github.com/users/ylipacbio/following{/other_user}","gists_url":"https://api.github.com/users/ylipacbio/gists{/gist_id}","starred_url":"https://api.github.com/users/ylipacbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ylipacbio/subscriptions","organizations_url":"https://api.github.com/users/ylipacbio/orgs","repos_url":"https://api.github.com/users/ylipacbio/repos","events_url":"https://api.github.com/users/ylipacbio/events{/privacy}","received_events_url":"https://api.github.com/users/ylipacbio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ylipacbio/blasr_libcpp","description":"","fork":true,"url":"https://api.github.com/repos/ylipacbio/blasr_libcpp","forks_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/forks","keys_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/teams","hooks_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/hooks","issue_events_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/issues/events{/number}","events_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/events","assignees_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/assignees{/user}","branches_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/branches{/branch}","tags_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/tags","blobs_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/statuses/{sha}","languages_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/languages","stargazers_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/stargazers","contributors_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/contributors","subscribers_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/subscribers","subscription_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/subscription","commits_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/contents/{+path}","compare_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/merges","archive_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/downloads","issues_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/issues{/number}","pulls_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/pulls{/number}","milestones_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/milestones{/number}","notifications_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/labels{/name}","releases_url":"https://api.github.com/repos/ylipacbio/blasr_libcpp/releases{/id}","created_at":"2015-07-08T00:30:21Z","updated_at":"2015-07-08T00:30:22Z","pushed_at":"2015-10-19T21:52:11Z","git_url":"git://github.com/ylipacbio/blasr_libcpp.git","ssh_url":"git@github.com:ylipacbio/blasr_libcpp.git","clone_url":"https://github.com/ylipacbio/blasr_libcpp.git","svn_url":"https://github.com/ylipacbio/blasr_libcpp","homepage":null,"size":1966,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"PacificBiosciences:master","ref":"master","sha":"2b5c0a7b7628dd2e334faf4cb2cf13255f113469","user":{"login":"PacificBiosciences","id":999745,"avatar_url":"https://avatars.githubusercontent.com/u/999745?v=3","gravatar_id":"","url":"https://api.github.com/users/PacificBiosciences","html_url":"https://github.com/PacificBiosciences","followers_url":"https://api.github.com/users/PacificBiosciences/followers","following_url":"https://api.github.com/users/PacificBiosciences/following{/other_user}","gists_url":"https://api.github.com/users/PacificBiosciences/gists{/gist_id}","starred_url":"https://api.github.com/users/PacificBiosciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PacificBiosciences/subscriptions","organizations_url":"https://api.github.com/users/PacificBiosciences/orgs","repos_url":"https://api.github.com/users/PacificBiosciences/repos","events_url":"https://api.github.com/users/PacificBiosciences/events{/privacy}","received_events_url":"https://api.github.com/users/PacificBiosciences/received_events","type":"Organization","site_admin":false},"repo":{"id":25383899,"name":"blasr_libcpp","full_name":"PacificBiosciences/blasr_libcpp","owner":{"login":"PacificBiosciences","id":999745,"avatar_url":"https://avatars.githubusercontent.com/u/999745?v=3","gravatar_id":"","url":"https://api.github.com/users/PacificBiosciences","html_url":"https://github.com/PacificBiosciences","followers_url":"https://api.github.com/users/PacificBiosciences/followers","following_url":"https://api.github.com/users/PacificBiosciences/following{/other_user}","gists_url":"https://api.github.com/users/PacificBiosciences/gists{/gist_id}","starred_url":"https://api.github.com/users/PacificBiosciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PacificBiosciences/subscriptions","organizations_url":"https://api.github.com/users/PacificBiosciences/orgs","repos_url":"https://api.github.com/users/PacificBiosciences/repos","events_url":"https://api.github.com/users/PacificBiosciences/events{/privacy}","received_events_url":"https://api.github.com/users/PacificBiosciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PacificBiosciences/blasr_libcpp","description":"","fork":false,"url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp","forks_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/forks","keys_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/teams","hooks_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/hooks","issue_events_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/issues/events{/number}","events_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/events","assignees_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/assignees{/user}","branches_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/branches{/branch}","tags_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/tags","blobs_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/statuses/{sha}","languages_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/languages","stargazers_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/stargazers","contributors_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/contributors","subscribers_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/subscribers","subscription_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/subscription","commits_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/contents/{+path}","compare_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/merges","archive_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/downloads","issues_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/issues{/number}","pulls_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls{/number}","milestones_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/milestones{/number}","notifications_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/labels{/name}","releases_url":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/releases{/id}","created_at":"2014-10-18T01:44:46Z","updated_at":"2015-09-04T18:21:50Z","pushed_at":"2015-10-19T22:30:00Z","git_url":"git://github.com/PacificBiosciences/blasr_libcpp.git","ssh_url":"git@github.com:PacificBiosciences/blasr_libcpp.git","clone_url":"https://github.com/PacificBiosciences/blasr_libcpp.git","svn_url":"https://github.com/PacificBiosciences/blasr_libcpp","homepage":null,"size":2426,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":5,"forks":6,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83"},"html":{"href":"https://github.com/PacificBiosciences/blasr_libcpp/pull/83"},"issue":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/issues/83"},"comments":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/PacificBiosciences/blasr_libcpp/statuses/69448ed67605e4129f35a185ee886d37e4632829"}}}}