{"action":"created","comment":{"url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/comments/38785450","id":38785450,"diff_hunk":"@@ -212,3 +213,74 @@ def initialize_target_cut_probabilities(self, dt):\n             for key_target in target_dict[key_domain].keys():\n                 target = target_dict[key_domain][key_target]\n                 target.compute_and_assign_cut_probability(dt)\n+\n+    def make_new_genome(self, indel_location, indel_size, new_genome):\n+        \"\"\"Re-index all domains and targets after single indel\n+        and set current_genome to new_genome\n+\n+        This is a bit headache inducing\n+        \"\"\"\n+        deleted_domains = []\n+        broken_targets = []\n+        target_dict = self.get_targets_from_genome()\n+        for key_domain in target_dict.keys():\n+            domain = self.domains[key_domain]\n+            # if domain starts past indel location\n+            if domain.domain_start > indel_location:\n+                # re-index it\n+                self.domains[key_domain].domain_start += indel_size\n+                # if this pulls start past indel location\n+                if self.domains[key_domain].domain_start < indel_location:\n+                    # set it to indel location\n+                    self.domains[key_domain].domain_start = indel_location\n+            # if domain ends past indel location\n+            if domain.domain_end > indel_location:\n+                # re-index it\n+                self.domains[key_domain].domain_end += indel_size\n+                # if this pulls end past indel location\n+                if self.domains[key_domain].domain_end < indel_location:\n+                    # set it to indel location\n+                    self.domains[key_domain].domain_end = indel_location\n+                # if start and end are the same (both location)\n+                if self.domains[key_domain].domain_start == self.domains[key_domain].domain_end:\n+                    # it has been deleted\n+                    deleted_domains.append(domain)\n+                else:\n+                    # otherwise check if it has targets to be re-indexed\n+                    for key_target in target_dict[key_domain].keys():\n+                        target = target_dict[key_domain][key_target]\n+                        if target.current_start > indel_location:\n+                            self.domains[key_domain].targets[key_target].current_start += indel_size\n+                            # if the target has been damaged or deleted\n+                            if self.domains[key_domain].targets[key_target].current_start < indel_location:\n+                                # deal with that later\n+                                broken_targets.append(self.domains[key_domain].targets[key_target])\n+        # remove all deleted domains\n+        for domain in deleted_domains:\n+            self.remove_domain(domain)\n+        # set new genome\n+        self.current_genome = new_genome\n+        # delete or fix all broken targets\n+        for target in broken_targets:\n+            domain_label = target.domain.label\n+            # if whole target is deleted\n+            if target.current_start + 20 < location:\n+                self.domains[domain_label].remove_target(target)\n+            # else it is just broken\n+            else:\n+                # find new pam, set new location, set new sequence\n+                new_start = self.find_pam(target.current_start)","path":"models/targeting/genome_classes.py","position":142,"original_position":142,"commit_id":"494b40c15553b8066332c7e7813c8196ff733319","original_commit_id":"494b40c15553b8066332c7e7813c8196ff733319","user":{"login":"mattsmart","id":5876184,"avatar_url":"https://avatars.githubusercontent.com/u/5876184?v=3","gravatar_id":"","url":"https://api.github.com/users/mattsmart","html_url":"https://github.com/mattsmart","followers_url":"https://api.github.com/users/mattsmart/followers","following_url":"https://api.github.com/users/mattsmart/following{/other_user}","gists_url":"https://api.github.com/users/mattsmart/gists{/gist_id}","starred_url":"https://api.github.com/users/mattsmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattsmart/subscriptions","organizations_url":"https://api.github.com/users/mattsmart/orgs","repos_url":"https://api.github.com/users/mattsmart/repos","events_url":"https://api.github.com/users/mattsmart/events{/privacy}","received_events_url":"https://api.github.com/users/mattsmart/received_events","type":"User","site_admin":false},"body":"still a little iffy on that method","created_at":"2015-09-04T19:18:32Z","updated_at":"2015-09-04T19:18:32Z","html_url":"https://github.com/igem-waterloo/uwaterloo-igem-2015/pull/90#discussion_r38785450","pull_request_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90","_links":{"self":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/comments/38785450"},"html":{"href":"https://github.com/igem-waterloo/uwaterloo-igem-2015/pull/90#discussion_r38785450"},"pull_request":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90"}}},"pull_request":{"url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90","id":43364788,"html_url":"https://github.com/igem-waterloo/uwaterloo-igem-2015/pull/90","diff_url":"https://github.com/igem-waterloo/uwaterloo-igem-2015/pull/90.diff","patch_url":"https://github.com/igem-waterloo/uwaterloo-igem-2015/pull/90.patch","issue_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/issues/90","number":90,"state":"open","locked":false,"title":"Large deletion + changes to repair functions","user":{"login":"Ellmen","id":11081684,"avatar_url":"https://avatars.githubusercontent.com/u/11081684?v=3","gravatar_id":"","url":"https://api.github.com/users/Ellmen","html_url":"https://github.com/Ellmen","followers_url":"https://api.github.com/users/Ellmen/followers","following_url":"https://api.github.com/users/Ellmen/following{/other_user}","gists_url":"https://api.github.com/users/Ellmen/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellmen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellmen/subscriptions","organizations_url":"https://api.github.com/users/Ellmen/orgs","repos_url":"https://api.github.com/users/Ellmen/repos","events_url":"https://api.github.com/users/Ellmen/events{/privacy}","received_events_url":"https://api.github.com/users/Ellmen/received_events","type":"User","site_admin":false},"body":"Big changes:\r\n- addition of make_new_genome function\r\n- target's repair now calls genome's repair_target directly\r\n- large deletion functionality  \r\n\r\nStill TODO:\r\n- add support for other 3 kinds of targets (backwards, other strand or both)\r\n- genome simulation\r\n- camv initialization  \r\n\r\nNotes:\r\n- this is still untested so it likely contains major bugs\r\n- please take a close look at make_new_genome and see if it makes sense","created_at":"2015-08-26T05:13:18Z","updated_at":"2015-09-04T19:18:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"696784a83134764e9fed89a92e8ebfb27f7bea6e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90/commits","review_comments_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90/comments","review_comment_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/comments{/number}","comments_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/issues/90/comments","statuses_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/statuses/494b40c15553b8066332c7e7813c8196ff733319","head":{"label":"Ellmen:master","ref":"master","sha":"494b40c15553b8066332c7e7813c8196ff733319","user":{"login":"Ellmen","id":11081684,"avatar_url":"https://avatars.githubusercontent.com/u/11081684?v=3","gravatar_id":"","url":"https://api.github.com/users/Ellmen","html_url":"https://github.com/Ellmen","followers_url":"https://api.github.com/users/Ellmen/followers","following_url":"https://api.github.com/users/Ellmen/following{/other_user}","gists_url":"https://api.github.com/users/Ellmen/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellmen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellmen/subscriptions","organizations_url":"https://api.github.com/users/Ellmen/orgs","repos_url":"https://api.github.com/users/Ellmen/repos","events_url":"https://api.github.com/users/Ellmen/events{/privacy}","received_events_url":"https://api.github.com/users/Ellmen/received_events","type":"User","site_admin":false},"repo":{"id":40611168,"name":"uwaterloo-igem-2015","full_name":"Ellmen/uwaterloo-igem-2015","owner":{"login":"Ellmen","id":11081684,"avatar_url":"https://avatars.githubusercontent.com/u/11081684?v=3","gravatar_id":"","url":"https://api.github.com/users/Ellmen","html_url":"https://github.com/Ellmen","followers_url":"https://api.github.com/users/Ellmen/followers","following_url":"https://api.github.com/users/Ellmen/following{/other_user}","gists_url":"https://api.github.com/users/Ellmen/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellmen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellmen/subscriptions","organizations_url":"https://api.github.com/users/Ellmen/orgs","repos_url":"https://api.github.com/users/Ellmen/repos","events_url":"https://api.github.com/users/Ellmen/events{/privacy}","received_events_url":"https://api.github.com/users/Ellmen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Ellmen/uwaterloo-igem-2015","description":"Software for the 2015 Waterloo iGEM Team","fork":true,"url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015","forks_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/forks","keys_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/teams","hooks_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/hooks","issue_events_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/issues/events{/number}","events_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/events","assignees_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/assignees{/user}","branches_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/branches{/branch}","tags_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/tags","blobs_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/statuses/{sha}","languages_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/languages","stargazers_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/stargazers","contributors_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/contributors","subscribers_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/subscribers","subscription_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/subscription","commits_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/contents/{+path}","compare_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/merges","archive_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/downloads","issues_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/issues{/number}","pulls_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/pulls{/number}","milestones_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/milestones{/number}","notifications_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/labels{/name}","releases_url":"https://api.github.com/repos/Ellmen/uwaterloo-igem-2015/releases{/id}","created_at":"2015-08-12T16:18:34Z","updated_at":"2015-08-12T16:18:35Z","pushed_at":"2015-08-29T23:57:56Z","git_url":"git://github.com/Ellmen/uwaterloo-igem-2015.git","ssh_url":"git@github.com:Ellmen/uwaterloo-igem-2015.git","clone_url":"https://github.com/Ellmen/uwaterloo-igem-2015.git","svn_url":"https://github.com/Ellmen/uwaterloo-igem-2015","homepage":null,"size":766,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"igem-waterloo:master","ref":"master","sha":"69d296398a1b7e734b9058da2c603cca0c94d77b","user":{"login":"igem-waterloo","id":9440674,"avatar_url":"https://avatars.githubusercontent.com/u/9440674?v=3","gravatar_id":"","url":"https://api.github.com/users/igem-waterloo","html_url":"https://github.com/igem-waterloo","followers_url":"https://api.github.com/users/igem-waterloo/followers","following_url":"https://api.github.com/users/igem-waterloo/following{/other_user}","gists_url":"https://api.github.com/users/igem-waterloo/gists{/gist_id}","starred_url":"https://api.github.com/users/igem-waterloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igem-waterloo/subscriptions","organizations_url":"https://api.github.com/users/igem-waterloo/orgs","repos_url":"https://api.github.com/users/igem-waterloo/repos","events_url":"https://api.github.com/users/igem-waterloo/events{/privacy}","received_events_url":"https://api.github.com/users/igem-waterloo/received_events","type":"Organization","site_admin":false},"repo":{"id":32051310,"name":"uwaterloo-igem-2015","full_name":"igem-waterloo/uwaterloo-igem-2015","owner":{"login":"igem-waterloo","id":9440674,"avatar_url":"https://avatars.githubusercontent.com/u/9440674?v=3","gravatar_id":"","url":"https://api.github.com/users/igem-waterloo","html_url":"https://github.com/igem-waterloo","followers_url":"https://api.github.com/users/igem-waterloo/followers","following_url":"https://api.github.com/users/igem-waterloo/following{/other_user}","gists_url":"https://api.github.com/users/igem-waterloo/gists{/gist_id}","starred_url":"https://api.github.com/users/igem-waterloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igem-waterloo/subscriptions","organizations_url":"https://api.github.com/users/igem-waterloo/orgs","repos_url":"https://api.github.com/users/igem-waterloo/repos","events_url":"https://api.github.com/users/igem-waterloo/events{/privacy}","received_events_url":"https://api.github.com/users/igem-waterloo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/igem-waterloo/uwaterloo-igem-2015","description":"Software for the 2015 Waterloo iGEM Team","fork":false,"url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015","forks_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/forks","keys_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/teams","hooks_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/hooks","issue_events_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/issues/events{/number}","events_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/events","assignees_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/assignees{/user}","branches_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/branches{/branch}","tags_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/tags","blobs_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/statuses/{sha}","languages_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/languages","stargazers_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/stargazers","contributors_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/contributors","subscribers_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/subscribers","subscription_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/subscription","commits_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/contents/{+path}","compare_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/merges","archive_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/downloads","issues_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/issues{/number}","pulls_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls{/number}","milestones_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/milestones{/number}","notifications_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/labels{/name}","releases_url":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/releases{/id}","created_at":"2015-03-12T01:50:27Z","updated_at":"2015-07-24T18:26:52Z","pushed_at":"2015-09-04T05:31:30Z","git_url":"git://github.com/igem-waterloo/uwaterloo-igem-2015.git","ssh_url":"git@github.com:igem-waterloo/uwaterloo-igem-2015.git","clone_url":"https://github.com/igem-waterloo/uwaterloo-igem-2015.git","svn_url":"https://github.com/igem-waterloo/uwaterloo-igem-2015","homepage":null,"size":2407,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"open_issues_count":3,"forks":18,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90"},"html":{"href":"https://github.com/igem-waterloo/uwaterloo-igem-2015/pull/90"},"issue":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/issues/90"},"comments":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/issues/90/comments"},"review_comments":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90/comments"},"review_comment":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/pulls/90/commits"},"statuses":{"href":"https://api.github.com/repos/igem-waterloo/uwaterloo-igem-2015/statuses/494b40c15553b8066332c7e7813c8196ff733319"}}}}