{"action":"created","comment":{"url":"https://api.github.com/repos/hammerlab/guacamole/pulls/comments/35788118","id":35788118,"diff_hunk":"@@ -0,0 +1,70 @@\n+package org.hammerlab.guacamole.alignment\n+\n+import org.scalatest.{ FunSuite, Matchers }\n+import org.hammerlab.guacamole.util.TestUtil.Implicits._\n+\n+class AffineGapPenaltyAlignmentSuite extends FunSuite with Matchers {\n+\n+  test(\"score alignment: exact match\") {\n+    val (alignmentStates, alignmentScores) = AffineGapPenaltyAlignment.scoreAlignmentPaths(\"TCGA\", \"TCGA\")\n+    alignmentScores(4, 4).toInt should be(0)\n+  }\n+\n+  test(\"score alignment: single mismatch\") {\n+    val (alignmentStates, alignmentScores) = AffineGapPenaltyAlignment.scoreAlignmentPaths(\"TCGA\", \"TCCA\", mismatchProbability = 1e-2)\n+    alignmentScores(4, 4).toInt should be(5)\n+  }\n+\n+  test(\"align exact match\") {\n+    val alignment = AffineGapPenaltyAlignment.align(\"TCGA\", \"TCGA\")\n+    alignment.toCigar should be(\"4=\")\n+  }\n+\n+  test(\"align: single mismatch\") {\n+    val alignment = AffineGapPenaltyAlignment.align(\"TCGA\", \"TCCA\", mismatchProbability = 1e-2)\n+\n+    alignment.toCigar should be(\"2=1X1=\")\n+  }\n+\n+  test(\"align long exact match\") {\n+    val sequence = \"TCGATGATCTGAGA\"\n+    val alignment = AffineGapPenaltyAlignment.align(sequence, sequence)\n+    alignment.toCigar should be(sequence.length.toString + \"=\")\n+  }\n+\n+  test(\"short align with insertion\") {\n+    val alignment = AffineGapPenaltyAlignment.align(\"TCCGA\", \"TCGA\")\n+    alignment.toCigar should be(\"2=1I2=\")\n+  }\n+\n+  test(\"long align with insertion\") {\n+    val alignment = AffineGapPenaltyAlignment.align(\"TCGACCCTCTGA\", \"TCGATCTGA\")\n+    alignment.toCigar should be(\"4=3I5=\")\n+  }\n+\n+  test(\"long align with deletion\") {\n+    val alignment = AffineGapPenaltyAlignment.align(\"TCGATCTGA\", \"TCGACCCTCTGA\")\n+    alignment.toCigar should be(\"4=3D5=\")\n+  }\n+\n+  test(\"mixed mismatch and insertion\") {\n+    val alignment = AffineGapPenaltyAlignment.align(\"TCGACCCTCTTA\", \"TCGATCTGA\")\n+    alignment.toCigar should be(\"4=3I3=1X1=\")\n+  }\n+\n+  test(\"only mismatch long sequence\") {\n+    val alignment = AffineGapPenaltyAlignment\n+      .align(\n+        \"ATTCTCAAGTTTTAAGTGGTATTCTAATTATGGCAGTAATTAACTGAATAAAGAGATTCATCATGTGCAAAAACTAATCTTGTTTACTTAAAATTGAGAGT\", \n+        \"ATTCTCAAGTTTTAAGTGGTTTTCTAATTATGGCAGTAATAAACTGAATAAAGAGATTCATCATGTGCAAAAACTAATCTTGTTTACTTAAAATTGAGAGT\")\n+    alignment.toCigar should be(\"20=1X19=1X60=\")\n+  }\n+\n+  test(\"2 mismatch with deletion sequence\") {\n+    val alignment = AffineGapPenaltyAlignment\n+      .align(\n+        \"ATTCTCAAGTTTTAAGTGGTATTCTAATTATGGCAGTAATTAACTGAATAAAGAGATTCATCATGTGCAAAAACTAATCTTGTTTACTTAAAATTGAGAGT\",","path":"src/test/scala/org/hammerlab/guacamole/alignment/AffineGapPenaltyAlignmentSuite.scala","position":66,"original_position":66,"commit_id":"7e796d4013043c18c5ae9c966e968a4bcaa82626","original_commit_id":"7e796d4013043c18c5ae9c966e968a4bcaa82626","user":{"login":"arahuja","id":455755,"avatar_url":"https://avatars.githubusercontent.com/u/455755?v=3","gravatar_id":"","url":"https://api.github.com/users/arahuja","html_url":"https://github.com/arahuja","followers_url":"https://api.github.com/users/arahuja/followers","following_url":"https://api.github.com/users/arahuja/following{/other_user}","gists_url":"https://api.github.com/users/arahuja/gists{/gist_id}","starred_url":"https://api.github.com/users/arahuja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arahuja/subscriptions","organizations_url":"https://api.github.com/users/arahuja/orgs","repos_url":"https://api.github.com/users/arahuja/repos","events_url":"https://api.github.com/users/arahuja/events{/privacy}","received_events_url":"https://api.github.com/users/arahuja/received_events","type":"User","site_admin":false},"body":"Great, thanks for this! adding to both test cases","created_at":"2015-07-29T17:38:30Z","updated_at":"2015-07-29T17:38:30Z","html_url":"https://github.com/hammerlab/guacamole/pull/342#discussion_r35788118","pull_request_url":"https://api.github.com/repos/hammerlab/guacamole/pulls/342","_links":{"self":{"href":"https://api.github.com/repos/hammerlab/guacamole/pulls/comments/35788118"},"html":{"href":"https://github.com/hammerlab/guacamole/pull/342#discussion_r35788118"},"pull_request":{"href":"https://api.github.com/repos/hammerlab/guacamole/pulls/342"}}},"pull_request":{"url":"https://api.github.com/repos/hammerlab/guacamole/pulls/342","id":41050232,"html_url":"https://github.com/hammerlab/guacamole/pull/342","diff_url":"https://github.com/hammerlab/guacamole/pull/342.diff","patch_url":"https://github.com/hammerlab/guacamole/pull/342.patch","issue_url":"https://api.github.com/repos/hammerlab/guacamole/issues/342","number":342,"state":"open","locked":false,"title":"Simple alignment utilities","user":{"login":"arahuja","id":455755,"avatar_url":"https://avatars.githubusercontent.com/u/455755?v=3","gravatar_id":"","url":"https://api.github.com/users/arahuja","html_url":"https://github.com/arahuja","followers_url":"https://api.github.com/users/arahuja/followers","following_url":"https://api.github.com/users/arahuja/following{/other_user}","gists_url":"https://api.github.com/users/arahuja/gists{/gist_id}","starred_url":"https://api.github.com/users/arahuja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arahuja/subscriptions","organizations_url":"https://api.github.com/users/arahuja/orgs","repos_url":"https://api.github.com/users/arahuja/repos","events_url":"https://api.github.com/users/arahuja/events{/privacy}","received_events_url":"https://api.github.com/users/arahuja/received_events","type":"User","site_admin":false},"body":"This is the first of a few pieces of #124, I wanted to break them off into smaller components to make it easier to review.\r\n\r\nThese adds a simple aligner and tests to ensure the correct CIGAR is genereated from the aligner.  There are probably many ways to make this a bit faster, but I will come back to that once the essential pieces are in.\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/hammerlab/guacamole/342)\n<!-- Reviewable:end -->\n","created_at":"2015-07-28T19:26:56Z","updated_at":"2015-07-29T17:38:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3b86caaa4083bed69ae0705c0e406d2397253e4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hammerlab/guacamole/pulls/342/commits","review_comments_url":"https://api.github.com/repos/hammerlab/guacamole/pulls/342/comments","review_comment_url":"https://api.github.com/repos/hammerlab/guacamole/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hammerlab/guacamole/issues/342/comments","statuses_url":"https://api.github.com/repos/hammerlab/guacamole/statuses/7e796d4013043c18c5ae9c966e968a4bcaa82626","head":{"label":"hammerlab:simple-alignment","ref":"simple-alignment","sha":"7e796d4013043c18c5ae9c966e968a4bcaa82626","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":18748250,"name":"guacamole","full_name":"hammerlab/guacamole","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/guacamole","description":"Simple Spark-based variant calling","fork":false,"url":"https://api.github.com/repos/hammerlab/guacamole","forks_url":"https://api.github.com/repos/hammerlab/guacamole/forks","keys_url":"https://api.github.com/repos/hammerlab/guacamole/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/guacamole/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/guacamole/teams","hooks_url":"https://api.github.com/repos/hammerlab/guacamole/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/guacamole/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/guacamole/events","assignees_url":"https://api.github.com/repos/hammerlab/guacamole/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/guacamole/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/guacamole/tags","blobs_url":"https://api.github.com/repos/hammerlab/guacamole/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/guacamole/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/guacamole/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/guacamole/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/guacamole/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/guacamole/languages","stargazers_url":"https://api.github.com/repos/hammerlab/guacamole/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/guacamole/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/guacamole/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/guacamole/subscription","commits_url":"https://api.github.com/repos/hammerlab/guacamole/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/guacamole/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/guacamole/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/guacamole/issues/comments{/number}","contents_url":"https://api.github.com/repos/hammerlab/guacamole/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/guacamole/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/guacamole/merges","archive_url":"https://api.github.com/repos/hammerlab/guacamole/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/guacamole/downloads","issues_url":"https://api.github.com/repos/hammerlab/guacamole/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/guacamole/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/guacamole/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/guacamole/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/guacamole/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/guacamole/releases{/id}","created_at":"2014-04-14T04:22:46Z","updated_at":"2015-07-24T16:17:33Z","pushed_at":"2015-07-29T16:43:35Z","git_url":"git://github.com/hammerlab/guacamole.git","ssh_url":"git@github.com:hammerlab/guacamole.git","clone_url":"https://github.com/hammerlab/guacamole.git","svn_url":"https://github.com/hammerlab/guacamole","homepage":"","size":48458,"stargazers_count":43,"watchers_count":43,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":32,"forks":9,"open_issues":32,"watchers":43,"default_branch":"master"}},"base":{"label":"hammerlab:master","ref":"master","sha":"8949cfe537cea11a9c395d90716baa96f12c6a95","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":18748250,"name":"guacamole","full_name":"hammerlab/guacamole","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/guacamole","description":"Simple Spark-based variant calling","fork":false,"url":"https://api.github.com/repos/hammerlab/guacamole","forks_url":"https://api.github.com/repos/hammerlab/guacamole/forks","keys_url":"https://api.github.com/repos/hammerlab/guacamole/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/guacamole/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/guacamole/teams","hooks_url":"https://api.github.com/repos/hammerlab/guacamole/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/guacamole/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/guacamole/events","assignees_url":"https://api.github.com/repos/hammerlab/guacamole/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/guacamole/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/guacamole/tags","blobs_url":"https://api.github.com/repos/hammerlab/guacamole/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/guacamole/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/guacamole/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/guacamole/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/guacamole/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/guacamole/languages","stargazers_url":"https://api.github.com/repos/hammerlab/guacamole/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/guacamole/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/guacamole/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/guacamole/subscription","commits_url":"https://api.github.com/repos/hammerlab/guacamole/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/guacamole/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/guacamole/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/guacamole/issues/comments{/number}","contents_url":"https://api.github.com/repos/hammerlab/guacamole/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/guacamole/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/guacamole/merges","archive_url":"https://api.github.com/repos/hammerlab/guacamole/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/guacamole/downloads","issues_url":"https://api.github.com/repos/hammerlab/guacamole/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/guacamole/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/guacamole/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/guacamole/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/guacamole/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/guacamole/releases{/id}","created_at":"2014-04-14T04:22:46Z","updated_at":"2015-07-24T16:17:33Z","pushed_at":"2015-07-29T16:43:35Z","git_url":"git://github.com/hammerlab/guacamole.git","ssh_url":"git@github.com:hammerlab/guacamole.git","clone_url":"https://github.com/hammerlab/guacamole.git","svn_url":"https://github.com/hammerlab/guacamole","homepage":"","size":48458,"stargazers_count":43,"watchers_count":43,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":32,"forks":9,"open_issues":32,"watchers":43,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hammerlab/guacamole/pulls/342"},"html":{"href":"https://github.com/hammerlab/guacamole/pull/342"},"issue":{"href":"https://api.github.com/repos/hammerlab/guacamole/issues/342"},"comments":{"href":"https://api.github.com/repos/hammerlab/guacamole/issues/342/comments"},"review_comments":{"href":"https://api.github.com/repos/hammerlab/guacamole/pulls/342/comments"},"review_comment":{"href":"https://api.github.com/repos/hammerlab/guacamole/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hammerlab/guacamole/pulls/342/commits"},"statuses":{"href":"https://api.github.com/repos/hammerlab/guacamole/statuses/7e796d4013043c18c5ae9c966e968a4bcaa82626"}}}}