{"action":"created","comment":{"url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/comments/177578336","pull_request_review_id":107462109,"id":177578336,"diff_hunk":"@@ -33,8 +34,218 @@\n                                'atoms atom_attrs parameters meta')\n \n \n-class Choice(list):\n-    pass\n+class LinkPredicate:\n+    \"\"\"\n+    Comparison criteria for node and molecule attributes in links.\n+\n+    When comparing an attribute from a link to a corresponding attribute from\n+    a molecule or a molecule node, the default behavior is to use the equality\n+    as criterion for the correspondence. Some correspondence, however must be\n+    broader for the link to be usable. Such alternative criteria are defined\n+    as link predicates.\n+\n+    If an attribute in a link is set to an instance of a predicate, then the\n+    correspondence is defined as the boolean result of the ``match`` method.\n+\n+    This is the base class for such predicate. It must be subclassed, and\n+    subclasses must define a :meth:`match` method that takes a dictionary and\n+    a potential key from that dictionary as arguments.\n+\n+    Parameters\n+    ----------\n+    value:\n+        The per-instance value that serve as reference. How this value is\n+        treated depends on the subclass.\n+    \"\"\"\n+    def __init__(self, value):\n+        self.value = value\n+\n+    def match(self, node, key):\n+        \"\"\"\n+        Do the comparison with the reference value.\n+\n+        Notes\n+        -----\n+        This function **must** be defined by the subclasses. This docstring\n+        describe the *expected* format of the method.\n+\n+        Parameters\n+        ----------\n+        node: dict\n+            A dictionary of attributes in which to look up. This can be a\n+            node dictionary of a molecule ``meta`` attribute.\n+        key:\n+            A potential key from the ``node`` dictionary.\n+\n+        Returns\n+        -------\n+        bool\n+        \"\"\"\n+        \n+        raise NotImplementedError\n+\n+    def __repr__(self):\n+        return '<{} at {:x} value={}>'.format(self.__class__.__name__, id(self), self.value)\n+\n+\n+class Choice(LinkPredicate):\n+    \"\"\"\n+    Test if an attribute is defined and in a predefined list.\n+\n+    Parameters\n+    ----------\n+    value: list\n+        The list of value in which to look for the attribute.\n+    \"\"\"\n+    def match(self, node, key):\n+        \"\"\"\n+        Apply the comparison.\n+        \"\"\"\n+        return node.get(key) in self.value\n+\n+\n+class NotDefinedOrNot(LinkPredicate):\n+    \"\"\"\n+    Test if an attribute is not the reference value.\n+\n+    This test passes if the attribute is not defined, if it is set to ``None``,\n+    or if its value is different from the reference.\n+\n+    Parameters\n+    ----------\n+    value:\n+        The value the attribute is tested not to be.\n+    \"\"\"\n+    def match(self, node, key):\n+        \"\"\"\n+        Apply the comparison.\n+        \"\"\"\n+        return key not in node or node[key] != self.value\n+\n+\n+class LinkParameterEffector:\n+    \"\"\"\n+    Rule to calculate an interaction parameter in a link.\n+\n+    This class allows to store dynamic parameters in link interactions. The\n+    value of the parameter can be computed from the graph using the node keys\n+    given when creating the instance.\n+\n+    An instance of this lass is first initialized with a list of node keys\n+    from the import link in which it is defined. The instance is latter called\n+    like a function, and takes as arguments a molecule and a match dictionary\n+    linking the link nodes with the molecule ones. The format of the dictionary\n+    is expected to be ``{link key: molecule key}``.\n+\n+    This is a base class; it needs to be subclassed. A subclass must define an\n+    :meth:`_apply` method that takes a molecule and a list of node keys from","path":"vermouth/molecule.py","position":124,"original_position":118,"commit_id":"46eaa0008ec76fe792dfbea880bb69d70086c271","original_commit_id":"2302fdf16b84f64eee0b389bfc8fc6c7ae914176","user":{"login":"jbarnoud","id":1382074,"avatar_url":"https://avatars1.githubusercontent.com/u/1382074?v=4","gravatar_id":"","url":"https://api.github.com/users/jbarnoud","html_url":"https://github.com/jbarnoud","followers_url":"https://api.github.com/users/jbarnoud/followers","following_url":"https://api.github.com/users/jbarnoud/following{/other_user}","gists_url":"https://api.github.com/users/jbarnoud/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarnoud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarnoud/subscriptions","organizations_url":"https://api.github.com/users/jbarnoud/orgs","repos_url":"https://api.github.com/users/jbarnoud/repos","events_url":"https://api.github.com/users/jbarnoud/events{/privacy}","received_events_url":"https://api.github.com/users/jbarnoud/received_events","type":"User","site_admin":false},"body":"It was `apply` initially. But the method should not be used directly, which the underscore makes clear.","created_at":"2018-03-27T21:28:46Z","updated_at":"2018-03-27T21:33:36Z","html_url":"https://github.com/marrink-lab/vermouth-martinize/pull/64#discussion_r177578336","pull_request_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/comments/177578336"},"html":{"href":"https://github.com/marrink-lab/vermouth-martinize/pull/64#discussion_r177578336"},"pull_request":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64"}},"in_reply_to_id":177557122},"pull_request":{"url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64","id":177538020,"html_url":"https://github.com/marrink-lab/vermouth-martinize/pull/64","diff_url":"https://github.com/marrink-lab/vermouth-martinize/pull/64.diff","patch_url":"https://github.com/marrink-lab/vermouth-martinize/pull/64.patch","issue_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/64","number":64,"state":"open","locked":false,"title":"Implement Elnedyn","user":{"login":"jbarnoud","id":1382074,"avatar_url":"https://avatars1.githubusercontent.com/u/1382074?v=4","gravatar_id":"","url":"https://api.github.com/users/jbarnoud","html_url":"https://github.com/jbarnoud","followers_url":"https://api.github.com/users/jbarnoud/followers","following_url":"https://api.github.com/users/jbarnoud/following{/other_user}","gists_url":"https://api.github.com/users/jbarnoud/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarnoud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarnoud/subscriptions","organizations_url":"https://api.github.com/users/jbarnoud/orgs","repos_url":"https://api.github.com/users/jbarnoud/repos","events_url":"https://api.github.com/users/jbarnoud/events{/privacy}","received_events_url":"https://api.github.com/users/jbarnoud/received_events","type":"User","site_admin":false},"body":"This PR makes sure that Elnedyn works. Elnedyn has many divergences with standard Martini which necessitated modifications in the code. Among other:\r\n\r\n* The backbone parameters are taken from the structure. This PR makes it possible to define bonds and angles with equilibrium values measured from the molecule. This is done using the new link effectors.\r\n* The backbone bead is located on the C alpha. This is done by mapping the BB bead to the CA atom. However, to keep the connectivity of the backbone, the other backbone atoms have to be mapped to the BB bead as well, but with a weight of 0. This is expressed in the mapping file by prefixing the destination atom with a `!`.\r\n* The bond function type for the elastic network differs between martini+EN and elnedyn. This means that the default type has to be defined in the force field. This PR adds the possibility to define arbitrary variables in a force field. These variables are stored in the `variables` attribute of the `ForceField` object.\r\n\r\nI know, docstrings. It comes :stuck_out_tongue:.","created_at":"2018-03-26T19:02:29Z","updated_at":"2018-03-27T21:33:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4076e76c127a2b550b4979bb560b3dadfd702107","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64/commits","review_comments_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64/comments","review_comment_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/64/comments","statuses_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/statuses/46eaa0008ec76fe792dfbea880bb69d70086c271","head":{"label":"marrink-lab:elnedyn","ref":"elnedyn","sha":"46eaa0008ec76fe792dfbea880bb69d70086c271","user":{"login":"marrink-lab","id":33900610,"avatar_url":"https://avatars0.githubusercontent.com/u/33900610?v=4","gravatar_id":"","url":"https://api.github.com/users/marrink-lab","html_url":"https://github.com/marrink-lab","followers_url":"https://api.github.com/users/marrink-lab/followers","following_url":"https://api.github.com/users/marrink-lab/following{/other_user}","gists_url":"https://api.github.com/users/marrink-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/marrink-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marrink-lab/subscriptions","organizations_url":"https://api.github.com/users/marrink-lab/orgs","repos_url":"https://api.github.com/users/marrink-lab/repos","events_url":"https://api.github.com/users/marrink-lab/events{/privacy}","received_events_url":"https://api.github.com/users/marrink-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":100946807,"name":"vermouth-martinize","full_name":"marrink-lab/vermouth-martinize","owner":{"login":"marrink-lab","id":33900610,"avatar_url":"https://avatars0.githubusercontent.com/u/33900610?v=4","gravatar_id":"","url":"https://api.github.com/users/marrink-lab","html_url":"https://github.com/marrink-lab","followers_url":"https://api.github.com/users/marrink-lab/followers","following_url":"https://api.github.com/users/marrink-lab/following{/other_user}","gists_url":"https://api.github.com/users/marrink-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/marrink-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marrink-lab/subscriptions","organizations_url":"https://api.github.com/users/marrink-lab/orgs","repos_url":"https://api.github.com/users/marrink-lab/repos","events_url":"https://api.github.com/users/marrink-lab/events{/privacy}","received_events_url":"https://api.github.com/users/marrink-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/marrink-lab/vermouth-martinize","description":"Describe and apply transformation on molecular structures and topologies","fork":false,"url":"https://api.github.com/repos/marrink-lab/vermouth-martinize","forks_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/forks","keys_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/teams","hooks_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/hooks","issue_events_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/events{/number}","events_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/events","assignees_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/assignees{/user}","branches_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/branches{/branch}","tags_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/tags","blobs_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/refs{/sha}","trees_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/statuses/{sha}","languages_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/languages","stargazers_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/stargazers","contributors_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/contributors","subscribers_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/subscribers","subscription_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/subscription","commits_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/commits{/sha}","git_commits_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/commits{/sha}","comments_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/comments{/number}","issue_comment_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/comments{/number}","contents_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/contents/{+path}","compare_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/merges","archive_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/downloads","issues_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues{/number}","pulls_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls{/number}","milestones_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/milestones{/number}","notifications_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/labels{/name}","releases_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/releases{/id}","deployments_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/deployments","created_at":"2017-08-21T11:46:40Z","updated_at":"2018-03-26T23:14:34Z","pushed_at":"2018-03-27T21:33:28Z","git_url":"git://github.com/marrink-lab/vermouth-martinize.git","ssh_url":"git@github.com:marrink-lab/vermouth-martinize.git","clone_url":"https://github.com/marrink-lab/vermouth-martinize.git","svn_url":"https://github.com/marrink-lab/vermouth-martinize","homepage":"","size":510,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":30,"watchers":6,"default_branch":"master"}},"base":{"label":"marrink-lab:master","ref":"master","sha":"29077c100ec4edf6d57aa1241ff36301700e357f","user":{"login":"marrink-lab","id":33900610,"avatar_url":"https://avatars0.githubusercontent.com/u/33900610?v=4","gravatar_id":"","url":"https://api.github.com/users/marrink-lab","html_url":"https://github.com/marrink-lab","followers_url":"https://api.github.com/users/marrink-lab/followers","following_url":"https://api.github.com/users/marrink-lab/following{/other_user}","gists_url":"https://api.github.com/users/marrink-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/marrink-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marrink-lab/subscriptions","organizations_url":"https://api.github.com/users/marrink-lab/orgs","repos_url":"https://api.github.com/users/marrink-lab/repos","events_url":"https://api.github.com/users/marrink-lab/events{/privacy}","received_events_url":"https://api.github.com/users/marrink-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":100946807,"name":"vermouth-martinize","full_name":"marrink-lab/vermouth-martinize","owner":{"login":"marrink-lab","id":33900610,"avatar_url":"https://avatars0.githubusercontent.com/u/33900610?v=4","gravatar_id":"","url":"https://api.github.com/users/marrink-lab","html_url":"https://github.com/marrink-lab","followers_url":"https://api.github.com/users/marrink-lab/followers","following_url":"https://api.github.com/users/marrink-lab/following{/other_user}","gists_url":"https://api.github.com/users/marrink-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/marrink-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marrink-lab/subscriptions","organizations_url":"https://api.github.com/users/marrink-lab/orgs","repos_url":"https://api.github.com/users/marrink-lab/repos","events_url":"https://api.github.com/users/marrink-lab/events{/privacy}","received_events_url":"https://api.github.com/users/marrink-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/marrink-lab/vermouth-martinize","description":"Describe and apply transformation on molecular structures and topologies","fork":false,"url":"https://api.github.com/repos/marrink-lab/vermouth-martinize","forks_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/forks","keys_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/teams","hooks_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/hooks","issue_events_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/events{/number}","events_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/events","assignees_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/assignees{/user}","branches_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/branches{/branch}","tags_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/tags","blobs_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/refs{/sha}","trees_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/statuses/{sha}","languages_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/languages","stargazers_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/stargazers","contributors_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/contributors","subscribers_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/subscribers","subscription_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/subscription","commits_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/commits{/sha}","git_commits_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/git/commits{/sha}","comments_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/comments{/number}","issue_comment_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/comments{/number}","contents_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/contents/{+path}","compare_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/merges","archive_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/downloads","issues_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues{/number}","pulls_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls{/number}","milestones_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/milestones{/number}","notifications_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/labels{/name}","releases_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/releases{/id}","deployments_url":"https://api.github.com/repos/marrink-lab/vermouth-martinize/deployments","created_at":"2017-08-21T11:46:40Z","updated_at":"2018-03-26T23:14:34Z","pushed_at":"2018-03-27T21:33:28Z","git_url":"git://github.com/marrink-lab/vermouth-martinize.git","ssh_url":"git@github.com:marrink-lab/vermouth-martinize.git","clone_url":"https://github.com/marrink-lab/vermouth-martinize.git","svn_url":"https://github.com/marrink-lab/vermouth-martinize","homepage":"","size":510,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":30,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64"},"html":{"href":"https://github.com/marrink-lab/vermouth-martinize/pull/64"},"issue":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/64"},"comments":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/marrink-lab/vermouth-martinize/statuses/46eaa0008ec76fe792dfbea880bb69d70086c271"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jbarnoud"}}