{"action":"created","comment":{"url":"https://api.github.com/repos/biosustain/cameo/pulls/comments/83004571","pull_request_review_id":3872701,"id":83004571,"diff_hunk":"@@ -53,6 +54,45 @@ def constraint(self):\n         else:\n             return None\n \n+    def _relax_mass_balance_constrain(self, time_machine, k):\n+        if time_machine:\n+            time_machine(do=partial(setattr, self.constraint, \"lb\", -k),\n+                         undo=partial(setattr, self.constraint, \"lb\", self.constraint.lb))\n+            time_machine(do=partial(setattr, self.constraint, \"ub\", k),\n+                         undo=partial(setattr, self.constraint, \"ub\", self.constraint.ub))\n+        else:\n+            self.constraint.lb = -k\n+            self.constraint.ub = k\n+\n+    def knock_out(self, time_machine=None, k=10000):\n+        \"\"\"'Knockout' a metabolite [1].\n+\n+        Implementation according to the paper:\n+            \"All fluxes around the metabolite M should be restricted to only produce the metabolite,\n+             for which balancing constraint of mass conservation is relaxed to allow nonzero values\n+             of the incoming fluxes whereas all outgoing fluxes are limited to zero.\"\n+\n+        Parameters\n+        ----------\n+        time_machine : TimeMachine\n+            An action stack to reverse actions.\n+        k: number\n+            A large number\n+\n+        References\n+        ----------\n+        .. [1] Kim, P.-J., Lee, D.-Y., Kim, T. Y., Lee, K. H., Jeong, H., Lee, S. Y., & Park, S. (2007).\n+          Metabolite essentiality elucidates robustness of Escherichia coli metabolism. PNAS, 104(34), 13638-13642\n+        \"\"\"\n+        # restrict reactions to produce metabolite\n+        for reaction in self.reactions:\n+            if reaction.metabolites[self] > 0:  # for positive stoichiometric coefficient set lb to 0\n+                reaction.change_bounds(lb=0, time_machine=time_machine)\n+            elif reaction.metabolites[self] < 0:  # for negative stoichiometric coefficient set ub to 0\n+                reaction.change_bounds(ub=0, time_machine=time_machine)","path":"cameo/core/metabolite.py","position":48,"original_position":47,"commit_id":"3524f3072de79c60c01a035170b3d268d2cd9b76","original_commit_id":"fc244307d67f35920d5505f223bf3d953ea26b18","user":{"login":"joaocardoso","id":648754,"avatar_url":"https://avatars.githubusercontent.com/u/648754?v=3","gravatar_id":"","url":"https://api.github.com/users/joaocardoso","html_url":"https://github.com/joaocardoso","followers_url":"https://api.github.com/users/joaocardoso/followers","following_url":"https://api.github.com/users/joaocardoso/following{/other_user}","gists_url":"https://api.github.com/users/joaocardoso/gists{/gist_id}","starred_url":"https://api.github.com/users/joaocardoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaocardoso/subscriptions","organizations_url":"https://api.github.com/users/joaocardoso/orgs","repos_url":"https://api.github.com/users/joaocardoso/repos","events_url":"https://api.github.com/users/joaocardoso/events{/privacy}","received_events_url":"https://api.github.com/users/joaocardoso/received_events","type":"User","site_admin":false},"body":"@KristianJensen: what would be the equivalent of knockout a reaction that has certain bounds? The bounds would become (0, 0) right? So the point is that you cannot run any reaction that consumes this metabolite. If there is a constraint on reactions producing it, it will remain unchanged.","created_at":"2016-10-12T13:31:10Z","updated_at":"2016-10-12T13:31:10Z","html_url":"https://github.com/biosustain/cameo/pull/70#discussion_r83004571","pull_request_url":"https://api.github.com/repos/biosustain/cameo/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/biosustain/cameo/pulls/comments/83004571"},"html":{"href":"https://github.com/biosustain/cameo/pull/70#discussion_r83004571"},"pull_request":{"href":"https://api.github.com/repos/biosustain/cameo/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/biosustain/cameo/pulls/70","id":87449577,"html_url":"https://github.com/biosustain/cameo/pull/70","diff_url":"https://github.com/biosustain/cameo/pull/70.diff","patch_url":"https://github.com/biosustain/cameo/pull/70.patch","issue_url":"https://api.github.com/repos/biosustain/cameo/issues/70","number":70,"state":"open","locked":false,"title":"feat: essential metabolites","user":{"login":"joaocardoso","id":648754,"avatar_url":"https://avatars.githubusercontent.com/u/648754?v=3","gravatar_id":"","url":"https://api.github.com/users/joaocardoso","html_url":"https://github.com/joaocardoso","followers_url":"https://api.github.com/users/joaocardoso/followers","following_url":"https://api.github.com/users/joaocardoso/following{/other_user}","gists_url":"https://api.github.com/users/joaocardoso/gists{/gist_id}","starred_url":"https://api.github.com/users/joaocardoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaocardoso/subscriptions","organizations_url":"https://api.github.com/users/joaocardoso/orgs","repos_url":"https://api.github.com/users/joaocardoso/repos","events_url":"https://api.github.com/users/joaocardoso/events{/privacy}","received_events_url":"https://api.github.com/users/joaocardoso/received_events","type":"User","site_admin":false},"body":"This should go to cobrapy when refactored like I mentioned in #64 .","created_at":"2016-09-30T07:55:30Z","updated_at":"2016-10-12T13:31:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c76899e0b83f6e72ce5c236fc85cf0ca1aa466dd","assignee":{"login":"phantomas1234","id":55217,"avatar_url":"https://avatars.githubusercontent.com/u/55217?v=3","gravatar_id":"","url":"https://api.github.com/users/phantomas1234","html_url":"https://github.com/phantomas1234","followers_url":"https://api.github.com/users/phantomas1234/followers","following_url":"https://api.github.com/users/phantomas1234/following{/other_user}","gists_url":"https://api.github.com/users/phantomas1234/gists{/gist_id}","starred_url":"https://api.github.com/users/phantomas1234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phantomas1234/subscriptions","organizations_url":"https://api.github.com/users/phantomas1234/orgs","repos_url":"https://api.github.com/users/phantomas1234/repos","events_url":"https://api.github.com/users/phantomas1234/events{/privacy}","received_events_url":"https://api.github.com/users/phantomas1234/received_events","type":"User","site_admin":false},"assignees":[{"login":"phantomas1234","id":55217,"avatar_url":"https://avatars.githubusercontent.com/u/55217?v=3","gravatar_id":"","url":"https://api.github.com/users/phantomas1234","html_url":"https://github.com/phantomas1234","followers_url":"https://api.github.com/users/phantomas1234/followers","following_url":"https://api.github.com/users/phantomas1234/following{/other_user}","gists_url":"https://api.github.com/users/phantomas1234/gists{/gist_id}","starred_url":"https://api.github.com/users/phantomas1234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phantomas1234/subscriptions","organizations_url":"https://api.github.com/users/phantomas1234/orgs","repos_url":"https://api.github.com/users/phantomas1234/repos","events_url":"https://api.github.com/users/phantomas1234/events{/privacy}","received_events_url":"https://api.github.com/users/phantomas1234/received_events","type":"User","site_admin":false},{"login":"hredestig","id":1300566,"avatar_url":"https://avatars.githubusercontent.com/u/1300566?v=3","gravatar_id":"","url":"https://api.github.com/users/hredestig","html_url":"https://github.com/hredestig","followers_url":"https://api.github.com/users/hredestig/followers","following_url":"https://api.github.com/users/hredestig/following{/other_user}","gists_url":"https://api.github.com/users/hredestig/gists{/gist_id}","starred_url":"https://api.github.com/users/hredestig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hredestig/subscriptions","organizations_url":"https://api.github.com/users/hredestig/orgs","repos_url":"https://api.github.com/users/hredestig/repos","events_url":"https://api.github.com/users/hredestig/events{/privacy}","received_events_url":"https://api.github.com/users/hredestig/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/biosustain/cameo/pulls/70/commits","review_comments_url":"https://api.github.com/repos/biosustain/cameo/pulls/70/comments","review_comment_url":"https://api.github.com/repos/biosustain/cameo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biosustain/cameo/issues/70/comments","statuses_url":"https://api.github.com/repos/biosustain/cameo/statuses/3524f3072de79c60c01a035170b3d268d2cd9b76","head":{"label":"biosustain:essential_metabolites","ref":"essential_metabolites","sha":"3524f3072de79c60c01a035170b3d268d2cd9b76","user":{"login":"biosustain","id":5499849,"avatar_url":"https://avatars.githubusercontent.com/u/5499849?v=3","gravatar_id":"","url":"https://api.github.com/users/biosustain","html_url":"https://github.com/biosustain","followers_url":"https://api.github.com/users/biosustain/followers","following_url":"https://api.github.com/users/biosustain/following{/other_user}","gists_url":"https://api.github.com/users/biosustain/gists{/gist_id}","starred_url":"https://api.github.com/users/biosustain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biosustain/subscriptions","organizations_url":"https://api.github.com/users/biosustain/orgs","repos_url":"https://api.github.com/users/biosustain/repos","events_url":"https://api.github.com/users/biosustain/events{/privacy}","received_events_url":"https://api.github.com/users/biosustain/received_events","type":"Organization","site_admin":false},"repo":{"id":18134954,"name":"cameo","full_name":"biosustain/cameo","owner":{"login":"biosustain","id":5499849,"avatar_url":"https://avatars.githubusercontent.com/u/5499849?v=3","gravatar_id":"","url":"https://api.github.com/users/biosustain","html_url":"https://github.com/biosustain","followers_url":"https://api.github.com/users/biosustain/followers","following_url":"https://api.github.com/users/biosustain/following{/other_user}","gists_url":"https://api.github.com/users/biosustain/gists{/gist_id}","starred_url":"https://api.github.com/users/biosustain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biosustain/subscriptions","organizations_url":"https://api.github.com/users/biosustain/orgs","repos_url":"https://api.github.com/users/biosustain/repos","events_url":"https://api.github.com/users/biosustain/events{/privacy}","received_events_url":"https://api.github.com/users/biosustain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biosustain/cameo","description":"cameo - computer aided metabolic engineering & optimization","fork":false,"url":"https://api.github.com/repos/biosustain/cameo","forks_url":"https://api.github.com/repos/biosustain/cameo/forks","keys_url":"https://api.github.com/repos/biosustain/cameo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biosustain/cameo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biosustain/cameo/teams","hooks_url":"https://api.github.com/repos/biosustain/cameo/hooks","issue_events_url":"https://api.github.com/repos/biosustain/cameo/issues/events{/number}","events_url":"https://api.github.com/repos/biosustain/cameo/events","assignees_url":"https://api.github.com/repos/biosustain/cameo/assignees{/user}","branches_url":"https://api.github.com/repos/biosustain/cameo/branches{/branch}","tags_url":"https://api.github.com/repos/biosustain/cameo/tags","blobs_url":"https://api.github.com/repos/biosustain/cameo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biosustain/cameo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biosustain/cameo/git/refs{/sha}","trees_url":"https://api.github.com/repos/biosustain/cameo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biosustain/cameo/statuses/{sha}","languages_url":"https://api.github.com/repos/biosustain/cameo/languages","stargazers_url":"https://api.github.com/repos/biosustain/cameo/stargazers","contributors_url":"https://api.github.com/repos/biosustain/cameo/contributors","subscribers_url":"https://api.github.com/repos/biosustain/cameo/subscribers","subscription_url":"https://api.github.com/repos/biosustain/cameo/subscription","commits_url":"https://api.github.com/repos/biosustain/cameo/commits{/sha}","git_commits_url":"https://api.github.com/repos/biosustain/cameo/git/commits{/sha}","comments_url":"https://api.github.com/repos/biosustain/cameo/comments{/number}","issue_comment_url":"https://api.github.com/repos/biosustain/cameo/issues/comments{/number}","contents_url":"https://api.github.com/repos/biosustain/cameo/contents/{+path}","compare_url":"https://api.github.com/repos/biosustain/cameo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biosustain/cameo/merges","archive_url":"https://api.github.com/repos/biosustain/cameo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biosustain/cameo/downloads","issues_url":"https://api.github.com/repos/biosustain/cameo/issues{/number}","pulls_url":"https://api.github.com/repos/biosustain/cameo/pulls{/number}","milestones_url":"https://api.github.com/repos/biosustain/cameo/milestones{/number}","notifications_url":"https://api.github.com/repos/biosustain/cameo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biosustain/cameo/labels{/name}","releases_url":"https://api.github.com/repos/biosustain/cameo/releases{/id}","deployments_url":"https://api.github.com/repos/biosustain/cameo/deployments","created_at":"2014-03-26T10:50:33Z","updated_at":"2016-10-11T21:44:55Z","pushed_at":"2016-10-12T13:16:30Z","git_url":"git://github.com/biosustain/cameo.git","ssh_url":"git@github.com:biosustain/cameo.git","clone_url":"https://github.com/biosustain/cameo.git","svn_url":"https://github.com/biosustain/cameo","homepage":"http://cameo.bio","size":226499,"stargazers_count":21,"watchers_count":21,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":10,"forks":7,"open_issues":10,"watchers":21,"default_branch":"devel"}},"base":{"label":"biosustain:devel","ref":"devel","sha":"9a064c595c5cded444fba46908c64b39a7fe1922","user":{"login":"biosustain","id":5499849,"avatar_url":"https://avatars.githubusercontent.com/u/5499849?v=3","gravatar_id":"","url":"https://api.github.com/users/biosustain","html_url":"https://github.com/biosustain","followers_url":"https://api.github.com/users/biosustain/followers","following_url":"https://api.github.com/users/biosustain/following{/other_user}","gists_url":"https://api.github.com/users/biosustain/gists{/gist_id}","starred_url":"https://api.github.com/users/biosustain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biosustain/subscriptions","organizations_url":"https://api.github.com/users/biosustain/orgs","repos_url":"https://api.github.com/users/biosustain/repos","events_url":"https://api.github.com/users/biosustain/events{/privacy}","received_events_url":"https://api.github.com/users/biosustain/received_events","type":"Organization","site_admin":false},"repo":{"id":18134954,"name":"cameo","full_name":"biosustain/cameo","owner":{"login":"biosustain","id":5499849,"avatar_url":"https://avatars.githubusercontent.com/u/5499849?v=3","gravatar_id":"","url":"https://api.github.com/users/biosustain","html_url":"https://github.com/biosustain","followers_url":"https://api.github.com/users/biosustain/followers","following_url":"https://api.github.com/users/biosustain/following{/other_user}","gists_url":"https://api.github.com/users/biosustain/gists{/gist_id}","starred_url":"https://api.github.com/users/biosustain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biosustain/subscriptions","organizations_url":"https://api.github.com/users/biosustain/orgs","repos_url":"https://api.github.com/users/biosustain/repos","events_url":"https://api.github.com/users/biosustain/events{/privacy}","received_events_url":"https://api.github.com/users/biosustain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biosustain/cameo","description":"cameo - computer aided metabolic engineering & optimization","fork":false,"url":"https://api.github.com/repos/biosustain/cameo","forks_url":"https://api.github.com/repos/biosustain/cameo/forks","keys_url":"https://api.github.com/repos/biosustain/cameo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biosustain/cameo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biosustain/cameo/teams","hooks_url":"https://api.github.com/repos/biosustain/cameo/hooks","issue_events_url":"https://api.github.com/repos/biosustain/cameo/issues/events{/number}","events_url":"https://api.github.com/repos/biosustain/cameo/events","assignees_url":"https://api.github.com/repos/biosustain/cameo/assignees{/user}","branches_url":"https://api.github.com/repos/biosustain/cameo/branches{/branch}","tags_url":"https://api.github.com/repos/biosustain/cameo/tags","blobs_url":"https://api.github.com/repos/biosustain/cameo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biosustain/cameo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biosustain/cameo/git/refs{/sha}","trees_url":"https://api.github.com/repos/biosustain/cameo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biosustain/cameo/statuses/{sha}","languages_url":"https://api.github.com/repos/biosustain/cameo/languages","stargazers_url":"https://api.github.com/repos/biosustain/cameo/stargazers","contributors_url":"https://api.github.com/repos/biosustain/cameo/contributors","subscribers_url":"https://api.github.com/repos/biosustain/cameo/subscribers","subscription_url":"https://api.github.com/repos/biosustain/cameo/subscription","commits_url":"https://api.github.com/repos/biosustain/cameo/commits{/sha}","git_commits_url":"https://api.github.com/repos/biosustain/cameo/git/commits{/sha}","comments_url":"https://api.github.com/repos/biosustain/cameo/comments{/number}","issue_comment_url":"https://api.github.com/repos/biosustain/cameo/issues/comments{/number}","contents_url":"https://api.github.com/repos/biosustain/cameo/contents/{+path}","compare_url":"https://api.github.com/repos/biosustain/cameo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biosustain/cameo/merges","archive_url":"https://api.github.com/repos/biosustain/cameo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biosustain/cameo/downloads","issues_url":"https://api.github.com/repos/biosustain/cameo/issues{/number}","pulls_url":"https://api.github.com/repos/biosustain/cameo/pulls{/number}","milestones_url":"https://api.github.com/repos/biosustain/cameo/milestones{/number}","notifications_url":"https://api.github.com/repos/biosustain/cameo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biosustain/cameo/labels{/name}","releases_url":"https://api.github.com/repos/biosustain/cameo/releases{/id}","deployments_url":"https://api.github.com/repos/biosustain/cameo/deployments","created_at":"2014-03-26T10:50:33Z","updated_at":"2016-10-11T21:44:55Z","pushed_at":"2016-10-12T13:16:30Z","git_url":"git://github.com/biosustain/cameo.git","ssh_url":"git@github.com:biosustain/cameo.git","clone_url":"https://github.com/biosustain/cameo.git","svn_url":"https://github.com/biosustain/cameo","homepage":"http://cameo.bio","size":226499,"stargazers_count":21,"watchers_count":21,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":10,"forks":7,"open_issues":10,"watchers":21,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/biosustain/cameo/pulls/70"},"html":{"href":"https://github.com/biosustain/cameo/pull/70"},"issue":{"href":"https://api.github.com/repos/biosustain/cameo/issues/70"},"comments":{"href":"https://api.github.com/repos/biosustain/cameo/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/biosustain/cameo/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/biosustain/cameo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biosustain/cameo/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/biosustain/cameo/statuses/3524f3072de79c60c01a035170b3d268d2cd9b76"}}}}
{"actor":{"display_login":"joaocardoso"}}