GitHub PullRequestReviewCommentEvent at 2014-07-29 00:07:45
Repository: Bio.jl
Actor: diegozea
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/comments/15499598","id":15499598,"diff_hunk":"@@ -0,0 +1,406 @@\n+\n+bitstype 8 AminoAcid\n+\n+\n+# Conversion between integers and amino acids\n+function convert(::Type{AminoAcid}, aa::Uint8)\n+    return box(AminoAcid, unbox(Uint8, aa))\n+end\n+\n+\n+function convert(::Type{Uint8}, aa::AminoAcid)\n+    return box(Uint8, unbox(AminoAcid, aa))\n+end\n+\n+\n+function convert{T <: Unsigned}(::Type{T}, aa::AminoAcid)\n+    return box(T, Base.zext_int(T, unbox(AminoAcid, aa)))\n+end\n+\n+\n+function convert{T <: Unsigned}(::Type{AminoAcid}, aa::T)\n+    return convert(AminoAcid, convert(Uint8, aa))\n+end\n+\n+\n+# Amino acid encoding definition\n+const AA_A = convert(AminoAcid, 0x00)\n+const AA_R = convert(AminoAcid, 0x01)\n+const AA_N = convert(AminoAcid, 0x02)\n+const AA_D = convert(AminoAcid, 0x03)\n+const AA_C = convert(AminoAcid, 0x04)\n+const AA_Q = convert(AminoAcid, 0x05)\n+const AA_E = convert(AminoAcid, 0x06)\n+const AA_G = convert(AminoAcid, 0x07)\n+const AA_H = convert(AminoAcid, 0x08)\n+const AA_I = convert(AminoAcid, 0x09)\n+const AA_L = convert(AminoAcid, 0x0a)\n+const AA_K = convert(AminoAcid, 0x0b)\n+const AA_M = convert(AminoAcid, 0x0c)\n+const AA_F = convert(AminoAcid, 0x0d)\n+const AA_P = convert(AminoAcid, 0x0e)\n+const AA_S = convert(AminoAcid, 0x0f)\n+const AA_T = convert(AminoAcid, 0x10)\n+const AA_W = convert(AminoAcid, 0x11)\n+const AA_Y = convert(AminoAcid, 0x12)\n+const AA_V = convert(AminoAcid, 0x13)\n+const AA_X = convert(AminoAcid, 0x14)\n+\n+\n+# Use during conversion from strings\n+const AA_INVALID = convert(AminoAcid, 0x15)","path":"src/seq/aminoacid.jl","position":51,"original_position":51,"commit_id":"c8335d09b71f2844c72ee817bc899af234e2e2c1","original_commit_id":"c8335d09b71f2844c72ee817bc899af234e2e2c1","user":{"login":"diegozea","id":2822757,"avatar_url":"https://avatars.githubusercontent.com/u/2822757?","gravatar_id":"fa3b781987ef53c4d3b8397f2239e519","url":"https://api.github.com/users/diegozea","html_url":"https://github.com/diegozea","followers_url":"https://api.github.com/users/diegozea/followers","following_url":"https://api.github.com/users/diegozea/following{/other_user}","gists_url":"https://api.github.com/users/diegozea/gists{/gist_id}","starred_url":"https://api.github.com/users/diegozea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diegozea/subscriptions","organizations_url":"https://api.github.com/users/diegozea/orgs","repos_url":"https://api.github.com/users/diegozea/repos","events_url":"https://api.github.com/users/diegozea/events{/privacy}","received_events_url":"https://api.github.com/users/diegozea/received_events","type":"User","site_admin":false},"body":"If ```AA_INVALID``` is ```0x00``` instead of ```0x15```, there is not need to sum ```+1``` for indexing on ```convert( ::Type{Char}, aa::AminoAcid )```","created_at":"2014-07-29T00:07:45Z","updated_at":"2014-07-29T00:07:45Z","html_url":"https://github.com/BioJulia/Bio.jl/pull/15#discussion_r15499598","pull_request_url":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/comments/15499598"},"html":{"href":"https://github.com/BioJulia/Bio.jl/pull/15#discussion_r15499598"},"pull_request":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15","id":18315796,"html_url":"https://github.com/BioJulia/Bio.jl/pull/15","diff_url":"https://github.com/BioJulia/Bio.jl/pull/15.diff","patch_url":"https://github.com/BioJulia/Bio.jl/pull/15.patch","issue_url":"https://api.github.com/repos/BioJulia/Bio.jl/issues/15","number":15,"state":"open","title":"WIP: Sequences","user":{"login":"dcjones","id":210361,"avatar_url":"https://avatars.githubusercontent.com/u/210361?","gravatar_id":"fd97b03d16e1aa4c404391216d81c1d5","url":"https://api.github.com/users/dcjones","html_url":"https://github.com/dcjones","followers_url":"https://api.github.com/users/dcjones/followers","following_url":"https://api.github.com/users/dcjones/following{/other_user}","gists_url":"https://api.github.com/users/dcjones/gists{/gist_id}","starred_url":"https://api.github.com/users/dcjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcjones/subscriptions","organizations_url":"https://api.github.com/users/dcjones/orgs","repos_url":"https://api.github.com/users/dcjones/repos","events_url":"https://api.github.com/users/dcjones/events{/privacy}","received_events_url":"https://api.github.com/users/dcjones/received_events","type":"User","site_admin":false},"body":"I'm starting in on sequences. I laid out the basic design I had in mind in #6. I'll document my progress, and any changes to that design as I add commits to this PR.\r\n\r\nProgress so far: I have a `NucleotideSequence` type (and specializations `DNASequence` and `RNASequence` that uses 2-bit encoding).\r\n\r\nOne major decision I've made since starting work is that sequence types should be immutable. Immutable sequence types allow for cheap subsequences, since you don't have to copy the actual sequence, just specify a range, as long as you can assume the data won't change. It is a tradeoff, but cheap subsequences would allow, for example, extracting the sequence of every exon in the human genome extremely efficiently.\r\n\r\nI've already implemented the cheap subsequence idea, so you can do:\r\n```julia\r\nx = dna\"ACCCATGATANNNTAGATTTTATAGATAT\"\r\ny = x[5:10]\r\n```\r\nNo copying of the underlying sequence is performed and `typeof(x) == typeof(y) == DNASequence`, so subsequences are first-class citizens, and indistinguishable from sequences.\r\n\r\nWhat I'm struggling with now: my initial idea was to indicate Ns in the sequence using an IntervalTree. I'm worried now that the efficiency of that implementation depends too much on the assumption that Ns are rare and occur in large blocks. Sequence construction is now unacceptably slow if I use random sequences with `N` occurring with 0.2 probability. Constructing 1e6nt sequence from a string takes 0.01 seconds without `N` and 0.38 seconds with N in these perverse random sequences.\r\n\r\nI'm thinking now of an alternate data structure I can use, maybe something based on run-length encoding. \r\n\r\n","created_at":"2014-07-12T17:01:17Z","updated_at":"2014-07-29T00:07:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3cd988c189a5d8937862215bd1d9c174647751f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15/commits","review_comments_url":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15/comments","review_comment_url":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/comments/{number}","comments_url":"https://api.github.com/repos/BioJulia/Bio.jl/issues/15/comments","statuses_url":"https://api.github.com/repos/BioJulia/Bio.jl/statuses/c8335d09b71f2844c72ee817bc899af234e2e2c1","head":{"label":"dcjones:seq","ref":"seq","sha":"c8335d09b71f2844c72ee817bc899af234e2e2c1","user":{"login":"dcjones","id":210361,"avatar_url":"https://avatars.githubusercontent.com/u/210361?","gravatar_id":"fd97b03d16e1aa4c404391216d81c1d5","url":"https://api.github.com/users/dcjones","html_url":"https://github.com/dcjones","followers_url":"https://api.github.com/users/dcjones/followers","following_url":"https://api.github.com/users/dcjones/following{/other_user}","gists_url":"https://api.github.com/users/dcjones/gists{/gist_id}","starred_url":"https://api.github.com/users/dcjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcjones/subscriptions","organizations_url":"https://api.github.com/users/dcjones/orgs","repos_url":"https://api.github.com/users/dcjones/repos","events_url":"https://api.github.com/users/dcjones/events{/privacy}","received_events_url":"https://api.github.com/users/dcjones/received_events","type":"User","site_admin":false},"repo":{"id":18717747,"name":"Bio.jl","full_name":"dcjones/Bio.jl","owner":{"login":"dcjones","id":210361,"avatar_url":"https://avatars.githubusercontent.com/u/210361?","gravatar_id":"fd97b03d16e1aa4c404391216d81c1d5","url":"https://api.github.com/users/dcjones","html_url":"https://github.com/dcjones","followers_url":"https://api.github.com/users/dcjones/followers","following_url":"https://api.github.com/users/dcjones/following{/other_user}","gists_url":"https://api.github.com/users/dcjones/gists{/gist_id}","starred_url":"https://api.github.com/users/dcjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcjones/subscriptions","organizations_url":"https://api.github.com/users/dcjones/orgs","repos_url":"https://api.github.com/users/dcjones/repos","events_url":"https://api.github.com/users/dcjones/events{/privacy}","received_events_url":"https://api.github.com/users/dcjones/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dcjones/Bio.jl","description":"Bioinformatics and Computational Biology Infrastructure for Julia","fork":true,"url":"https://api.github.com/repos/dcjones/Bio.jl","forks_url":"https://api.github.com/repos/dcjones/Bio.jl/forks","keys_url":"https://api.github.com/repos/dcjones/Bio.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcjones/Bio.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcjones/Bio.jl/teams","hooks_url":"https://api.github.com/repos/dcjones/Bio.jl/hooks","issue_events_url":"https://api.github.com/repos/dcjones/Bio.jl/issues/events{/number}","events_url":"https://api.github.com/repos/dcjones/Bio.jl/events","assignees_url":"https://api.github.com/repos/dcjones/Bio.jl/assignees{/user}","branches_url":"https://api.github.com/repos/dcjones/Bio.jl/branches{/branch}","tags_url":"https://api.github.com/repos/dcjones/Bio.jl/tags","blobs_url":"https://api.github.com/repos/dcjones/Bio.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcjones/Bio.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcjones/Bio.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcjones/Bio.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcjones/Bio.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/dcjones/Bio.jl/languages","stargazers_url":"https://api.github.com/repos/dcjones/Bio.jl/stargazers","contributors_url":"https://api.github.com/repos/dcjones/Bio.jl/contributors","subscribers_url":"https://api.github.com/repos/dcjones/Bio.jl/subscribers","subscription_url":"https://api.github.com/repos/dcjones/Bio.jl/subscription","commits_url":"https://api.github.com/repos/dcjones/Bio.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcjones/Bio.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcjones/Bio.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcjones/Bio.jl/issues/comments/{number}","contents_url":"https://api.github.com/repos/dcjones/Bio.jl/contents/{+path}","compare_url":"https://api.github.com/repos/dcjones/Bio.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcjones/Bio.jl/merges","archive_url":"https://api.github.com/repos/dcjones/Bio.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcjones/Bio.jl/downloads","issues_url":"https://api.github.com/repos/dcjones/Bio.jl/issues{/number}","pulls_url":"https://api.github.com/repos/dcjones/Bio.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/dcjones/Bio.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/dcjones/Bio.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcjones/Bio.jl/labels{/name}","releases_url":"https://api.github.com/repos/dcjones/Bio.jl/releases{/id}","created_at":"2014-04-13T00:07:28Z","updated_at":"2014-07-16T16:30:52Z","pushed_at":"2014-07-28T06:13:51Z","git_url":"git://github.com/dcjones/Bio.jl.git","ssh_url":"git@github.com:dcjones/Bio.jl.git","clone_url":"https://github.com/dcjones/Bio.jl.git","svn_url":"https://github.com/dcjones/Bio.jl","homepage":"","size":299,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"BioJulia:master","ref":"master","sha":"26547403ebaaabc5e7ece07f0d8ee73656c4d744","user":{"login":"BioJulia","id":6486271,"avatar_url":"https://avatars.githubusercontent.com/u/6486271?","gravatar_id":"27514543b4ba07262115e4f69b1f7433","url":"https://api.github.com/users/BioJulia","html_url":"https://github.com/BioJulia","followers_url":"https://api.github.com/users/BioJulia/followers","following_url":"https://api.github.com/users/BioJulia/following{/other_user}","gists_url":"https://api.github.com/users/BioJulia/gists{/gist_id}","starred_url":"https://api.github.com/users/BioJulia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BioJulia/subscriptions","organizations_url":"https://api.github.com/users/BioJulia/orgs","repos_url":"https://api.github.com/users/BioJulia/repos","events_url":"https://api.github.com/users/BioJulia/events{/privacy}","received_events_url":"https://api.github.com/users/BioJulia/received_events","type":"Organization","site_admin":false},"repo":{"id":16187538,"name":"Bio.jl","full_name":"BioJulia/Bio.jl","owner":{"login":"BioJulia","id":6486271,"avatar_url":"https://avatars.githubusercontent.com/u/6486271?","gravatar_id":"27514543b4ba07262115e4f69b1f7433","url":"https://api.github.com/users/BioJulia","html_url":"https://github.com/BioJulia","followers_url":"https://api.github.com/users/BioJulia/followers","following_url":"https://api.github.com/users/BioJulia/following{/other_user}","gists_url":"https://api.github.com/users/BioJulia/gists{/gist_id}","starred_url":"https://api.github.com/users/BioJulia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BioJulia/subscriptions","organizations_url":"https://api.github.com/users/BioJulia/orgs","repos_url":"https://api.github.com/users/BioJulia/repos","events_url":"https://api.github.com/users/BioJulia/events{/privacy}","received_events_url":"https://api.github.com/users/BioJulia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BioJulia/Bio.jl","description":"Bioinformatics and Computational Biology Infrastructure for Julia","fork":false,"url":"https://api.github.com/repos/BioJulia/Bio.jl","forks_url":"https://api.github.com/repos/BioJulia/Bio.jl/forks","keys_url":"https://api.github.com/repos/BioJulia/Bio.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BioJulia/Bio.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BioJulia/Bio.jl/teams","hooks_url":"https://api.github.com/repos/BioJulia/Bio.jl/hooks","issue_events_url":"https://api.github.com/repos/BioJulia/Bio.jl/issues/events{/number}","events_url":"https://api.github.com/repos/BioJulia/Bio.jl/events","assignees_url":"https://api.github.com/repos/BioJulia/Bio.jl/assignees{/user}","branches_url":"https://api.github.com/repos/BioJulia/Bio.jl/branches{/branch}","tags_url":"https://api.github.com/repos/BioJulia/Bio.jl/tags","blobs_url":"https://api.github.com/repos/BioJulia/Bio.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BioJulia/Bio.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BioJulia/Bio.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/BioJulia/Bio.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BioJulia/Bio.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/BioJulia/Bio.jl/languages","stargazers_url":"https://api.github.com/repos/BioJulia/Bio.jl/stargazers","contributors_url":"https://api.github.com/repos/BioJulia/Bio.jl/contributors","subscribers_url":"https://api.github.com/repos/BioJulia/Bio.jl/subscribers","subscription_url":"https://api.github.com/repos/BioJulia/Bio.jl/subscription","commits_url":"https://api.github.com/repos/BioJulia/Bio.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/BioJulia/Bio.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/BioJulia/Bio.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/BioJulia/Bio.jl/issues/comments/{number}","contents_url":"https://api.github.com/repos/BioJulia/Bio.jl/contents/{+path}","compare_url":"https://api.github.com/repos/BioJulia/Bio.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BioJulia/Bio.jl/merges","archive_url":"https://api.github.com/repos/BioJulia/Bio.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BioJulia/Bio.jl/downloads","issues_url":"https://api.github.com/repos/BioJulia/Bio.jl/issues{/number}","pulls_url":"https://api.github.com/repos/BioJulia/Bio.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/BioJulia/Bio.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/BioJulia/Bio.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BioJulia/Bio.jl/labels{/name}","releases_url":"https://api.github.com/repos/BioJulia/Bio.jl/releases{/id}","created_at":"2014-01-23T22:20:21Z","updated_at":"2014-07-28T17:15:51Z","pushed_at":"2014-04-13T00:15:03Z","git_url":"git://github.com/BioJulia/Bio.jl.git","ssh_url":"git@github.com:BioJulia/Bio.jl.git","clone_url":"https://github.com/BioJulia/Bio.jl.git","svn_url":"https://github.com/BioJulia/Bio.jl","homepage":"","size":780,"stargazers_count":20,"watchers_count":20,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":8,"mirror_url":null,"open_issues_count":11,"forks":8,"open_issues":11,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15"},"html":{"href":"https://github.com/BioJulia/Bio.jl/pull/15"},"issue":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/issues/15"},"comments":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/BioJulia/Bio.jl/statuses/c8335d09b71f2844c72ee817bc899af234e2e2c1"}}}}