{"action":"created","comment":{"url":"https://api.github.com/repos/cdk/cdk/pulls/comments/32702812","id":32702812,"diff_hunk":"@@ -0,0 +1,120 @@\n+/* Copyright (C) 2011-2015  Egon Willighagen <egonw@users.sf.net>\n+ *\n+ * This program is free software; you can redistribute it and/or modify it under\n+ * the terms of the GNU Lesser General Public License as published by the Free\n+ * Software Foundation; either version 2.1 of the License, or (at your option)\n+ * any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+ * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more\n+ * details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program; if not, write to the Free Software Foundation, Inc.,\n+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n+ */\n+package org.openscience.cdk.qsar.descriptors.substance;\n+\n+import org.openscience.cdk.exception.CDKException;\n+import org.openscience.cdk.interfaces.IChemObjectBuilder;\n+import org.openscience.cdk.interfaces.IIsotope;\n+import org.openscience.cdk.interfaces.IMolecularFormula;\n+import org.openscience.cdk.interfaces.ISubstance;\n+import org.openscience.cdk.qsar.DescriptorSpecification;\n+import org.openscience.cdk.qsar.DescriptorValue;\n+import org.openscience.cdk.qsar.result.IDescriptorResult;\n+import org.openscience.cdk.qsar.result.IntegerResult;\n+import org.openscience.cdk.qsar.result.IntegerResultType;\n+\n+/**\n+ * Descriptor that returns the number of oxygens in the chemical\n+ * formula. Originally aimed at metal oxide nanoparticles.\n+ *\n+ * @author      egonw\n+ * @cdk.githash\n+ */\n+public class OxygenAtomCountDescriptor implements ISubstanceDescriptor {\n+\n+\t/** {@inheritDoc} */ @Override\n+\tpublic String[] getDescriptorNames() {\n+        return new String[]{\"NoMe\"};\n+\t}\n+\n+\t/** {@inheritDoc} */ @Override\n+\tpublic String[] getParameterNames() {\n+        return new String[0];\n+\t}\n+\n+\t/** {@inheritDoc} */ @Override\n+\tpublic Object getParameterType(String substance) {\n+\t\treturn null;\n+\t}\n+\n+\t/** {@inheritDoc} */ @Override\n+\tpublic Object[] getParameters() {\n+\t\treturn new Object[0];\n+\t}\n+\n+\t/** {@inheritDoc} */ @Override\n+\tpublic DescriptorSpecification getSpecification() {\n+\t    return new DescriptorSpecification(\n+\t        \"http://egonw.github.com/resource/NM_001002\",\n+\t        this.getClass().getName(),\n+\t        \"The Chemistry Development Kit\"\n+\t    );\n+\t}\n+\n+\t/** {@inheritDoc} */ @Override\n+\tpublic void setParameters(Object[] parameters) throws CDKException {\n+\t\treturn; // no parameters\n+\t}\n+\n+\t/** {@inheritDoc} */ @Override\n+\tpublic DescriptorValue calculate(ISubstance substance) {\n+        if (substance == null) return newNaNDescriptor();\n+\n+\t    IMolecularFormula molFormula = SubstanceManipulator.getChemicalComposition(substance);","path":"descriptor/qsarsubstance/src/main/java/org/openscience/cdk/qsar/descriptors/substance/OxygenAtomCountDescriptor.java","position":77,"original_position":77,"commit_id":"d9093c005da1a954f114988efef2e4a4b5bdc69f","original_commit_id":"d9093c005da1a954f114988efef2e4a4b5bdc69f","user":{"login":"egonw","id":26721,"avatar_url":"https://avatars.githubusercontent.com/u/26721?v=3","gravatar_id":"","url":"https://api.github.com/users/egonw","html_url":"https://github.com/egonw","followers_url":"https://api.github.com/users/egonw/followers","following_url":"https://api.github.com/users/egonw/following{/other_user}","gists_url":"https://api.github.com/users/egonw/gists{/gist_id}","starred_url":"https://api.github.com/users/egonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egonw/subscriptions","organizations_url":"https://api.github.com/users/egonw/orgs","repos_url":"https://api.github.com/users/egonw/repos","events_url":"https://api.github.com/users/egonw/events{/privacy}","received_events_url":"https://api.github.com/users/egonw/received_events","type":"User","site_admin":false},"body":"Not intending to argue against your points, but I am trying to align things with the current design that:\r\n\r\n- to ensure that the result matrix is rectangular and without gaps, fills with NaNs for descriptors for which something went wrong\r\n- \"exception\" message are complementary; no current descriptor throws an Exception when something is wrong, because that messes up calculating a matrix\r\n- some introspection is needed anyway, as a descriptor returns various result types already (per design). That can be a boolean, double, integer, as well as the array variants of multiple values are calculated (for many descriptor algorithms)\r\n\r\nAdd to that the observation that the code used by existing descriptors to return an new Integer((int)Double.NaN) which results in a '0', it seems that this patch uncovers some things in the QSAR descriptor API we do no longer like.\r\n\r\nHow shall we proceed? Should I introduce inconsistencies now, or fix these things in a big descriptor clean up round?\r\n\r\nFor example, I could update the code to return null values for the IDescriptorValue's returned (instead of whatever it now does when something goes wrong). That's an easy enough patch to run on all current code... but still at least a few hours work, I reckon... and a functional change, but we're not stable yet, so that should be OK.\r\n\r\nKeep talking, please!","created_at":"2015-06-18T06:49:08Z","updated_at":"2015-06-18T06:49:08Z","html_url":"https://github.com/cdk/cdk/pull/135#discussion_r32702812","pull_request_url":"https://api.github.com/repos/cdk/cdk/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/cdk/cdk/pulls/comments/32702812"},"html":{"href":"https://github.com/cdk/cdk/pull/135#discussion_r32702812"},"pull_request":{"href":"https://api.github.com/repos/cdk/cdk/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/cdk/cdk/pulls/135","id":37820877,"html_url":"https://github.com/cdk/cdk/pull/135","diff_url":"https://github.com/cdk/cdk/pull/135.diff","patch_url":"https://github.com/cdk/cdk/pull/135.patch","issue_url":"https://api.github.com/repos/cdk/cdk/issues/135","number":135,"state":"open","locked":false,"title":"Feature/substancedescriptor","user":{"login":"egonw","id":26721,"avatar_url":"https://avatars.githubusercontent.com/u/26721?v=3","gravatar_id":"","url":"https://api.github.com/users/egonw","html_url":"https://github.com/egonw","followers_url":"https://api.github.com/users/egonw/followers","following_url":"https://api.github.com/users/egonw/following{/other_user}","gists_url":"https://api.github.com/users/egonw/gists{/gist_id}","starred_url":"https://api.github.com/users/egonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egonw/subscriptions","organizations_url":"https://api.github.com/users/egonw/orgs","repos_url":"https://api.github.com/users/egonw/repos","events_url":"https://api.github.com/users/egonw/events{/privacy}","received_events_url":"https://api.github.com/users/egonw/received_events","type":"User","site_admin":false},"body":"@johnmay please find here the first pull request around further substance development. This PR is about the ISubstanceDescriptor API with one example descriptor. If the code is in order, I will backport more descriptors from NanoJava.\r\n\r\nComments from everyone most welcome!","created_at":"2015-06-16T17:36:40Z","updated_at":"2015-06-18T06:49:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e8ce13b0a06d1a2867b586bd788088b0749fa3e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cdk/cdk/pulls/135/commits","review_comments_url":"https://api.github.com/repos/cdk/cdk/pulls/135/comments","review_comment_url":"https://api.github.com/repos/cdk/cdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cdk/cdk/issues/135/comments","statuses_url":"https://api.github.com/repos/cdk/cdk/statuses/d9093c005da1a954f114988efef2e4a4b5bdc69f","head":{"label":"egonw:feature/substancedescriptor","ref":"feature/substancedescriptor","sha":"d9093c005da1a954f114988efef2e4a4b5bdc69f","user":{"login":"egonw","id":26721,"avatar_url":"https://avatars.githubusercontent.com/u/26721?v=3","gravatar_id":"","url":"https://api.github.com/users/egonw","html_url":"https://github.com/egonw","followers_url":"https://api.github.com/users/egonw/followers","following_url":"https://api.github.com/users/egonw/following{/other_user}","gists_url":"https://api.github.com/users/egonw/gists{/gist_id}","starred_url":"https://api.github.com/users/egonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egonw/subscriptions","organizations_url":"https://api.github.com/users/egonw/orgs","repos_url":"https://api.github.com/users/egonw/repos","events_url":"https://api.github.com/users/egonw/events{/privacy}","received_events_url":"https://api.github.com/users/egonw/received_events","type":"User","site_admin":false},"repo":{"id":37545550,"name":"cdk","full_name":"egonw/cdk","owner":{"login":"egonw","id":26721,"avatar_url":"https://avatars.githubusercontent.com/u/26721?v=3","gravatar_id":"","url":"https://api.github.com/users/egonw","html_url":"https://github.com/egonw","followers_url":"https://api.github.com/users/egonw/followers","following_url":"https://api.github.com/users/egonw/following{/other_user}","gists_url":"https://api.github.com/users/egonw/gists{/gist_id}","starred_url":"https://api.github.com/users/egonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egonw/subscriptions","organizations_url":"https://api.github.com/users/egonw/orgs","repos_url":"https://api.github.com/users/egonw/repos","events_url":"https://api.github.com/users/egonw/events{/privacy}","received_events_url":"https://api.github.com/users/egonw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/egonw/cdk","description":"The Chemistry Development Kit","fork":true,"url":"https://api.github.com/repos/egonw/cdk","forks_url":"https://api.github.com/repos/egonw/cdk/forks","keys_url":"https://api.github.com/repos/egonw/cdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/egonw/cdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/egonw/cdk/teams","hooks_url":"https://api.github.com/repos/egonw/cdk/hooks","issue_events_url":"https://api.github.com/repos/egonw/cdk/issues/events{/number}","events_url":"https://api.github.com/repos/egonw/cdk/events","assignees_url":"https://api.github.com/repos/egonw/cdk/assignees{/user}","branches_url":"https://api.github.com/repos/egonw/cdk/branches{/branch}","tags_url":"https://api.github.com/repos/egonw/cdk/tags","blobs_url":"https://api.github.com/repos/egonw/cdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/egonw/cdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/egonw/cdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/egonw/cdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/egonw/cdk/statuses/{sha}","languages_url":"https://api.github.com/repos/egonw/cdk/languages","stargazers_url":"https://api.github.com/repos/egonw/cdk/stargazers","contributors_url":"https://api.github.com/repos/egonw/cdk/contributors","subscribers_url":"https://api.github.com/repos/egonw/cdk/subscribers","subscription_url":"https://api.github.com/repos/egonw/cdk/subscription","commits_url":"https://api.github.com/repos/egonw/cdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/egonw/cdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/egonw/cdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/egonw/cdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/egonw/cdk/contents/{+path}","compare_url":"https://api.github.com/repos/egonw/cdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/egonw/cdk/merges","archive_url":"https://api.github.com/repos/egonw/cdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/egonw/cdk/downloads","issues_url":"https://api.github.com/repos/egonw/cdk/issues{/number}","pulls_url":"https://api.github.com/repos/egonw/cdk/pulls{/number}","milestones_url":"https://api.github.com/repos/egonw/cdk/milestones{/number}","notifications_url":"https://api.github.com/repos/egonw/cdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/egonw/cdk/labels{/name}","releases_url":"https://api.github.com/repos/egonw/cdk/releases{/id}","created_at":"2015-06-16T17:34:10Z","updated_at":"2015-06-16T17:34:26Z","pushed_at":"2015-06-17T17:30:18Z","git_url":"git://github.com/egonw/cdk.git","ssh_url":"git@github.com:egonw/cdk.git","clone_url":"https://github.com/egonw/cdk.git","svn_url":"https://github.com/egonw/cdk","homepage":"http://cdk.sf.net/","size":152841,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cdk:master","ref":"master","sha":"1ba0333cffcb6a347dc9ec87175e25c98b57f57c","user":{"login":"cdk","id":273111,"avatar_url":"https://avatars.githubusercontent.com/u/273111?v=3","gravatar_id":"","url":"https://api.github.com/users/cdk","html_url":"https://github.com/cdk","followers_url":"https://api.github.com/users/cdk/followers","following_url":"https://api.github.com/users/cdk/following{/other_user}","gists_url":"https://api.github.com/users/cdk/gists{/gist_id}","starred_url":"https://api.github.com/users/cdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdk/subscriptions","organizations_url":"https://api.github.com/users/cdk/orgs","repos_url":"https://api.github.com/users/cdk/repos","events_url":"https://api.github.com/users/cdk/events{/privacy}","received_events_url":"https://api.github.com/users/cdk/received_events","type":"Organization","site_admin":false},"repo":{"id":660443,"name":"cdk","full_name":"cdk/cdk","owner":{"login":"cdk","id":273111,"avatar_url":"https://avatars.githubusercontent.com/u/273111?v=3","gravatar_id":"","url":"https://api.github.com/users/cdk","html_url":"https://github.com/cdk","followers_url":"https://api.github.com/users/cdk/followers","following_url":"https://api.github.com/users/cdk/following{/other_user}","gists_url":"https://api.github.com/users/cdk/gists{/gist_id}","starred_url":"https://api.github.com/users/cdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdk/subscriptions","organizations_url":"https://api.github.com/users/cdk/orgs","repos_url":"https://api.github.com/users/cdk/repos","events_url":"https://api.github.com/users/cdk/events{/privacy}","received_events_url":"https://api.github.com/users/cdk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cdk/cdk","description":"The Chemistry Development Kit","fork":false,"url":"https://api.github.com/repos/cdk/cdk","forks_url":"https://api.github.com/repos/cdk/cdk/forks","keys_url":"https://api.github.com/repos/cdk/cdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cdk/cdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cdk/cdk/teams","hooks_url":"https://api.github.com/repos/cdk/cdk/hooks","issue_events_url":"https://api.github.com/repos/cdk/cdk/issues/events{/number}","events_url":"https://api.github.com/repos/cdk/cdk/events","assignees_url":"https://api.github.com/repos/cdk/cdk/assignees{/user}","branches_url":"https://api.github.com/repos/cdk/cdk/branches{/branch}","tags_url":"https://api.github.com/repos/cdk/cdk/tags","blobs_url":"https://api.github.com/repos/cdk/cdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cdk/cdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cdk/cdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/cdk/cdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cdk/cdk/statuses/{sha}","languages_url":"https://api.github.com/repos/cdk/cdk/languages","stargazers_url":"https://api.github.com/repos/cdk/cdk/stargazers","contributors_url":"https://api.github.com/repos/cdk/cdk/contributors","subscribers_url":"https://api.github.com/repos/cdk/cdk/subscribers","subscription_url":"https://api.github.com/repos/cdk/cdk/subscription","commits_url":"https://api.github.com/repos/cdk/cdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/cdk/cdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/cdk/cdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/cdk/cdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/cdk/cdk/contents/{+path}","compare_url":"https://api.github.com/repos/cdk/cdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cdk/cdk/merges","archive_url":"https://api.github.com/repos/cdk/cdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cdk/cdk/downloads","issues_url":"https://api.github.com/repos/cdk/cdk/issues{/number}","pulls_url":"https://api.github.com/repos/cdk/cdk/pulls{/number}","milestones_url":"https://api.github.com/repos/cdk/cdk/milestones{/number}","notifications_url":"https://api.github.com/repos/cdk/cdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cdk/cdk/labels{/name}","releases_url":"https://api.github.com/repos/cdk/cdk/releases{/id}","created_at":"2010-05-11T08:30:07Z","updated_at":"2015-06-07T20:50:56Z","pushed_at":"2015-06-17T08:28:30Z","git_url":"git://github.com/cdk/cdk.git","ssh_url":"git@github.com:cdk/cdk.git","clone_url":"https://github.com/cdk/cdk.git","svn_url":"https://github.com/cdk/cdk","homepage":"http://cdk.sf.net/","size":198480,"stargazers_count":41,"watchers_count":41,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":33,"mirror_url":null,"open_issues_count":2,"forks":33,"open_issues":2,"watchers":41,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cdk/cdk/pulls/135"},"html":{"href":"https://github.com/cdk/cdk/pull/135"},"issue":{"href":"https://api.github.com/repos/cdk/cdk/issues/135"},"comments":{"href":"https://api.github.com/repos/cdk/cdk/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/cdk/cdk/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/cdk/cdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cdk/cdk/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/cdk/cdk/statuses/d9093c005da1a954f114988efef2e4a4b5bdc69f"}}}}