payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/comments/268730676","pull_request_review_id":218423717,"id":268730676,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2ODczMDY3Ng==","diff_hunk":"@@ -185,4 +185,78 @@ def genetic_modification_5_6(value, system):\n def genetic_modification_6_7(value, system):\n     # https://encodedcc.atlassian.net/browse/ENCD-4042\n     if value['purpose'] == 'validation':\n-        value['purpose'] = 'characterization'\n\\ No newline at end of file\n+        value['purpose'] = 'characterization'\n+\n+\n+@upgrade_step('genetic_modification', '7', '8')\n+def genetic_modification_7_8(value, system):\n+    # https://encodedcc.atlassian.net/browse/ENCD-4349\n+    import re\n+    import copy\n+    import time\n+    import json\n+\n+    conn = system['registry'][CONNECTION]\n+\n+    sources = {\n+        'addgene': r'^\\d{5,6}$',\n+        'bacpac': r'^([A-Z]{2,3}\\d{2,3}|[A-Z]{3})-\\d{1,4}[A-Z]\\d{1,2}$',\n+        'dharmacon': r'^[DL]-\\d{6}-\\d{2}(-\\d{2,4})?$',\n+        'hugo-bellen': r'^MI\\d{5}$',\n+        'human-orfeome': r'^([A-Z]{2})?\\d{1,9}$',\n+        'plasmid-repository': r'^HsCD\\d{8}$',\n+        'sigma': r'^[A-Z]{3}\\d{3}$',\n+        'source-bioscience': r'^[A-Z]{3}\\d{3,4}[a-z][A-Z]\\d{2}(_[A-Z]\\d{2})?$',\n+        'thermo-fisher': r'^[a-zA-Z]{1,3}\\d{5,6}$',\n+        'trc': r'^TRCN\\d{10}$',\n+        'brenton-graveley': r'^BGC#\\d{7}$'\n+    }\n+    reagents = value.get('reagents')\n+    if reagents:\n+        new_reagents = []\n+        unmatched_reagents = ''\n+        for reagent in reagents:\n+            identifier = reagent['identifier']\n+            source_id = reagent['source']\n+            source_obj = conn.get_by_uuid(source_id)\n+            source_name = source_obj.properties['name']\n+            new_reagent = copy.deepcopy(reagent)\n+            matching = []\n+            source_from_reagent = None\n+            for source in sources:\n+                if source in source_name:\n+                    source_from_reagent = source_name\n+                    break\n+            # Preferentially add prefix to reagent that matches the reagent source\n+            if source_from_reagent is not None:\n+                regex = sources[source_from_reagent]\n+                if re.match(regex, identifier) is not None:\n+                    matching.append((source_name, source_from_reagent, identifier))\n+            else:\n+                for source, regex in sources.items():\n+                    if re.match(regex, identifier) is not None:\n+                        matching.append((source_name, source, identifier))\n+            if not matching:\n+                unmatched_reagents += '{} '.format(json.dumps(reagent))\n+            else:\n+                if len(matching) >= 2:\n+                    # Bring the identifier with matching source to the reagent to the top\n+                    matching.sort(key=lambda match: int(match[1] in match[0]), reverse=True)\n+                    # matching = [i for i in matching if i[1] in i[0]]\n+                _, source, identifier = matching[0]\n+                new_identifier = ('{}:{}'.format(source, identifier))\n+                new_reagent['identifier'] = new_identifier\n+                new_reagents.append(new_reagent)\n+        # Dump the unmatched identifier reagents to the notes\n+        if unmatched_reagents:","path":"src/encoded/upgrade/genetic_modification.py","position":69,"original_position":69,"commit_id":"4eb404bc918a22790318de54bba0a9b8cd2205c7","original_commit_id":"4eb404bc918a22790318de54bba0a9b8cd2205c7","user":{"login":"caseylitton","id":6748589,"node_id":"MDQ6VXNlcjY3NDg1ODk=","avatar_url":"https://avatars3.githubusercontent.com/u/6748589?v=4","gravatar_id":"","url":"https://api.github.com/users/caseylitton","html_url":"https://github.com/caseylitton","followers_url":"https://api.github.com/users/caseylitton/followers","following_url":"https://api.github.com/users/caseylitton/following{/other_user}","gists_url":"https://api.github.com/users/caseylitton/gists{/gist_id}","starred_url":"https://api.github.com/users/caseylitton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseylitton/subscriptions","organizations_url":"https://api.github.com/users/caseylitton/orgs","repos_url":"https://api.github.com/users/caseylitton/repos","events_url":"https://api.github.com/users/caseylitton/events{/privacy}","received_events_url":"https://api.github.com/users/caseylitton/received_events","type":"User","site_admin":false},"body":"This block of code is different, it creates value['notes'] based on unmatched reagents.  But it sitting in between code that acts on value['reagents'].  But they are not dependent on each other.  I might finish with the value reagents and then create the value notes at the end.","created_at":"2019-03-25T16:22:57Z","updated_at":"2019-03-25T16:34:27Z","html_url":"https://github.com/ENCODE-DCC/encoded/pull/2672#discussion_r268730676","pull_request_url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/comments/268730676"},"html":{"href":"https://github.com/ENCODE-DCC/encoded/pull/2672#discussion_r268730676"},"pull_request":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672"}}},"pull_request":{"url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672","id":263311292,"node_id":"MDExOlB1bGxSZXF1ZXN0MjYzMzExMjky","html_url":"https://github.com/ENCODE-DCC/encoded/pull/2672","diff_url":"https://github.com/ENCODE-DCC/encoded/pull/2672.diff","patch_url":"https://github.com/ENCODE-DCC/encoded/pull/2672.patch","issue_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/2672","number":2672,"state":"open","locked":false,"title":"ENCD-4349 restrict gm reagents","user":{"login":"p-sud","id":41386393,"node_id":"MDQ6VXNlcjQxMzg2Mzkz","avatar_url":"https://avatars2.githubusercontent.com/u/41386393?v=4","gravatar_id":"","url":"https://api.github.com/users/p-sud","html_url":"https://github.com/p-sud","followers_url":"https://api.github.com/users/p-sud/followers","following_url":"https://api.github.com/users/p-sud/following{/other_user}","gists_url":"https://api.github.com/users/p-sud/gists{/gist_id}","starred_url":"https://api.github.com/users/p-sud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p-sud/subscriptions","organizations_url":"https://api.github.com/users/p-sud/orgs","repos_url":"https://api.github.com/users/p-sud/repos","events_url":"https://api.github.com/users/p-sud/events{/privacy}","received_events_url":"https://api.github.com/users/p-sud/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-03-21T16:29:46Z","updated_at":"2019-03-25T16:34:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02e269727b7534f5fc48996fd0bcaad5c76918f4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672/commits","review_comments_url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672/comments","review_comment_url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/2672/comments","statuses_url":"https://api.github.com/repos/ENCODE-DCC/encoded/statuses/4eb404bc918a22790318de54bba0a9b8cd2205c7","head":{"label":"ENCODE-DCC:ENCD-4349-restrict-gm-reagents","ref":"ENCD-4349-restrict-gm-reagents","sha":"4eb404bc918a22790318de54bba0a9b8cd2205c7","user":{"login":"ENCODE-DCC","id":1713898,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTM4OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/1713898?v=4","gravatar_id":"","url":"https://api.github.com/users/ENCODE-DCC","html_url":"https://github.com/ENCODE-DCC","followers_url":"https://api.github.com/users/ENCODE-DCC/followers","following_url":"https://api.github.com/users/ENCODE-DCC/following{/other_user}","gists_url":"https://api.github.com/users/ENCODE-DCC/gists{/gist_id}","starred_url":"https://api.github.com/users/ENCODE-DCC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ENCODE-DCC/subscriptions","organizations_url":"https://api.github.com/users/ENCODE-DCC/orgs","repos_url":"https://api.github.com/users/ENCODE-DCC/repos","events_url":"https://api.github.com/users/ENCODE-DCC/events{/privacy}","received_events_url":"https://api.github.com/users/ENCODE-DCC/received_events","type":"Organization","site_admin":false},"repo":{"id":7045549,"node_id":"MDEwOlJlcG9zaXRvcnk3MDQ1NTQ5","name":"encoded","full_name":"ENCODE-DCC/encoded","private":false,"owner":{"login":"ENCODE-DCC","id":1713898,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTM4OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/1713898?v=4","gravatar_id":"","url":"https://api.github.com/users/ENCODE-DCC","html_url":"https://github.com/ENCODE-DCC","followers_url":"https://api.github.com/users/ENCODE-DCC/followers","following_url":"https://api.github.com/users/ENCODE-DCC/following{/other_user}","gists_url":"https://api.github.com/users/ENCODE-DCC/gists{/gist_id}","starred_url":"https://api.github.com/users/ENCODE-DCC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ENCODE-DCC/subscriptions","organizations_url":"https://api.github.com/users/ENCODE-DCC/orgs","repos_url":"https://api.github.com/users/ENCODE-DCC/repos","events_url":"https://api.github.com/users/ENCODE-DCC/events{/privacy}","received_events_url":"https://api.github.com/users/ENCODE-DCC/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ENCODE-DCC/encoded","description":"Metadata database for ENCODE project","fork":false,"url":"https://api.github.com/repos/ENCODE-DCC/encoded","forks_url":"https://api.github.com/repos/ENCODE-DCC/encoded/forks","keys_url":"https://api.github.com/repos/ENCODE-DCC/encoded/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ENCODE-DCC/encoded/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ENCODE-DCC/encoded/teams","hooks_url":"https://api.github.com/repos/ENCODE-DCC/encoded/hooks","issue_events_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/events{/number}","events_url":"https://api.github.com/repos/ENCODE-DCC/encoded/events","assignees_url":"https://api.github.com/repos/ENCODE-DCC/encoded/assignees{/user}","branches_url":"https://api.github.com/repos/ENCODE-DCC/encoded/branches{/branch}","tags_url":"https://api.github.com/repos/ENCODE-DCC/encoded/tags","blobs_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/refs{/sha}","trees_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ENCODE-DCC/encoded/statuses/{sha}","languages_url":"https://api.github.com/repos/ENCODE-DCC/encoded/languages","stargazers_url":"https://api.github.com/repos/ENCODE-DCC/encoded/stargazers","contributors_url":"https://api.github.com/repos/ENCODE-DCC/encoded/contributors","subscribers_url":"https://api.github.com/repos/ENCODE-DCC/encoded/subscribers","subscription_url":"https://api.github.com/repos/ENCODE-DCC/encoded/subscription","commits_url":"https://api.github.com/repos/ENCODE-DCC/encoded/commits{/sha}","git_commits_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/commits{/sha}","comments_url":"https://api.github.com/repos/ENCODE-DCC/encoded/comments{/number}","issue_comment_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/comments{/number}","contents_url":"https://api.github.com/repos/ENCODE-DCC/encoded/contents/{+path}","compare_url":"https://api.github.com/repos/ENCODE-DCC/encoded/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ENCODE-DCC/encoded/merges","archive_url":"https://api.github.com/repos/ENCODE-DCC/encoded/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ENCODE-DCC/encoded/downloads","issues_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues{/number}","pulls_url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls{/number}","milestones_url":"https://api.github.com/repos/ENCODE-DCC/encoded/milestones{/number}","notifications_url":"https://api.github.com/repos/ENCODE-DCC/encoded/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ENCODE-DCC/encoded/labels{/name}","releases_url":"https://api.github.com/repos/ENCODE-DCC/encoded/releases{/id}","deployments_url":"https://api.github.com/repos/ENCODE-DCC/encoded/deployments","created_at":"2012-12-07T00:52:21Z","updated_at":"2019-03-21T21:15:11Z","pushed_at":"2019-03-25T16:05:07Z","git_url":"git://github.com/ENCODE-DCC/encoded.git","ssh_url":"git@github.com:ENCODE-DCC/encoded.git","clone_url":"https://github.com/ENCODE-DCC/encoded.git","svn_url":"https://github.com/ENCODE-DCC/encoded","homepage":"https://www.encodeproject.org","size":139638,"stargazers_count":61,"watchers_count":61,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":31,"open_issues":25,"watchers":61,"default_branch":"dev"}},"base":{"label":"ENCODE-DCC:dev","ref":"dev","sha":"775f2bc100382cda99d912c74f436226e9d5aa14","user":{"login":"ENCODE-DCC","id":1713898,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTM4OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/1713898?v=4","gravatar_id":"","url":"https://api.github.com/users/ENCODE-DCC","html_url":"https://github.com/ENCODE-DCC","followers_url":"https://api.github.com/users/ENCODE-DCC/followers","following_url":"https://api.github.com/users/ENCODE-DCC/following{/other_user}","gists_url":"https://api.github.com/users/ENCODE-DCC/gists{/gist_id}","starred_url":"https://api.github.com/users/ENCODE-DCC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ENCODE-DCC/subscriptions","organizations_url":"https://api.github.com/users/ENCODE-DCC/orgs","repos_url":"https://api.github.com/users/ENCODE-DCC/repos","events_url":"https://api.github.com/users/ENCODE-DCC/events{/privacy}","received_events_url":"https://api.github.com/users/ENCODE-DCC/received_events","type":"Organization","site_admin":false},"repo":{"id":7045549,"node_id":"MDEwOlJlcG9zaXRvcnk3MDQ1NTQ5","name":"encoded","full_name":"ENCODE-DCC/encoded","private":false,"owner":{"login":"ENCODE-DCC","id":1713898,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTM4OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/1713898?v=4","gravatar_id":"","url":"https://api.github.com/users/ENCODE-DCC","html_url":"https://github.com/ENCODE-DCC","followers_url":"https://api.github.com/users/ENCODE-DCC/followers","following_url":"https://api.github.com/users/ENCODE-DCC/following{/other_user}","gists_url":"https://api.github.com/users/ENCODE-DCC/gists{/gist_id}","starred_url":"https://api.github.com/users/ENCODE-DCC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ENCODE-DCC/subscriptions","organizations_url":"https://api.github.com/users/ENCODE-DCC/orgs","repos_url":"https://api.github.com/users/ENCODE-DCC/repos","events_url":"https://api.github.com/users/ENCODE-DCC/events{/privacy}","received_events_url":"https://api.github.com/users/ENCODE-DCC/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ENCODE-DCC/encoded","description":"Metadata database for ENCODE project","fork":false,"url":"https://api.github.com/repos/ENCODE-DCC/encoded","forks_url":"https://api.github.com/repos/ENCODE-DCC/encoded/forks","keys_url":"https://api.github.com/repos/ENCODE-DCC/encoded/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ENCODE-DCC/encoded/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ENCODE-DCC/encoded/teams","hooks_url":"https://api.github.com/repos/ENCODE-DCC/encoded/hooks","issue_events_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/events{/number}","events_url":"https://api.github.com/repos/ENCODE-DCC/encoded/events","assignees_url":"https://api.github.com/repos/ENCODE-DCC/encoded/assignees{/user}","branches_url":"https://api.github.com/repos/ENCODE-DCC/encoded/branches{/branch}","tags_url":"https://api.github.com/repos/ENCODE-DCC/encoded/tags","blobs_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/refs{/sha}","trees_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ENCODE-DCC/encoded/statuses/{sha}","languages_url":"https://api.github.com/repos/ENCODE-DCC/encoded/languages","stargazers_url":"https://api.github.com/repos/ENCODE-DCC/encoded/stargazers","contributors_url":"https://api.github.com/repos/ENCODE-DCC/encoded/contributors","subscribers_url":"https://api.github.com/repos/ENCODE-DCC/encoded/subscribers","subscription_url":"https://api.github.com/repos/ENCODE-DCC/encoded/subscription","commits_url":"https://api.github.com/repos/ENCODE-DCC/encoded/commits{/sha}","git_commits_url":"https://api.github.com/repos/ENCODE-DCC/encoded/git/commits{/sha}","comments_url":"https://api.github.com/repos/ENCODE-DCC/encoded/comments{/number}","issue_comment_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/comments{/number}","contents_url":"https://api.github.com/repos/ENCODE-DCC/encoded/contents/{+path}","compare_url":"https://api.github.com/repos/ENCODE-DCC/encoded/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ENCODE-DCC/encoded/merges","archive_url":"https://api.github.com/repos/ENCODE-DCC/encoded/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ENCODE-DCC/encoded/downloads","issues_url":"https://api.github.com/repos/ENCODE-DCC/encoded/issues{/number}","pulls_url":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls{/number}","milestones_url":"https://api.github.com/repos/ENCODE-DCC/encoded/milestones{/number}","notifications_url":"https://api.github.com/repos/ENCODE-DCC/encoded/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ENCODE-DCC/encoded/labels{/name}","releases_url":"https://api.github.com/repos/ENCODE-DCC/encoded/releases{/id}","deployments_url":"https://api.github.com/repos/ENCODE-DCC/encoded/deployments","created_at":"2012-12-07T00:52:21Z","updated_at":"2019-03-21T21:15:11Z","pushed_at":"2019-03-25T16:05:07Z","git_url":"git://github.com/ENCODE-DCC/encoded.git","ssh_url":"git@github.com:ENCODE-DCC/encoded.git","clone_url":"https://github.com/ENCODE-DCC/encoded.git","svn_url":"https://github.com/ENCODE-DCC/encoded","homepage":"https://www.encodeproject.org","size":139638,"stargazers_count":61,"watchers_count":61,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":31,"open_issues":25,"watchers":61,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672"},"html":{"href":"https://github.com/ENCODE-DCC/encoded/pull/2672"},"issue":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/2672"},"comments":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/issues/2672/comments"},"review_comments":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672/comments"},"review_comment":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/pulls/2672/commits"},"statuses":{"href":"https://api.github.com/repos/ENCODE-DCC/encoded/statuses/4eb404bc918a22790318de54bba0a9b8cd2205c7"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"caseylitton"}}