{"action":"created","comment":{"url":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments/73584196","id":73584196,"diff_hunk":"@@ -488,10 +492,146 @@ protected GATKRead hardClipByReferenceCoordinates(final int refStart, final int\n         if ( start > 0 && stop < read.getLength() - 1) {\n             throw new GATKException(String.format(\"Trying to clip the middle of the read: start %d, stop %d, cigar: %s\", start, stop, read.getCigar().toString()));\n         }\n-\n         this.addOp(new ClippingOp(start, stop));\n         final GATKRead clippedRead = clipRead(ClippingRepresentation.HARDCLIP_BASES);\n         this.ops = null;\n         return clippedRead;\n     }\n+\n+\n+\n+    /**\n+     * Soft clip the read to the variable region (from refStart to refStop) processing also the clipped bases\n+     *\n+     * @param read     the read to be clipped\n+     * @param refStart the beginning of the variant region (inclusive)\n+     * @param refStop  the end of the variant region (inclusive)\n+     * @return the read soft clipped to the variant region\n+     */\n+    public static GATKRead softClipToRegionIncludingClippedBases( final GATKRead read, final int refStart, final int refStop ) {\n+        final int start = read.getUnclippedStart();\n+        final int stop = start + CigarUtils.countRefBasesBasedOnCigar(read, 0, read.numCigarElements()) - 1;\n+\n+        if (start <= refStop && stop >= refStart) {\n+            if (start < refStart && stop > refStop) {\n+                return (new ReadClipper(read)).softClipBothEndsByReferenceCoordinates(refStart - 1, refStop + 1);\n+            } else if (start < refStart) {\n+                return (new ReadClipper(read)).softClipByReferenceCoordinates(-1, refStart - 1);\n+            } else if (stop > refStop) {\n+                return (new ReadClipper(read)).softClipByReferenceCoordinates(refStop + 1, -1);\n+            }\n+            return read;\n+        } else {\n+            return ReadUtils.emptyRead(read);\n+        }\n+    }\n+\n+\n+    /**\n+     * Soft clips both tails of a read.\n+     *   Left tail goes from the beginning to the 'left' coordinate (inclusive)\n+     *   Right tail goes from the 'right' coordinate (inclusive) until the end of the read\n+     *\n+     * @param left the coordinate of the last base to be clipped in the left tail (inclusive)\n+     * @param right the coordinate of the first base to be clipped in the right tail (inclusive)\n+     * @return a new read, without the clipped bases\n+     */\n+    private GATKRead softClipBothEndsByReferenceCoordinates(final int left, final int right) {\n+        if (read.isEmpty() || left == right) {\n+            return ReadUtils.emptyRead(read);\n+        }\n+        final GATKRead leftTailRead = softClipByReferenceCoordinates(right, -1);\n+\n+        // after clipping one tail, it is possible that the consequent hard clipping of adjacent deletions\n+        // make the left cut index no longer part of the read. In that case, clip the read entirely.\n+        if (left > leftTailRead.getEnd()) {\n+            return ReadUtils.emptyRead(read);","path":"src/main/java/org/broadinstitute/hellbender/utils/clipping/ReadClipper.java","position":78,"original_position":78,"commit_id":"81814e1b0d71dc6d33a94d03d2f47924074d66de","original_commit_id":"81814e1b0d71dc6d33a94d03d2f47924074d66de","user":{"login":"meganshand","id":13020550,"avatar_url":"https://avatars.githubusercontent.com/u/13020550?v=3","gravatar_id":"","url":"https://api.github.com/users/meganshand","html_url":"https://github.com/meganshand","followers_url":"https://api.github.com/users/meganshand/followers","following_url":"https://api.github.com/users/meganshand/following{/other_user}","gists_url":"https://api.github.com/users/meganshand/gists{/gist_id}","starred_url":"https://api.github.com/users/meganshand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meganshand/subscriptions","organizations_url":"https://api.github.com/users/meganshand/orgs","repos_url":"https://api.github.com/users/meganshand/repos","events_url":"https://api.github.com/users/meganshand/events{/privacy}","received_events_url":"https://api.github.com/users/meganshand/received_events","type":"User","site_admin":false},"body":"another place for a possible warning","created_at":"2016-08-04T19:09:04Z","updated_at":"2016-08-04T19:09:04Z","html_url":"https://github.com/broadinstitute/gatk/pull/2021#discussion_r73584196","pull_request_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021","_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments/73584196"},"html":{"href":"https://github.com/broadinstitute/gatk/pull/2021#discussion_r73584196"},"pull_request":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021"}}},"pull_request":{"url":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021","id":78035101,"html_url":"https://github.com/broadinstitute/gatk/pull/2021","diff_url":"https://github.com/broadinstitute/gatk/pull/2021.diff","patch_url":"https://github.com/broadinstitute/gatk/pull/2021.patch","issue_url":"https://api.github.com/repos/broadinstitute/gatk/issues/2021","number":2021,"state":"open","locked":false,"title":"Changed SplitNCigarReads to produce softclipped supplementary reads","user":{"login":"jamesemery","id":16102845,"avatar_url":"https://avatars.githubusercontent.com/u/16102845?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesemery","html_url":"https://github.com/jamesemery","followers_url":"https://api.github.com/users/jamesemery/followers","following_url":"https://api.github.com/users/jamesemery/following{/other_user}","gists_url":"https://api.github.com/users/jamesemery/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesemery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesemery/subscriptions","organizations_url":"https://api.github.com/users/jamesemery/orgs","repos_url":"https://api.github.com/users/jamesemery/repos","events_url":"https://api.github.com/users/jamesemery/events{/privacy}","received_events_url":"https://api.github.com/users/jamesemery/received_events","type":"User","site_admin":false},"body":"resolves #1394 ","created_at":"2016-07-19T19:31:42Z","updated_at":"2016-08-04T19:09:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30c992c25959517c1c71d80d9e0aa0d0702891a0","assignee":{"login":"meganshand","id":13020550,"avatar_url":"https://avatars.githubusercontent.com/u/13020550?v=3","gravatar_id":"","url":"https://api.github.com/users/meganshand","html_url":"https://github.com/meganshand","followers_url":"https://api.github.com/users/meganshand/followers","following_url":"https://api.github.com/users/meganshand/following{/other_user}","gists_url":"https://api.github.com/users/meganshand/gists{/gist_id}","starred_url":"https://api.github.com/users/meganshand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meganshand/subscriptions","organizations_url":"https://api.github.com/users/meganshand/orgs","repos_url":"https://api.github.com/users/meganshand/repos","events_url":"https://api.github.com/users/meganshand/events{/privacy}","received_events_url":"https://api.github.com/users/meganshand/received_events","type":"User","site_admin":false},"assignees":[{"login":"meganshand","id":13020550,"avatar_url":"https://avatars.githubusercontent.com/u/13020550?v=3","gravatar_id":"","url":"https://api.github.com/users/meganshand","html_url":"https://github.com/meganshand","followers_url":"https://api.github.com/users/meganshand/followers","following_url":"https://api.github.com/users/meganshand/following{/other_user}","gists_url":"https://api.github.com/users/meganshand/gists{/gist_id}","starred_url":"https://api.github.com/users/meganshand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meganshand/subscriptions","organizations_url":"https://api.github.com/users/meganshand/orgs","repos_url":"https://api.github.com/users/meganshand/repos","events_url":"https://api.github.com/users/meganshand/events{/privacy}","received_events_url":"https://api.github.com/users/meganshand/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021/commits","review_comments_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021/comments","review_comment_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/issues/2021/comments","statuses_url":"https://api.github.com/repos/broadinstitute/gatk/statuses/81814e1b0d71dc6d33a94d03d2f47924074d66de","head":{"label":"broadinstitute:je_splitNCigarReads_Chimericfix_1394","ref":"je_splitNCigarReads_Chimericfix_1394","sha":"81814e1b0d71dc6d33a94d03d2f47924074d66de","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":27452807,"name":"gatk","full_name":"broadinstitute/gatk","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/gatk","description":"GATK4 development","fork":false,"url":"https://api.github.com/repos/broadinstitute/gatk","forks_url":"https://api.github.com/repos/broadinstitute/gatk/forks","keys_url":"https://api.github.com/repos/broadinstitute/gatk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/gatk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/gatk/teams","hooks_url":"https://api.github.com/repos/broadinstitute/gatk/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/gatk/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/gatk/events","assignees_url":"https://api.github.com/repos/broadinstitute/gatk/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/gatk/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/gatk/tags","blobs_url":"https://api.github.com/repos/broadinstitute/gatk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/gatk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/gatk/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/gatk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/gatk/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/gatk/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/gatk/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/gatk/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/gatk/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/gatk/subscription","commits_url":"https://api.github.com/repos/broadinstitute/gatk/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/gatk/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/gatk/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/gatk/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/gatk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/gatk/merges","archive_url":"https://api.github.com/repos/broadinstitute/gatk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/gatk/downloads","issues_url":"https://api.github.com/repos/broadinstitute/gatk/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/gatk/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/gatk/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/gatk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/gatk/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/gatk/releases{/id}","deployments_url":"https://api.github.com/repos/broadinstitute/gatk/deployments","created_at":"2014-12-02T20:50:36Z","updated_at":"2016-08-02T04:46:17Z","pushed_at":"2016-08-04T18:35:44Z","git_url":"git://github.com/broadinstitute/gatk.git","ssh_url":"git@github.com:broadinstitute/gatk.git","clone_url":"https://github.com/broadinstitute/gatk.git","svn_url":"https://github.com/broadinstitute/gatk","homepage":"","size":123329,"stargazers_count":80,"watchers_count":80,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":407,"forks":30,"open_issues":407,"watchers":80,"default_branch":"master"}},"base":{"label":"broadinstitute:master","ref":"master","sha":"b14f284eaff77c1972502d7c45d0e8343d2584dd","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":27452807,"name":"gatk","full_name":"broadinstitute/gatk","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/gatk","description":"GATK4 development","fork":false,"url":"https://api.github.com/repos/broadinstitute/gatk","forks_url":"https://api.github.com/repos/broadinstitute/gatk/forks","keys_url":"https://api.github.com/repos/broadinstitute/gatk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/gatk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/gatk/teams","hooks_url":"https://api.github.com/repos/broadinstitute/gatk/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/gatk/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/gatk/events","assignees_url":"https://api.github.com/repos/broadinstitute/gatk/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/gatk/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/gatk/tags","blobs_url":"https://api.github.com/repos/broadinstitute/gatk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/gatk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/gatk/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/gatk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/gatk/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/gatk/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/gatk/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/gatk/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/gatk/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/gatk/subscription","commits_url":"https://api.github.com/repos/broadinstitute/gatk/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/gatk/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/gatk/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/gatk/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/gatk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/gatk/merges","archive_url":"https://api.github.com/repos/broadinstitute/gatk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/gatk/downloads","issues_url":"https://api.github.com/repos/broadinstitute/gatk/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/gatk/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/gatk/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/gatk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/gatk/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/gatk/releases{/id}","deployments_url":"https://api.github.com/repos/broadinstitute/gatk/deployments","created_at":"2014-12-02T20:50:36Z","updated_at":"2016-08-02T04:46:17Z","pushed_at":"2016-08-04T18:35:44Z","git_url":"git://github.com/broadinstitute/gatk.git","ssh_url":"git@github.com:broadinstitute/gatk.git","clone_url":"https://github.com/broadinstitute/gatk.git","svn_url":"https://github.com/broadinstitute/gatk","homepage":"","size":123329,"stargazers_count":80,"watchers_count":80,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":407,"forks":30,"open_issues":407,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021"},"html":{"href":"https://github.com/broadinstitute/gatk/pull/2021"},"issue":{"href":"https://api.github.com/repos/broadinstitute/gatk/issues/2021"},"comments":{"href":"https://api.github.com/repos/broadinstitute/gatk/issues/2021/comments"},"review_comments":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021/comments"},"review_comment":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/2021/commits"},"statuses":{"href":"https://api.github.com/repos/broadinstitute/gatk/statuses/81814e1b0d71dc6d33a94d03d2f47924074d66de"}}}}
{"actor":{"display_login":"meganshand"}}