{"action":"created","comment":{"url":"https://api.github.com/repos/opencobra/cobrapy/pulls/comments/227421791","pull_request_review_id":167457040,"id":227421791,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzQyMTc5MQ==","diff_hunk":"@@ -500,8 +500,22 @@ def add_boundary(self, metabolite, type=\"exchange\", reaction_id=None,\n         >>> demand.build_reaction_string()\n         'atp_c --> '\n         \"\"\"\n-        types = dict(exchange=(\"EX\", -ub, ub), demand=(\"DM\", 0, ub),\n-                     sink=(\"SK\", -ub, ub))\n+        ub = CONFIGURATION.upper_bound if ub is None else ub\n+        lb = CONFIGURATION.lower_bound if lb is None else lb\n+        types = {\n+            \"exchange\": (\"EX\", -ub, ub),\n+            \"demand\": (\"DM\", 0, ub),\n+            \"sink\": (\"SK\", -ub, ub)","path":"cobra/core/model.py","position":20,"original_position":20,"commit_id":"03a468ef1b085043646b57f8593745d0c90834ff","original_commit_id":"03a468ef1b085043646b57f8593745d0c90834ff","user":{"login":"Midnighter","id":135653,"node_id":"MDQ6VXNlcjEzNTY1Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/135653?v=4","gravatar_id":"","url":"https://api.github.com/users/Midnighter","html_url":"https://github.com/Midnighter","followers_url":"https://api.github.com/users/Midnighter/followers","following_url":"https://api.github.com/users/Midnighter/following{/other_user}","gists_url":"https://api.github.com/users/Midnighter/gists{/gist_id}","starred_url":"https://api.github.com/users/Midnighter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Midnighter/subscriptions","organizations_url":"https://api.github.com/users/Midnighter/orgs","repos_url":"https://api.github.com/users/Midnighter/repos","events_url":"https://api.github.com/users/Midnighter/events{/privacy}","received_events_url":"https://api.github.com/users/Midnighter/received_events","type":"User","site_admin":false},"body":"As above\r\n\r\n```suggestion\r\n            \"sink\": (\"SK\", lb, ub)\r\n```","created_at":"2018-10-23T14:34:40Z","updated_at":"2018-10-23T14:34:40Z","html_url":"https://github.com/opencobra/cobrapy/pull/774#discussion_r227421791","pull_request_url":"https://api.github.com/repos/opencobra/cobrapy/pulls/774","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/opencobra/cobrapy/pulls/comments/227421791"},"html":{"href":"https://github.com/opencobra/cobrapy/pull/774#discussion_r227421791"},"pull_request":{"href":"https://api.github.com/repos/opencobra/cobrapy/pulls/774"}}},"pull_request":{"url":"https://api.github.com/repos/opencobra/cobrapy/pulls/774","id":223349474,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzMzQ5NDc0","html_url":"https://github.com/opencobra/cobrapy/pull/774","diff_url":"https://github.com/opencobra/cobrapy/pull/774.diff","patch_url":"https://github.com/opencobra/cobrapy/pull/774.patch","issue_url":"https://api.github.com/repos/opencobra/cobrapy/issues/774","number":774,"state":"open","locked":false,"title":"Better identification of the extracellular compartment","user":{"login":"cdiener","id":7153935,"node_id":"MDQ6VXNlcjcxNTM5MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/7153935?v=4","gravatar_id":"","url":"https://api.github.com/users/cdiener","html_url":"https://github.com/cdiener","followers_url":"https://api.github.com/users/cdiener/followers","following_url":"https://api.github.com/users/cdiener/following{/other_user}","gists_url":"https://api.github.com/users/cdiener/gists{/gist_id}","starred_url":"https://api.github.com/users/cdiener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdiener/subscriptions","organizations_url":"https://api.github.com/users/cdiener/orgs","repos_url":"https://api.github.com/users/cdiener/repos","events_url":"https://api.github.com/users/cdiener/events{/privacy}","received_events_url":"https://api.github.com/users/cdiener/received_events","type":"User","site_admin":false},"body":"This improves handling of the extracellular compartment. In particular it fixes #747 by now raising an error when trying to add an exchange reaction for a Metabolite not in the extracellular compartment.\r\n\r\n```Python3\r\nIn [1]: from cobra.test import create_test_model\r\n\r\nIn [2]: from cobra import Metabolite\r\n\r\nIn [3]: mod = create_test_model(\"textbook\")\r\n\r\nIn [4]: m = Metabolite(\"new_met\", compartment=\"something\")\r\n\r\nIn [5]: mod.add_boundary(m, type=\"exchange\")\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-5-4de374dce0c6> in <module>\r\n----> 1 mod.add_boundary(m, type=\"exchange\")\r\n\r\n~/code/cobrapy/cobra/core/model.py in add_boundary(self, metabolite, type, reaction_id, lb, ub)\r\n    511                                  \" its compartment or rename the model\"\r\n    512                                  \" compartments to fix this.\" %\r\n--> 513                                  (metabolite.compartment, external))\r\n    514         if type in types:\r\n    515             prefix, lb, ub = types[type]\r\n\r\nValueError: The metabolite is not an external metabolite (is `something` but should be `e`). Either change its compartment or rename the model compartments to fix this.\r\n```\r\n\r\nI did not implement a new attribute to specify the extracellular compartment but rather ask for the user to name the compartment correctly. There is now a larger set of recognized names consistent with `memote`.\r\n\r\n## Additional changes\r\n\r\n- annotations for compartments by names and reactions are now refactored in its own module and the idea is that other packages can just import it and use it which to have a common source of annotations across cobra packages\r\n- naming now always dominates the number of boundary reactions which should fix problems like @pstjohn was describing","created_at":"2018-10-16T18:20:41Z","updated_at":"2018-10-23T14:34:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6705aae11382b3158046f10964d6aac8c961044d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/opencobra/cobrapy/pulls/774/commits","review_comments_url":"https://api.github.com/repos/opencobra/cobrapy/pulls/774/comments","review_comment_url":"https://api.github.com/repos/opencobra/cobrapy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencobra/cobrapy/issues/774/comments","statuses_url":"https://api.github.com/repos/opencobra/cobrapy/statuses/03a468ef1b085043646b57f8593745d0c90834ff","head":{"label":"cdiener:feature/better_external","ref":"feature/better_external","sha":"03a468ef1b085043646b57f8593745d0c90834ff","user":{"login":"cdiener","id":7153935,"node_id":"MDQ6VXNlcjcxNTM5MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/7153935?v=4","gravatar_id":"","url":"https://api.github.com/users/cdiener","html_url":"https://github.com/cdiener","followers_url":"https://api.github.com/users/cdiener/followers","following_url":"https://api.github.com/users/cdiener/following{/other_user}","gists_url":"https://api.github.com/users/cdiener/gists{/gist_id}","starred_url":"https://api.github.com/users/cdiener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdiener/subscriptions","organizations_url":"https://api.github.com/users/cdiener/orgs","repos_url":"https://api.github.com/users/cdiener/repos","events_url":"https://api.github.com/users/cdiener/events{/privacy}","received_events_url":"https://api.github.com/users/cdiener/received_events","type":"User","site_admin":false},"repo":{"id":54241149,"node_id":"MDEwOlJlcG9zaXRvcnk1NDI0MTE0OQ==","name":"cobrapy","full_name":"cdiener/cobrapy","private":false,"owner":{"login":"cdiener","id":7153935,"node_id":"MDQ6VXNlcjcxNTM5MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/7153935?v=4","gravatar_id":"","url":"https://api.github.com/users/cdiener","html_url":"https://github.com/cdiener","followers_url":"https://api.github.com/users/cdiener/followers","following_url":"https://api.github.com/users/cdiener/following{/other_user}","gists_url":"https://api.github.com/users/cdiener/gists{/gist_id}","starred_url":"https://api.github.com/users/cdiener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdiener/subscriptions","organizations_url":"https://api.github.com/users/cdiener/orgs","repos_url":"https://api.github.com/users/cdiener/repos","events_url":"https://api.github.com/users/cdiener/events{/privacy}","received_events_url":"https://api.github.com/users/cdiener/received_events","type":"User","site_admin":false},"html_url":"https://github.com/cdiener/cobrapy","description":"COBRApy is a package for constraint-based modeling of biological networks","fork":true,"url":"https://api.github.com/repos/cdiener/cobrapy","forks_url":"https://api.github.com/repos/cdiener/cobrapy/forks","keys_url":"https://api.github.com/repos/cdiener/cobrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cdiener/cobrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cdiener/cobrapy/teams","hooks_url":"https://api.github.com/repos/cdiener/cobrapy/hooks","issue_events_url":"https://api.github.com/repos/cdiener/cobrapy/issues/events{/number}","events_url":"https://api.github.com/repos/cdiener/cobrapy/events","assignees_url":"https://api.github.com/repos/cdiener/cobrapy/assignees{/user}","branches_url":"https://api.github.com/repos/cdiener/cobrapy/branches{/branch}","tags_url":"https://api.github.com/repos/cdiener/cobrapy/tags","blobs_url":"https://api.github.com/repos/cdiener/cobrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cdiener/cobrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cdiener/cobrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/cdiener/cobrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cdiener/cobrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/cdiener/cobrapy/languages","stargazers_url":"https://api.github.com/repos/cdiener/cobrapy/stargazers","contributors_url":"https://api.github.com/repos/cdiener/cobrapy/contributors","subscribers_url":"https://api.github.com/repos/cdiener/cobrapy/subscribers","subscription_url":"https://api.github.com/repos/cdiener/cobrapy/subscription","commits_url":"https://api.github.com/repos/cdiener/cobrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/cdiener/cobrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/cdiener/cobrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/cdiener/cobrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/cdiener/cobrapy/contents/{+path}","compare_url":"https://api.github.com/repos/cdiener/cobrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cdiener/cobrapy/merges","archive_url":"https://api.github.com/repos/cdiener/cobrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cdiener/cobrapy/downloads","issues_url":"https://api.github.com/repos/cdiener/cobrapy/issues{/number}","pulls_url":"https://api.github.com/repos/cdiener/cobrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/cdiener/cobrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/cdiener/cobrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cdiener/cobrapy/labels{/name}","releases_url":"https://api.github.com/repos/cdiener/cobrapy/releases{/id}","deployments_url":"https://api.github.com/repos/cdiener/cobrapy/deployments","created_at":"2016-03-19T01:27:11Z","updated_at":"2018-02-27T20:59:49Z","pushed_at":"2018-10-23T00:16:22Z","git_url":"git://github.com/cdiener/cobrapy.git","ssh_url":"git@github.com:cdiener/cobrapy.git","clone_url":"https://github.com/cdiener/cobrapy.git","svn_url":"https://github.com/cdiener/cobrapy","homepage":"http://opencobra.github.io/cobrapy/","size":48376,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opencobra:devel","ref":"devel","sha":"20ebfe40694eda0277d6469644e3f98ea2384e6f","user":{"login":"opencobra","id":2708410,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3MDg0MTA=","avatar_url":"https://avatars0.githubusercontent.com/u/2708410?v=4","gravatar_id":"","url":"https://api.github.com/users/opencobra","html_url":"https://github.com/opencobra","followers_url":"https://api.github.com/users/opencobra/followers","following_url":"https://api.github.com/users/opencobra/following{/other_user}","gists_url":"https://api.github.com/users/opencobra/gists{/gist_id}","starred_url":"https://api.github.com/users/opencobra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencobra/subscriptions","organizations_url":"https://api.github.com/users/opencobra/orgs","repos_url":"https://api.github.com/users/opencobra/repos","events_url":"https://api.github.com/users/opencobra/events{/privacy}","received_events_url":"https://api.github.com/users/opencobra/received_events","type":"Organization","site_admin":false},"repo":{"id":6510063,"node_id":"MDEwOlJlcG9zaXRvcnk2NTEwMDYz","name":"cobrapy","full_name":"opencobra/cobrapy","private":false,"owner":{"login":"opencobra","id":2708410,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3MDg0MTA=","avatar_url":"https://avatars0.githubusercontent.com/u/2708410?v=4","gravatar_id":"","url":"https://api.github.com/users/opencobra","html_url":"https://github.com/opencobra","followers_url":"https://api.github.com/users/opencobra/followers","following_url":"https://api.github.com/users/opencobra/following{/other_user}","gists_url":"https://api.github.com/users/opencobra/gists{/gist_id}","starred_url":"https://api.github.com/users/opencobra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencobra/subscriptions","organizations_url":"https://api.github.com/users/opencobra/orgs","repos_url":"https://api.github.com/users/opencobra/repos","events_url":"https://api.github.com/users/opencobra/events{/privacy}","received_events_url":"https://api.github.com/users/opencobra/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/opencobra/cobrapy","description":"COBRApy is a package for constraint-based modeling of biological networks","fork":false,"url":"https://api.github.com/repos/opencobra/cobrapy","forks_url":"https://api.github.com/repos/opencobra/cobrapy/forks","keys_url":"https://api.github.com/repos/opencobra/cobrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencobra/cobrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencobra/cobrapy/teams","hooks_url":"https://api.github.com/repos/opencobra/cobrapy/hooks","issue_events_url":"https://api.github.com/repos/opencobra/cobrapy/issues/events{/number}","events_url":"https://api.github.com/repos/opencobra/cobrapy/events","assignees_url":"https://api.github.com/repos/opencobra/cobrapy/assignees{/user}","branches_url":"https://api.github.com/repos/opencobra/cobrapy/branches{/branch}","tags_url":"https://api.github.com/repos/opencobra/cobrapy/tags","blobs_url":"https://api.github.com/repos/opencobra/cobrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencobra/cobrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencobra/cobrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencobra/cobrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencobra/cobrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/opencobra/cobrapy/languages","stargazers_url":"https://api.github.com/repos/opencobra/cobrapy/stargazers","contributors_url":"https://api.github.com/repos/opencobra/cobrapy/contributors","subscribers_url":"https://api.github.com/repos/opencobra/cobrapy/subscribers","subscription_url":"https://api.github.com/repos/opencobra/cobrapy/subscription","commits_url":"https://api.github.com/repos/opencobra/cobrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencobra/cobrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencobra/cobrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencobra/cobrapy/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencobra/cobrapy/contents/{+path}","compare_url":"https://api.github.com/repos/opencobra/cobrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencobra/cobrapy/merges","archive_url":"https://api.github.com/repos/opencobra/cobrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencobra/cobrapy/downloads","issues_url":"https://api.github.com/repos/opencobra/cobrapy/issues{/number}","pulls_url":"https://api.github.com/repos/opencobra/cobrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/opencobra/cobrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/opencobra/cobrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencobra/cobrapy/labels{/name}","releases_url":"https://api.github.com/repos/opencobra/cobrapy/releases{/id}","deployments_url":"https://api.github.com/repos/opencobra/cobrapy/deployments","created_at":"2012-11-02T17:47:53Z","updated_at":"2018-10-20T19:10:27Z","pushed_at":"2018-10-23T00:18:43Z","git_url":"git://github.com/opencobra/cobrapy.git","ssh_url":"git@github.com:opencobra/cobrapy.git","clone_url":"https://github.com/opencobra/cobrapy.git","svn_url":"https://github.com/opencobra/cobrapy","homepage":"http://opencobra.github.io/cobrapy/","size":47597,"stargazers_count":163,"watchers_count":163,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":130,"mirror_url":null,"archived":false,"open_issues_count":56,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":130,"open_issues":56,"watchers":163,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/opencobra/cobrapy/pulls/774"},"html":{"href":"https://github.com/opencobra/cobrapy/pull/774"},"issue":{"href":"https://api.github.com/repos/opencobra/cobrapy/issues/774"},"comments":{"href":"https://api.github.com/repos/opencobra/cobrapy/issues/774/comments"},"review_comments":{"href":"https://api.github.com/repos/opencobra/cobrapy/pulls/774/comments"},"review_comment":{"href":"https://api.github.com/repos/opencobra/cobrapy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencobra/cobrapy/pulls/774/commits"},"statuses":{"href":"https://api.github.com/repos/opencobra/cobrapy/statuses/03a468ef1b085043646b57f8593745d0c90834ff"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"Midnighter"}}