Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added bursi and cpdb endpoints to DS.

  • Loading branch information...
commit 333fcf343b10f12458dc7e1c99a68c63dcda17d6 1 parent a5a33d6
@olas authored
Showing with 204,008 additions and 0 deletions.
  1. +14 −0 features/net.bioclipse.ds_feature/feature.xml
  2. BIN  plugins/net.bioclipse.ds.bursi.signatures/.DS_Store
  3. +8 −0 plugins/net.bioclipse.ds.bursi.signatures/.classpath
  4. +28 −0 plugins/net.bioclipse.ds.bursi.signatures/.project
  5. +27 −0 plugins/net.bioclipse.ds.bursi.signatures/META-INF/MANIFEST.MF
  6. +12 −0 plugins/net.bioclipse.ds.bursi.signatures/build.properties
  7. +2,275 −0 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSign_1.train.model
  8. +4,340 −0 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSignsXYZ_1.tab
  9. +2,055 −0 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSignsXYZ_1.txt.model
  10. +199 −0 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSignsXYZ_1.txt.range
  11. BIN  plugins/net.bioclipse.ds.bursi.signatures/icons/form.gif
  12. BIN  plugins/net.bioclipse.ds.bursi.signatures/jars/libsvm.jar
  13. +1 −0  plugins/net.bioclipse.ds.bursi.signatures/permissions.properties
  14. +52 −0 plugins/net.bioclipse.ds.bursi.signatures/plugin.xml
  15. +69 −0 plugins/net.bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/Activator.java
  16. +46 −0 plugins/net.bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/DSTestsProperty.java
  17. +427 −0 plugins/net.bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/SignSIgRunner.java
  18. +33 −0 plugins/net.bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/SignSigPropertyCalculator.java
  19. +66 −0 plugins/net.bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/SignSigTestmodel.java
  20. BIN  plugins/net.bioclipse.ds.cpdb.signatures/.DS_Store
  21. +8 −0 plugins/net.bioclipse.ds.cpdb.signatures/.classpath
  22. +28 −0 plugins/net.bioclipse.ds.cpdb.signatures/.project
  23. +23 −0 plugins/net.bioclipse.ds.cpdb.signatures/META-INF/MANIFEST.MF
  24. +9 −0 plugins/net.bioclipse.ds.cpdb.signatures/build.properties
  25. BIN  plugins/net.bioclipse.ds.cpdb.signatures/data/.DS_Store
  26. +419 −0 plugins/net.bioclipse.ds.cpdb.signatures/data/cpdbasRatMmol_Sign1.train.scale.model
  27. BIN  plugins/net.bioclipse.ds.cpdb.signatures/jars/libsvm.jar
  28. +28 −0 plugins/net.bioclipse.ds.cpdb.signatures/plugin.xml
  29. BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/.DS_Store
  30. BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/.DS_Store
  31. BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/.DS_Store
  32. BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/.DS_Store
  33. BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/.DS_Store
  34. +52 −0 plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/signatures/Activator.java
  35. +444 −0 plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/signatures/CPDBSignSigRunner.java
  36. +44 −0 plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/signatures/RGBMatch.java
  37. +7 −0 plugins/net.bioclipse.ds.cpdb/.classpath
  38. +28 −0 plugins/net.bioclipse.ds.cpdb/.project
  39. +18 −0 plugins/net.bioclipse.ds.cpdb/META-INF/MANIFEST.MF
  40. +4 −0 plugins/net.bioclipse.ds.cpdb/build.properties
  41. +150,090 −0 plugins/net.bioclipse.ds.cpdb/data/CPDBAS_CleanMMX-1.sdf
  42. +41,669 −0 plugins/net.bioclipse.ds.cpdb/data/cpdb-processed.sdf
  43. +21 −0 plugins/net.bioclipse.ds.cpdb/html/carcinogenicity.html
  44. BIN  plugins/net.bioclipse.ds.cpdb/icons/db.gif
  45. BIN  plugins/net.bioclipse.ds.cpdb/icons/form.gif
  46. BIN  plugins/net.bioclipse.ds.cpdb/icons/poison.gif
  47. BIN  plugins/net.bioclipse.ds.cpdb/icons/poll.gif
  48. +262 −0 plugins/net.bioclipse.ds.cpdb/plugin.xml
  49. +50 −0 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/Activator.java
  50. +29 −0 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/calc/CarcinogenicityConsensusCalculator.java
  51. +33 −0 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/calc/ExactMatchCalculator.java
  52. +33 −0 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/calc/NearestMatchCalculator.java
  53. +34 −0 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/calc/SignaturesMatchCalculator.java
  54. +155 −0 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/impl/SignMatchImpl.java
  55. +7 −0 plugins/net.bioclipse.ds.cpdb/toc.xml
  56. +7 −0 plugins/net.bioclipse.ds.signatures.tests/.classpath
  57. +28 −0 plugins/net.bioclipse.ds.signatures.tests/.project
  58. +22 −0 plugins/net.bioclipse.ds.signatures.tests/META-INF/MANIFEST.MF
  59. +5 −0 plugins/net.bioclipse.ds.signatures.tests/build.properties
  60. +13 −0 plugins/net.bioclipse.ds.signatures.tests/plugin.xml
  61. +37 −0 plugins/net.bioclipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/APITest.java
  62. +51 −0 ...ioclipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/AbstractSignaturesManagerPluginTest.java
  63. +40 −0 plugins/net.bioclipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/Activator.java
  64. +24 −0 ...et.bioclipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/AllSignaturesManagerPluginTests.java
  65. +24 −0 plugins/net.bioclipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/AllSignaturesManagerTests.java
  66. +35 −0 plugins/net.bioclipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/CoverageTest.java
  67. +23 −0 ...clipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/JavaScriptSignaturesManagerPluginTest.java
  68. +23 −0 ...et.bioclipse.ds.signatures.tests/src/net/bioclipse/ds/signatures/tests/JavaSignaturesManagerPluginTest.java
  69. BIN  plugins/net.bioclipse.ds.signatures/.DS_Store
  70. +8 −0 plugins/net.bioclipse.ds.signatures/.classpath
  71. +28 −0 plugins/net.bioclipse.ds.signatures/.project
  72. +21 −0 plugins/net.bioclipse.ds.signatures/META-INF/MANIFEST.MF
  73. +68 −0 plugins/net.bioclipse.ds.signatures/META-INF/spring/context.xml
  74. +6 −0 plugins/net.bioclipse.ds.signatures/build.properties
  75. BIN  plugins/net.bioclipse.ds.signatures/jars/signatures-1.0-SNAPSHOT.jar
  76. +13 −0 plugins/net.bioclipse.ds.signatures/plugin.xml
  77. BIN  plugins/net.bioclipse.ds.signatures/src/.DS_Store
  78. BIN  plugins/net.bioclipse.ds.signatures/src/net/.DS_Store
  79. BIN  plugins/net.bioclipse.ds.signatures/src/net/bioclipse/.DS_Store
  80. BIN  plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/.DS_Store
  81. BIN  plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/signatures/.DS_Store
  82. +105 −0 plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/signatures/Activator.java
  83. +18 −0 plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/signatures/business/IJavaScriptSignaturesManager.java
  84. +15 −0 plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/signatures/business/IJavaSignaturesManager.java
  85. +82 −0 plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/signatures/business/ISignaturesManager.java
  86. +116 −0 plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/signatures/business/SignaturesManager.java
  87. +49 −0 plugins/net.bioclipse.ds.signatures/src/net/bioclipse/ds/signatures/business/SignaturesManagerFactory.java
View
14 features/net.bioclipse.ds_feature/feature.xml
@@ -58,4 +58,18 @@ The Eclipse Public License accompanies this distribution, and is available at ht
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="net.bioclipse.ds.signatures"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="net.bioclipse.ds.cpdb"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
View
BIN  plugins/net.bioclipse.ds.bursi.signatures/.DS_Store
Binary file not shown
View
8 plugins/net.bioclipse.ds.bursi.signatures/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="jars/libsvm.jar" sourcepath="net.bioclipse.ds.signsig.bursisrc.zip"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
28 plugins/net.bioclipse.ds.bursi.signatures/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.bioclipse.ds.bursi.signatures</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
27 plugins/net.bioclipse.ds.bursi.signatures/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Bursi Signature Significance
+Bundle-SymbolicName: net.bioclipse.ds.bursi.signatures;singleton:=true
+Bundle-Version: 2.2.0.RC3
+Bundle-Activator: net.bioclipse.ds.bursi.signatures.Activator
+Bundle-Vendor: The Bioclipse Team
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ net.bioclipse.ds;bundle-version="0.1.1",
+ net.bioclipse.core;bundle-version="2.0.0",
+ net.bioclipse.ui;bundle-version="2.0.0",
+ net.bioclipse.ui.business;bundle-version="2.0.0",
+ net.bioclipse.scripting;bundle-version="2.0.0",
+ net.bioclipse.scripting.ui;bundle-version="2.0.0",
+ net.bioclipse.cdk.smartsmatching;bundle-version="2.0.0",
+ net.bioclipse.cdk.business;bundle-version="2.0.0",
+ org.openscience.cdk.interfaces;bundle-version="1.2.2",
+ org.openscience.cdk.smarts;bundle-version="1.2.2",
+ org.openscience.cdk.core;bundle-version="1.2.2",
+ net.bioclipse.cdk.ui.sdfeditor;bundle-version="2.0.0",
+ net.bioclipse.ds.signatures;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.apache.log4j;version="1.2.15"
+Bundle-ClassPath: .,
+ jars/libsvm.jar
View
12 plugins/net.bioclipse.ds.bursi.signatures/build.properties
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ jars/,\
+ jars/libsvm.jar,\
+ data/,\
+ exec/,\
+ icons/,\
+ permissions.properties
+source.. = src/
View
2,275 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSign_1.train.model
2,275 additions, 0 deletions not shown
View
4,340 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSignsXYZ_1.tab
4,340 additions, 0 deletions not shown
View
2,055 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSignsXYZ_1.txt.model
2,055 additions, 0 deletions not shown
View
199 plugins/net.bioclipse.ds.bursi.signatures/data/bursiSignsXYZ_1.txt.range
@@ -0,0 +1,199 @@
+x
+-1 1
+1 0 2
+2 0 2
+3 0 3
+4 0 4
+5 0 1
+6 0 6
+7 0 6
+8 0 1
+9 0 6
+10 0 1
+11 0 12
+12 0 1
+13 0 1
+14 0 1
+15 0 3
+16 0 2
+17 0 3
+18 0 1
+19 0 2
+20 0 2
+21 0 1
+22 0 1
+23 0 1
+24 0 2
+25 0 1
+26 0 1
+27 0 1
+28 0 1
+29 0 1
+30 0 1
+31 0 8
+32 0 3
+33 0 14
+34 0 1
+35 0 1
+36 0 1
+37 0 2
+38 0 1
+39 0 1
+40 0 8
+41 0 1
+42 0 1
+43 0 2
+44 0 13
+45 0 1
+46 0 3
+47 0 1
+48 0 2
+49 0 1
+50 0 1
+51 0 2
+52 0 3
+53 0 6
+54 0 1
+55 0 2
+56 0 6
+57 0 8
+58 0 4
+59 0 1
+60 0 3
+61 0 1
+62 0 1
+63 0 23
+64 0 2
+65 0 2
+66 0 3
+67 0 6
+68 0 1
+69 0 32
+70 0 1
+71 0 3
+72 0 1
+73 0 6
+74 0 1
+75 0 1
+76 0 7
+77 0 1
+78 0 1
+79 0 4
+80 0 1
+81 0 10
+82 0 6
+83 0 1
+84 0 2
+85 0 3
+86 0 1
+87 0 1
+88 0 1
+89 0 1
+90 0 1
+91 0 4
+92 0 8
+93 0 2
+94 0 6
+95 0 1
+96 0 5
+97 0 2
+98 0 10
+99 0 1
+100 0 1
+101 0 1
+102 0 1
+103 0 2
+104 0 2
+105 0 1
+106 0 1
+107 0 2
+108 0 3
+109 0 1
+110 0 3
+111 0 2
+112 0 6
+113 0 2
+114 0 2
+115 0 1
+116 0 1
+117 0 2
+118 0 2
+119 0 39
+120 0 1
+121 0 23
+122 0 12
+123 0 1
+124 0 1
+125 0 29
+126 0 3
+127 0 1
+128 0 1
+129 0 4
+130 0 1
+131 0 2
+132 0 1
+133 0 1
+134 0 1
+135 0 6
+136 0 1
+137 0 2
+138 0 2
+139 0 1
+140 0 1
+141 0 1
+142 0 3
+143 0 1
+144 0 19
+145 0 1
+146 0 1
+147 0 6
+148 0 2
+149 0 1
+150 0 1
+151 0 2
+152 0 1
+153 0 2
+154 0 4
+155 0 1
+156 0 1
+157 0 2
+158 0 15
+159 0 2
+160 0 2
+161 0 1
+162 0 12
+163 0 12
+164 0 1
+165 0 1
+167 0 1
+168 0 1
+169 0 1
+170 0 4
+171 0 1
+172 0 1
+173 0 2
+174 0 1
+175 0 1
+176 0 1
+177 0 2
+178 0 1
+179 0 6
+180 0 1
+181 0 4
+182 0 1
+183 0 1
+184 0 10
+185 0 1
+186 0 3
+187 0 16
+188 0 1
+189 0 3
+190 0 1
+191 0 1
+192 0 2
+193 0 1
+194 0 2
+195 0 2
+196 0 1
+197 0 1
+198 0 35
View
BIN  plugins/net.bioclipse.ds.bursi.signatures/icons/form.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  plugins/net.bioclipse.ds.bursi.signatures/jars/libsvm.jar
Binary file not shown
View
1  plugins/net.bioclipse.ds.bursi.signatures/permissions.properties
@@ -0,0 +1 @@
+permissions.executable = exec/signatures-linux,exec/signatures-macosx
View
52 plugins/net.bioclipse.ds.bursi.signatures/plugin.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="net.bioclipse.decisionsupport">
+ <test
+ id="bursi.signatures"
+ name="Bursi Signature Significance"
+ class="net.bioclipse.ds.bursi.signatures.SignSIgRunner"
+ endpoint="net.bioclipse.ds.mutagenicity"
+ propertycalculator="Bursi Signature Significance"
+ reportmodel="net.bioclipse.ds.bursi.signatures.SignSigTestmodel">
+ </test>
+ </extension>
+
+
+ <extension
+ point="net.bioclipse.cdk.propertyCalculator">
+ <Calculator
+ class="net.bioclipse.ds.bursi.signatures.SignSigPropertyCalculator"
+ id="Bursi Signature Significance">
+ </Calculator>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:net.bioclipse.ds.context?after=single">
+ <command
+ commandId="net.bioclipse.cdk.ui.sdfeditor.addProperty"
+ label="Bursi Signature Significance"
+ icon="icons/form.gif"
+ style="push">
+ <parameter
+ name="net.bioclipse.cdk.ui.sdfeditor.calculatorId"
+ value="Signature Significance">
+ </parameter>
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="net.bioclipse.cdk.ui.sdfeditor.editor.MultiPageMoleculesEditorPart">
+ </instanceof>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+
+</plugin>
View
69 ...ns/net.bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/Activator.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ola Spjuth - initial API and implementation
+ ******************************************************************************/
+package net.bioclipse.ds.bursi.signatures;
+
+import org.apache.log4j.Logger;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ private Logger logger = Logger.getLogger(Activator.class);
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "net.bioclipse.ds.bursi.signatures";
+
+ public static final String BURSI_RESULT_PROPERTY="BURSI_RESULT_PROPERTY";
+
+ // The DStest ID, matches the one in plugin.xml
+ public static final String DS_TEST_ID = "bursi.signatures";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
View
46 ....bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/DSTestsProperty.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ola Spjuth - initial API and implementation
+ ******************************************************************************/
+package net.bioclipse.ds.bursi.signatures;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.bioclipse.ds.model.ITestResult;
+
+/**
+ *
+ * @author ola
+ *
+ */
+public class DSTestsProperty {
+
+ Map<String, List<ITestResult>> result;
+
+
+ public DSTestsProperty() {
+ result=new HashMap<String, List<ITestResult>>();
+ }
+
+
+ public Map<String, List<ITestResult>> getResult() {
+
+ return result;
+ }
+
+
+ public void setResult( Map<String, List<ITestResult>> result ) {
+
+ this.result = result;
+ }
+
+
+}
View
427 ...et.bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/SignSIgRunner.java
@@ -0,0 +1,427 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ola Spjuth - initial API and implementation
+ ******************************************************************************/
+package net.bioclipse.ds.bursi.signatures;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import libsvm.svm;
+import libsvm.svm_model;
+import libsvm.svm_node;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+
+import net.bioclipse.cdk.business.Activator;
+import net.bioclipse.cdk.business.ICDKManager;
+import net.bioclipse.cdk.domain.ICDKMolecule;
+import net.bioclipse.core.business.BioclipseException;
+import net.bioclipse.core.domain.IMolecule;
+import net.bioclipse.ds.impl.result.ScaledResultMatch;
+import net.bioclipse.ds.impl.result.SubStructureMatch;
+import net.bioclipse.ds.model.AbstractDSTest;
+import net.bioclipse.ds.model.DSException;
+import net.bioclipse.ds.model.IDSTest;
+import net.bioclipse.ds.model.ITestResult;
+import net.bioclipse.ds.signatures.business.ISignaturesManager;
+
+
+public class SignSIgRunner extends AbstractDSTest implements IDSTest{
+
+
+
+ //The logger of the class
+ private static final Logger logger = Logger.getLogger(SignSIgRunner.class);
+
+ //The model file
+ private static final String MODEL_FILE="/data/bursiSign_1.train.model";
+
+ // Block of member variables. Can they reside here?
+ // Most of the member variables below are hardcoded for the specific example
+ //with 198 descriptors.
+
+ // This is an array of the signatures used in the model.
+ //All model specific files resides in the directory ModelSpecificFiles.
+ //TODO: read this info from file
+ public static final String[] signatureList = {"[C]([C][C][N])", "[C]([C][C][C])", "[N]([C][C])", "[C]([C][C])", "[C]([C][N][N])", "[C]([C][C][O])", "[O]([C][C])", "[C]([O])", "[C]([C])", "[C]([N][O])", "[O]([C])", "[C]([C][C][C][S])", "[S]([C][C][O][O])", "[C]([C][N])", "[N]([C][C][C])", "[C]([C][O][O])", "[C]([C][N][S])", "[O]([S])", "[N]([C][C][N])", "[C]([C][N][O])", "[N]([N][N])", "[N]([C][N])", "[C]([C][O])", "[C]([N])", "[C]([C][C][Cl])", "[Cl]([C])", "[N]([N][O])", "[O]([N])", "[C]([C][S])", "[S]([C][C])", "[N]([C][O][O])", "[C]([Br][C][C])", "[Br]([C])", "[C]([C][C][C][O])", "[N]([C][S])", "[S]([C][N][O][O])", "[C]([S])", "[C]([N][N][N])", "[N]([C])", "[C]([C][C][S])", "[C]([C][C][C][C])", "[C]([C][C][C][N])", "[O]", "[Cl]", "[C]([C][C][F][F])", "[C]([C][Cl][F][F])", "[C]([C][Cl][F])", "[F]([C])", "[C]([C][C][I])", "[I]([C])", "[C]([N][N])", "[S]([C])", "[K]", "[C]([C][Cl][O])", "[N]([C][C][C][N])", "[C]([O][O][O])", "[C]([C][Cl])", "[P]([O][O][O])", "[O]([C][P])", "[N]([C][C][O])", "[C]([N][O][O])", "[N]([N])", "[S]([C][O][O][O])", "[C]([I][I])", "[O]([C][S])", "[C]([Br][C])", "[C]([C][C][F])", "[N]([C][O])", "[C]([O][O])", "[Na]", "[C]([N][N][O])", "[C]([C][C][P])", "[P]([C][O][O][O])", "[O]([P])", "[S]([C][Cl][O][O])", "[Cl]([S])", "[S]([C][N])", "[C]([C][Cl][N])", "[S]([C][S])", "[C]([C][Cl][S])", "[C]([C][Cl][Cl])", "[P]([O][O][O][S])", "[S]([P])", "[P]([O][O][O][O])", "[N]([C][N][O])", "[O]([C][N])", "[N]([C][C][S])", "[C]([Cl][N][N])", "[P]([O][O][S][S])", "[S]([C][P])", "[C]([C][O][S])", "[N]([S])", "[C]([C][F][F][F])", "[C]([C][F])", "[N]([C][N][N])", "[C]([N][S])", "[N]([C][P])", "[P]([N][N][N][N])", "[N]([P][P])", "[S]([C][C][N][O])", "[C]([N][N][S])", "[C]([N][O][S])", "[C]([C][C][Cl][F])", "[N]([C][C][Cl])", "[Cl]([N])", "[P]([N][N][O][O])", "[N]([C][C][P])", "[S]([O][O][O][O])", "[S]([N][N][O][O])", "[C]([C][F][S])", "[N]([O][O][O])", "[O]([C][O])", "[C]([F][F][F][S])", "[O]([O])", "[C]([C][Cl][Cl][Cl])", "[C]([C][C][O][O])", "[N]([C][C][C][C])", "[I]([O][O][O][O])", "[O]([I])", "[C]([C][P])", "[P]([C][C][C][C])", "[C]([O][P])", "[C]([Cl][O][O])", "[P]([N][N][N][S])", "[C]([C][I])", "[N]([N][N][O])", "[C]([Cl][N])", "[N]([N][O][O])", "[Br]", "[C]([Br][C][Cl])", "[C]([N][S][S])", "[S]([C][C][C])", "[P]([N][O][O][O])", "[N]([C][Cl])", "[C]([Cl][O][S])", "[C]([C][O][P][P])", "[C]([C][C][C][Cl])", "[C]([C][C][Cl][Cl])", "[S]([O][O][O])", "[C]([Cl][Cl][Cl][F])", "[C]([Br][Br])", "[C]([Cl][Cl])", "[C]([C][C][N][S])", "[C]([S][S])", "[N]([P])", "[C]([Br][Br][Br][N])", "[C]([C][C][C][F])", "[C]([Cl][S])", "[C]([Cl][Cl][N])", "[N]([O][O])", "[P]([Cl][N][N][O])", "[Cl]([P])", "[C]([Br][C][C][C])", "[P]([N][N][N][O])", "[O]([N][P])", "[C]([Br][Cl])", "[N]([O][S])", "[P]([C][C][C])", "[N]", "[S]([C][C][O])", "[S]([N][O][O][O])", "[N]([N][S])", "[N]([C][C][C][O])", "[Li]", "[Ca]", "[Cl]([O][O][O][O])", "[O]([Cl])", "[S]([N][N])", "[C]([C][C][N][O])", "[C]([Cl][Cl][Cl][S])", "[P]([C][N][O][O])", "[C]([N][P])", "[C]([C][N][P])", "[P]([C][F][O][O])", "[C]([P])", "[F]([P])", "[C]([C][C][S][S])", "[C]([Cl][Cl][Cl][N])", "[C]([C][F][N])", "[C]([Br][Cl][Cl][Cl])", "[N]([O])", "[C]([O][O][S])", "[C]([Br][Br][C])", "[C]([C][C][N][N])", "[P]([N][O][O][S])", "[C]([C][O][P])", "[Br]([N])", "[N]([Br][C][C])", "[C]([C][C][Cl][N])", "[C]([Br])", "[O]([P][P])", "[C]([Cl][N][O])", "[N]([C][S][S])", "[C]([Cl][Cl][F][S])", "[C]([C][F][F][O])", "[C]([C][Cl][Cl][N])", "[C]([S][S][S])", "[C]([N][N][N][N])", "[C]([C][F][F])", "[C]([C][S][S])", "[P]([C][Cl][O][O])", "[C]([C][O][O][O])", "[C]([C][N][O][O])"};
+ public static final int nrSignatures = 203;
+
+ // These variables are defined by the range file.
+ //We include them here to avoid parsing the range file.
+ //TODO: read this info from file
+ public static final double lower = -1.0;
+ public static final double upper = 1.0;
+ public static final double[] feature_min = {0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0};
+ public static final double[] feature_max = {23.0 , 16.0 , 32.0 , 37.0 , 4.0 , 23.0 , 14.0 , 6.0 , 12.0 , 2.0 , 39.0 , 1.0 , 2.0 , 10.0 , 6.0 , 7.0 , 4.0 , 12.0 , 2.0 , 29.0 , 2.0 , 8.0 , 15.0 , 6.0 , 8.0 , 12.0 , 2.0 , 12.0 , 5.0 , 4.0 , 6.0 , 10.0 , 10.0 , 4.0 , 2.0 , 2.0 , 4.0 , 6.0 , 13.0 , 4.0 , 6.0 , 2.0 , 3.0 , 2.0 , 8.0 , 1.0 , 1.0 , 19.0 , 6.0 , 6.0 , 6.0 , 2.0 , 2.0 , 2.0 , 1.0 , 2.0 , 6.0 , 2.0 , 6.0 , 2.0 , 2.0 , 2.0 , 4.0 , 1.0 , 2.0 , 3.0 , 5.0 , 2.0 , 3.0 , 4.0 , 3.0 , 3.0 , 2.0 , 8.0 , 1.0 , 1.0 , 2.0 , 2.0 , 2.0 , 1.0 , 2.0 , 2.0 , 2.0 , 2.0 , 1.0 , 4.0 , 2.0 , 2.0 , 1.0 , 2.0 , 1.0 , 1.0 , 2.0 , 1.0 , 2.0 , 2.0 , 6.0 , 3.0 , 3.0 , 1.0 , 2.0 , 1.0 , 3.0 , 3.0 , 3.0 , 1.0 , 3.0 , 1.0 , 1.0 , 1.0 , 4.0 , 4.0 , 1.0 , 1.0 , 2.0 , 3.0 , 1.0 , 1.0 , 4.0 , 1.0 , 1.0 , 4.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0 , 2.0 , 1.0 , 3.0 , 1.0 , 1.0 , 8.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 4.0 , 1.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0};
+
+ //The SVM model. Read once on initialization.
+ public static svm_model bursiModel;
+
+ // The ones below are needed, but they depend on some hardcoded info.
+ //We need to avoid this, reading 198.
+ private svm_node[] xScaled;
+ private double[] x;
+
+ //Instance fields for a prediction
+ private Map<Integer,Integer> attributeValues;
+ private Map<String,ArrayList<Integer>> signatureAtoms;
+ private ArrayList<Integer> significantAtoms;
+ private double prediction;
+ private String significantSignature = "";
+
+ /**
+ * Default constructor
+ */
+ public SignSIgRunner(){
+ super();
+ }
+
+
+ /**
+ * Initialize all paths and read model files into memory.
+ * @throws DSException
+ */
+ public void initialize(IProgressMonitor monitor) throws DSException {
+
+ if (getTestErrorMessage().length()>1){
+ logger.error("Trying to initialize test: " + getName() + " while " +
+ "error message exists");
+ return;
+ }
+
+ //Get model path depending on OS
+ String modelPath = getModelPath();
+ logger.debug( "Model file path is: " + modelPath );
+
+ //So, load the model file into memory
+ //===================================
+ try {
+ bursiModel = svm.svm_load_model(modelPath);
+ } catch (IOException e) {
+ throw new DSException("Could not read model file '" + modelPath
+ + "' due to: " + e.getMessage());
+ }
+
+ //Verify that the signatures file is accessible
+ //TODO
+
+ // Add the reading of the range file and set up the related variables.
+ //TODO
+ }
+
+
+ /**
+ * Get the path of the model file in plugin directory
+ * @return path to model file.
+ * @throws DSException
+ */
+ private String getModelPath() throws DSException {
+
+ String modelPath="";
+ try {
+ URL url = FileLocator.toFileURL(Platform.getBundle(getPluginID()).getEntry(MODEL_FILE));
+ modelPath=url.getFile();
+ } catch ( IOException e1 ) {
+ throw new DSException("Could not read model file: " + MODEL_FILE
+ + ". Reason: " + e1.getMessage());
+ }
+
+ //File could not be read
+ if ("".equals( modelPath )){
+ throw new DSException("Could not read model file: " + MODEL_FILE);
+ }
+
+ return modelPath;
+ }
+
+
+
+ private double partialDerivative(int component)
+ {
+ // Component numbering starts at 1.
+ double pD, xScaledCompOld;
+ xScaledCompOld = xScaled[component-1].value; // Store the old component so we can copy it back.
+
+ // Forward difference high value point.
+ xScaled[component-1].value = lower + (upper-lower) *
+ (1.0+x[component-1]-feature_min[component-1])/
+ (feature_max[component-1]-feature_min[component-1]);
+
+ // Retrieve the decision function value.
+ double[] decValues = new double[1]; // We only have two classes so this should be one. Look in svm_predict_values for an explanation.
+ svm.svm_predict_values(bursiModel, xScaled, decValues);
+
+ xScaled[component-1].value = xScaledCompOld;
+
+ pD = decValues[0];
+
+ return pD;
+ }
+
+
+ private void predict() throws DSException
+ {
+ prediction = svm.svm_predict(bursiModel, xScaled);
+
+ logger.debug("libsvm prediction: " + prediction);
+
+ // Retrieve the decision function value.
+ double lowPointDecisionFuncValue;
+ double[] decValues = new double[1]; // We only have two classes so this should be one. Look in svm_predict_values for an explanation.
+ svm.svm_predict_values(bursiModel, xScaled, decValues);
+ logger.debug("Decision function value: " + decValues[0]);
+ lowPointDecisionFuncValue = decValues[0];
+
+ //Confirm that the libsvm prediction and our prediction give the same result.
+ if ((decValues[0] * prediction)<0){
+ throw new DSException("Ambiguous result.");
+ }
+
+
+ // For a positive decision function we are looking for the largest positive component of the gradient.
+ // For a negative, we are looking for the largest negative component.
+ boolean maximum;
+ double highPointDecisionFuncValue;
+ if (lowPointDecisionFuncValue > 0)
+ {
+ maximum = true;
+ }
+ else
+ {
+ maximum = false;
+ }
+
+ //NB. We aren't looking for saddle points which is wrong but probably very rare.
+ //For example if the lowPointDecisionFuncValue is greater than the highPointDecisionPointValue for a maximum case.
+ double extremeValue = 0;
+ int significantSignatureNr = 1;
+ for (int key : attributeValues.keySet()) {
+// logger.debug("Keys:" + key);
+ highPointDecisionFuncValue = partialDerivative(key);
+ if (maximum)
+ {
+ if (extremeValue < highPointDecisionFuncValue)
+ {
+ extremeValue = highPointDecisionFuncValue;
+ significantSignatureNr = key;
+ }
+ }
+ else
+ {
+ if (extremeValue > highPointDecisionFuncValue)
+ {
+ extremeValue = highPointDecisionFuncValue;
+ significantSignatureNr = key;
+ }
+ }
+// logger.debug(highPointDecisionFuncValue);
+ }
+ logger.debug("Extreme value: " + extremeValue);
+ logger.debug("Keys: " + significantSignatureNr);
+ significantSignature = signatureList[significantSignatureNr-1];
+ // Make sure significantAtoms is empty.
+ significantAtoms.clear();
+ for (int i : signatureAtoms.get(signatureList[significantSignatureNr-1])){
+ significantAtoms.add(i-1);
+ }
+ }
+
+
+ private void scale()
+ {
+ //Initialize xScaled. In this case the lower value is -1. This is defined in the range file.
+ for (int i = 0; i < nrSignatures; i++){
+ xScaled[i] = new svm_node();
+ xScaled[i].index = i + 1;
+ xScaled[i].value = lower + (upper-lower) *
+ (x[i]-feature_min[i])/
+ (feature_max[i]-feature_min[i]);
+ }
+ }
+
+
+ private void predictAndComputeSignificance() throws DSException {
+ logger.debug("Predicting and computing significance.");
+
+ // The unscaled attributes.
+ for (int i = 0; i < nrSignatures; i++){
+ int signatureNr = i + 1;
+ if (attributeValues.containsKey(signatureNr) ){
+ x[i] = attributeValues.get(signatureNr);
+ logger.debug("Singature number: " + signatureNr + ", value: " + x[i]);
+ }
+ else{
+ x[i] = 0.0;
+ }
+ }
+ // Do a scaling.
+ scale();
+
+ // Predict
+ predict();
+
+ }
+
+ private void createSignatures(IMolecule mol) throws BioclipseException{
+
+ ISignaturesManager sign=net.bioclipse.ds.signatures.Activator.
+ getDefault().getJavaSignaturesManager();
+
+ List<String> signatures = sign.generate( mol );
+
+ //Loop over all generated signature for the current molecule
+ int molSignature=0;
+ for (String sig : signatures){
+
+ molSignature++; //Next signature
+
+ int modelSignatureNr = 0; //The current signature in the model
+ Integer currentAttributeValue = 0;
+
+ //Loop over all signatures in model
+ for (String signature : signatureList) {
+ modelSignatureNr = modelSignatureNr + 1;
+ if (signature.equals(sig)){
+ // We have a matching signature. Add 1 to the attribute and append the atomNr to the signature hashmap list.
+ if (attributeValues.containsKey(modelSignatureNr)){
+ currentAttributeValue = (Integer) attributeValues.get(modelSignatureNr);
+ attributeValues.put(modelSignatureNr, new Integer(currentAttributeValue + 1));
+ }
+ else {
+ attributeValues.put(modelSignatureNr, new Integer(1));
+ }
+ if (signatureAtoms.containsKey(signature)){
+ signatureAtoms.get(signature).add(molSignature);
+ //System.out.println("Significant atom:" + lineNr);
+ //System.out.println(signature);
+ }
+ else {
+ signatureAtoms.put(signature, new ArrayList<Integer>());
+ signatureAtoms.get(signature).add(molSignature);
+ //System.out.println("Significant atom:" + lineNr);
+ //System.out.println(signature);
+ }
+ }
+ }
+
+ }
+
+
+
+ }
+
+
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+
+ @Override
+ protected List<? extends ITestResult> doRunTest( ICDKMolecule cdkmol,
+ IProgressMonitor monitor ) {
+
+ //Remove all hydrogens in molecule
+ //cdkmol=cdk.removeExplicitHydrogens( cdkmol );
+ //cdkmol=cdk.removeImplicitHydrogens( cdkmol );
+
+ //Make room for new predicions
+ attributeValues=new HashMap<Integer, Integer>();
+ signatureAtoms=new HashMap<String, ArrayList<Integer>>();
+ significantAtoms=new ArrayList<Integer>();
+ xScaled = new svm_node[nrSignatures];
+ x=new double[nrSignatures];
+
+ //Check for cancellation
+ if (monitor.isCanceled())
+ return returnError( "Cancelled","");
+
+ //Create signatures for this molfile
+ try {
+ createSignatures( cdkmol);
+ } catch ( BioclipseException e1 ) {
+ e1.printStackTrace();
+ return returnError("Signatures error", e1.getMessage());
+ }
+
+ //Ensure we have what we need
+ if (signatureAtoms.size()<=0){
+ return returnError("No signature atoms produced by signaturesrunner", "");
+ }
+
+ //Check for cancellation
+ if (monitor.isCanceled())
+ return returnError( "Cancelled","");
+
+ //Predict using the signatureatoms and attributevalues
+ try {
+ predictAndComputeSignificance();
+ } catch ( DSException e ) {
+ return returnError( e.getMessage(),"");
+ }
+
+ //Remove the temp file
+// tempfile.delete();
+
+ //Create a new match with correct coloring
+// SubStructureMatch match = new SubStructureMatch(significantSignature,ITestResult.INCONCLUSIVE);
+ ScaledResultMatch match = new ScaledResultMatch(significantSignature,ITestResult.INCONCLUSIVE);
+
+ if (prediction>0)
+ match.setClassification( ITestResult.POSITIVE );
+ else
+ match.setClassification( ITestResult.NEGATIVE );
+
+ IAtomContainer significantAtomsContainer=cdkmol.getAtomContainer().getBuilder().newAtomContainer();
+ for (int significantAtom : significantAtoms){
+
+ //We should add atoms from the input cdkmol, not the clone!
+ significantAtomsContainer.addAtom( cdkmol.getAtomContainer().getAtom( significantAtom-1 ));
+ logger.debug("center atom: " + significantAtom);
+ //Also add all atoms connected to significant atoms to list
+ for (IAtom nbr : cdkmol.getAtomContainer().getConnectedAtomsList(cdkmol.getAtomContainer().getAtom( significantAtom-1 )) ){
+ int nbrAtomNr = cdkmol.getAtomContainer().getAtomNumber(nbr) + 1;
+ IAtom atomToAdd = cdkmol.getAtomContainer().getAtom(nbrAtomNr-1);
+ significantAtomsContainer.addAtom(atomToAdd);
+ logger.debug("nbr: " + nbrAtomNr);
+
+ //Set to max for scaledresult
+ match.putAtomResult( atomToAdd, 100 );
+ }
+ }
+ logger.debug("Number of center atoms: " + significantAtoms.size());
+
+ //We want to set the color of the hilighting depending on the prediction. If the decision function > 0.0 the color should be red, otherwise it should be green.
+ //we also want the filled circles to be larger so that they become visible for non carbons.
+ match.setAtomContainer( significantAtomsContainer );
+ match.writeResultsAsProperties( cdkmol.getAtomContainer(),
+ net.bioclipse.ds.bursi.signatures.Activator.BURSI_RESULT_PROPERTY);
+
+ //We can have multiple hits...
+ List<ITestResult> results=new ArrayList<ITestResult>();
+ //...but here we only have one
+ results.add( match );
+
+ return results;
+
+ }
+
+
+}
View
33 ....ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/SignSigPropertyCalculator.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ola Spjuth - initial API and implementation
+ ******************************************************************************/
+package net.bioclipse.ds.bursi.signatures;
+
+import net.bioclipse.ds.impl.calc.BaseDSPropertyCalculator;
+
+
+/**
+ *
+ * @author ola
+ *
+ */
+public class SignSigPropertyCalculator extends BaseDSPropertyCalculator{
+
+ @Override
+ public String getPropertyName() {
+ return "Bursi Signature Significance";
+ }
+
+ @Override
+ public String getTestID() {
+ return "bursi.signatures";
+ }
+
+}
View
66 ...bioclipse.ds.bursi.signatures/src/net/bioclipse/ds/bursi/signatures/SignSigTestmodel.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ola Spjuth - initial API and implementation
+ ******************************************************************************/
+package net.bioclipse.ds.bursi.signatures;
+
+ import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.bioclipse.cdk.domain.ICDKMolecule;
+import net.bioclipse.core.business.BioclipseException;
+import net.bioclipse.ds.model.ITestResult;
+import net.bioclipse.ds.model.TestRun;
+import net.bioclipse.ds.model.report.AbstractTestReportModel;
+import net.bioclipse.ds.model.report.DSRow;
+import net.bioclipse.ds.model.report.ReportHelper;
+
+
+public class SignSigTestmodel extends AbstractTestReportModel{
+
+
+ public SignSigTestmodel() {
+ super();
+ }
+
+ public List<DSRow> extractRows(TestRun run){
+
+ //for a testrunm transform to a DSRow with a structure image and paams
+ List<DSRow> newrows=new ArrayList<DSRow>();
+ if (run.getMatches()==null) return newrows;
+
+ for (int i=0; i<run.getMatches().size(); i++){
+
+ ITestResult match = run.getMatches().get( i );
+
+ Map<String, String> params=new HashMap<String, String>();
+ params.put("name", match.getName());
+ params.put("classification", ReportHelper.statusToString(
+ match.getClassification()));
+
+ //Ok, we need to take the query molecule and highlight the
+ // substructure from this match
+ ICDKMolecule mainmol = run.getMolecule();
+ byte[] structureImage = null;
+ try {
+ structureImage = ReportHelper.createImage(mainmol, match);
+ } catch ( BioclipseException e ) {
+ e.printStackTrace();
+ }
+ DSRow row=new DSRow(structureImage, params );
+ newrows.add( row );
+
+ }
+
+ return newrows;
+ }
+
+}
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/.DS_Store
Binary file not shown
View
8 plugins/net.bioclipse.ds.cpdb.signatures/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="jars/libsvm.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
28 plugins/net.bioclipse.ds.cpdb.signatures/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.bioclipse.ds.cpdb.signatures</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
23 plugins/net.bioclipse.ds.cpdb.signatures/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CPDB Signatures
+Bundle-SymbolicName: net.bioclipse.ds.cpdb.signatures;singleton:=true
+Bundle-Version: 2.2.0.v20100127
+Bundle-Activator: net.bioclipse.ds.cpdb.signatures.Activator
+Bundle-Vendor: The Bioclipse Team
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ net.bioclipse.ds;bundle-version="0.1.1",
+ net.bioclipse.core;bundle-version="2.0.0",
+ net.bioclipse.ui;bundle-version="2.0.0",
+ net.bioclipse.ui.business;bundle-version="2.0.0",
+ net.bioclipse.scripting;bundle-version="2.0.0",
+ net.bioclipse.scripting.ui;bundle-version="2.0.0",
+ net.bioclipse.cdk.business;bundle-version="2.0.0",
+ org.openscience.cdk.interfaces;bundle-version="1.2.2",
+ net.bioclipse.ds.signatures;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: jars/libsvm.jar,
+ .
+Import-Package: org.apache.log4j;version="1.2.15"
View
9 plugins/net.bioclipse.ds.cpdb.signatures/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ jars/libsvm.jar,\
+ data/,\
+ exec/,\
+ icons/
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/data/.DS_Store
Binary file not shown
View
419 plugins/net.bioclipse.ds.cpdb.signatures/data/cpdbasRatMmol_Sign1.train.scale.model
419 additions, 0 deletions not shown
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/jars/libsvm.jar
Binary file not shown
View
28 plugins/net.bioclipse.ds.cpdb.signatures/plugin.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="net.bioclipse.decisionsupport">
+
+ <test
+ id="cpdb.signatures"
+ name="CPDB Signature Significance"
+ class="net.bioclipse.ds.cpdb.signatures.CPDBSignSigRunner"
+ endpoint="net.bioclipse.ds.carcinogenicity">
+ </test>
+ </extension>
+
+ <!--test
+ id="cpdb.signatures"
+ name="CPDB Signatures"
+ endpoint="net.bioclipse.ds.carcinogenicity"
+ reportmodel="net.bioclipse.ds.impl.report.SmartsMatchReportModel"
+ consensus="net.bioclipse.ds.consensus.majority.emptynegative"
+ propertycalculator="CPDB Signatures"
+ class="net.bioclipse.ds.cpdb.impl.SignMatchImpl">
+ </test-->
+
+
+
+</plugin>
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/.DS_Store
Binary file not shown
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/.DS_Store
Binary file not shown
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/.DS_Store
Binary file not shown
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/.DS_Store
Binary file not shown
View
BIN  plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/.DS_Store
Binary file not shown
View
52 plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/signatures/Activator.java
@@ -0,0 +1,52 @@
+package net.bioclipse.ds.cpdb.signatures;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "net.bioclipse.ds.cpdb.signatures";
+
+ public static final String CPDB_RESULT_PROPERTY="CPDB_RESULT_PROPERTY";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
View
444 ....bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/signatures/CPDBSignSigRunner.java
@@ -0,0 +1,444 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth, Lars Carlsson, Martin Eklund
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ola Spjuth
+ * Lars Carlsson
+ * Martin Eklund
+ ******************************************************************************/
+package net.bioclipse.ds.cpdb.signatures;
+
+import java.awt.Color;
+import java.io.IOException;
+import java.net.URL;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import libsvm.svm;
+import libsvm.svm_model;
+import libsvm.svm_node;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+
+import net.bioclipse.cdk.business.Activator;
+import net.bioclipse.cdk.business.ICDKManager;
+import net.bioclipse.cdk.domain.ICDKMolecule;
+import net.bioclipse.core.business.BioclipseException;
+import net.bioclipse.core.domain.IMolecule;
+import net.bioclipse.ds.impl.result.ScaledResultMatch;
+import net.bioclipse.ds.model.AbstractDSTest;
+import net.bioclipse.ds.model.DSException;
+import net.bioclipse.ds.model.IDSTest;
+import net.bioclipse.ds.model.ITestResult;
+import net.bioclipse.ds.signatures.business.ISignaturesManager;
+
+/**
+ *
+ * @author Ola Spjuth, Lars Carlsson, Martin Eklund
+ *
+ */
+public class CPDBSignSigRunner extends AbstractDSTest implements IDSTest{
+
+ //The logger of the class
+ private static final Logger logger = Logger.getLogger(CPDBSignSigRunner.class);
+
+ //The model file
+ private static final String MODEL_FILE="/data/cpdbasRatMmol_Sign1.train.scale.model";
+
+ // Block of member variables. Can they reside here?
+ // Most of the member variables below are hardcoded for the specific example
+ //with 198 descriptors.
+
+ // This is an array of the signatures used in the model.
+ //All model specific files resides in the directory ModelSpecificFiles.
+ //TODO: read this info from file
+ public static final String[] signatureList = {"[C]([C])", "[C]([C][O])", "[O]([C])", "[C]([C][N][O])", "[N]([C])", "[C]([C][C][N])", "[C]([C][C])", "[N]([C][C])", "[C]([C][C][O])", "[N]([C][N])", "[C]([N][N][S])", "[C]([C][N])", "[C]([C][C][S])", "[S]([C][C])", "[O]([C][C])", "[N]([C][O][O])", "[O]([N])", "[N]([C][O])", "[C]([O][O])", "[C]([C][C][C])", "[C]([C][O][O])", "[C]([N])", "[N]([C][C][C])", "[C]([O])", "[C]([C][C][C][O])", "[C]([C][C][H][N])", "[H]([C])", "[C]([C][H][O][O])", "[C]([C][C][C][H])", "[C]([N][S])", "[S]([C])", "[N]([C][C][N])", "[C]([N][N][O])", "[N]([N][O])", "[C]([Br][C][C])", "[Br]([C])", "[C]([N][N][N])", "[C]([C][S])", "[C]([C][N][N])", "[N]([C][S])", "[S]([N][N])", "[C]([C][N][S])", "[C]([C][C][C][C])", "[C]([N][N])", "[O]([C][S])", "[S]([O][O][O])", "[O]([S])", "[C]([C][Cl])", "[Cl]([C])", "[C]([Cl][N][N])", "[N]([N])", "[N]([C][N][O])", "[N]([N][N])", "[O]([C][N])", "[C]([Br][C])", "[C]([Cl][O])", "[C]([Br][Cl][Cl])", "[N]([C][C][S])", "[S]([C][N])", "[C]([C][Cl][Cl][S])", "[C]([C][Cl][Cl])", "[C]([Cl][Cl][Cl][S])", "[C]([N][O][O])", "[C]([Cl][Cl][Cl][Cl])", "[C]([C][C][Cl])", "[C]([C][C][C][Cl])", "[C]([C][C][Cl][Cl])", "[S]([C][N][O][O])", "[C]([C][F][F][F])", "[F]([C])", "[C]([C][Cl][N])", "[C]([Cl][F])", "[C]([Cl][Cl][Cl])", "[N]([C][C][C][C])", "[C]([C][C][N][O])", "[C]([C][C][C][N])", "[N]([C][C][P])", "[P]([N][N][O][O])", "[O]([P])", "[N]([C][P])", "[O]([C][P])", "[S]([C][C][O][O])", "[C]([C][Cl][Cl][Cl])", "[C]([C][Cl][Cl][F])", "[P]([O][O][O][O])", "[N]([C][C][O])", "[C]([N][O])", "[P]([H][O][O][O])", "[H]([P])", "[C]([P])", "[P]([C][O][O][O])", "[P]([N][O][O][O])", "[N]([N][O][O])", "[C]([C][C][F])", "[C]([C][F])", "[P]([N][N][N][O])", "[N]([C][C][C][O])", "[C]([C][C][H])", "[N]([O][O])", "[S]([C][C][O])", "[C]([S])", "[C]([N][S][S])", "[C]([Cl][Cl])", "[S]([C][O][O][O])", "[C]([C][S][S])", "[C]([C][F][F])", "[C]([N][N][N][N])", "[S]([P])", "[P]([N][N][N][S])", "[N]([S])", "[C]([C][C][C][F])", "[C]([C][C][O][O])", "[C]([Br][Br][Br])", "[N]([O][O][O])"};
+ public static final int nrSignatures = 114;
+
+ // These variables are defined by the range file.
+ //We include them here to avoid parsing the range file.
+ //TODO: read this info from file
+ public static final double lower = -1.0;
+ public static final double upper = 1.0;
+ public static final double[] feature_min = {0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0};
+ public static final double[] feature_max = {12.0 , 6.0 , 13.0 , 10.0 , 4.0 , 9.0 , 18.0 , 5.0 , 8.0 , 2.0 , 1.0 , 6.0 , 2.0 , 2.0 , 7.0 , 4.0 , 8.0 , 2.0 , 1.0 , 9.0 , 6.0 , 6.0 , 6.0 , 6.0 , 2.0 , 2.0 , 4.0 , 1.0 , 4.0 , 1.0 , 1.0 , 2.0 , 1.0 , 2.0 , 10.0 , 10.0 , 3.0 , 3.0 , 3.0 , 2.0 , 1.0 , 2.0 , 2.0 , 4.0 , 2.0 , 1.0 , 2.0 , 6.0 , 12.0 , 1.0 , 1.0 , 1.0 , 1.0 , 3.0 , 3.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0 , 1.0 , 2.0 , 1.0 , 6.0 , 8.0 , 2.0 , 1.0 , 2.0 , 6.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 3.0 , 1.0 , 1.0 , 1.0 , 3.0 , 1.0 , 2.0 , 1.0 , 1.0 , 1.0 , 6.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 2.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 3.0};
+
+ //The SVM model. Read once on initialization.
+ public static svm_model bursiModel;
+
+ // The ones below are needed, but they depend on some hardcoded info.
+ //We need to avoid this, reading 198.
+ private svm_node[] xScaled;
+ private double[] x;
+
+ //Instance fields for a prediction
+ private Map<Integer,Integer> attributeValues;
+ private Map<String,ArrayList<Integer>> signatureAtoms;
+// private ArrayList<Integer> significantAtoms;
+ private double prediction;
+// private String significantSignature = "";
+
+ // Add control over number of selected variables
+ // The present proof-of-principle default is to look at all variables in the regression case
+ private double fractionOfVars = 1; // Selects all variables
+ private TreeMap<Double, Integer> varsAndDerivs = null;
+
+ //We need to ensure that '.' is always decimal separator in all locales
+ DecimalFormat formatter;
+
+ /**
+ * Default constructor
+ */
+ public CPDBSignSigRunner(){
+ super();
+ }
+
+
+ /**
+ * Initialize all paths and read model files into memory.
+ * @throws DSException
+ */
+ public void initialize(IProgressMonitor monitor) throws DSException {
+
+ if (getTestErrorMessage().length()>1){
+ logger.error("Trying to initialize test: " + getName() + " while " +
+ "error message exists");
+ return;
+ }
+ //We need to ensure that '.' is always decimal separator in all locales
+ DecimalFormatSymbols sym=new DecimalFormatSymbols();
+ sym.setDecimalSeparator( '.' );
+ formatter = new DecimalFormat("0.00", sym);
+
+ //Get model path
+ String modelPath = getModelPath();
+ logger.debug( "Model file path is: " + modelPath );
+
+ //So, load the model file into memory
+ //===================================
+ try {
+ bursiModel = svm.svm_load_model(modelPath);
+ } catch (IOException e) {
+ throw new DSException("Could not read model file '" + modelPath
+ + "' due to: " + e.getMessage());
+ }
+
+ //Verify that the signatures file is accessible
+ //TODO
+
+ // Add the reading of the range file and set up the related variables.
+ //TODO
+ }
+
+
+ /**
+ * Get the path of the model file in plugin directory
+ * @return path to model file.
+ * @throws DSException
+ */
+ private String getModelPath() throws DSException {
+
+ String modelPath="";
+ try {
+ URL url = FileLocator.toFileURL(Platform.getBundle(getPluginID())
+ .getEntry(MODEL_FILE));
+ modelPath=url.getFile();
+ } catch ( IOException e1 ) {
+ throw new DSException("Could not read model file: " + MODEL_FILE
+ + ". Reason: " + e1.getMessage());
+ }
+
+ //File could not be read
+ if ("".equals( modelPath )){
+ throw new DSException("Could not read model file: " + MODEL_FILE);
+ }
+
+ return modelPath;
+ }
+
+
+ private double partialDerivative(int component){
+
+ // Component numbering starts at 1.
+ double pD, xScaledCompOld;
+ xScaledCompOld = xScaled[component-1].value; // Store the old component so we can copy it back.
+
+ // Forward difference high value point.
+ xScaled[component-1].value = lower + (upper-lower) *
+ (1.0+x[component-1]-feature_min[component-1])/
+ (feature_max[component-1]-feature_min[component-1]);
+
+ // Retrieve the decision function value.
+ double[] decValues = new double[1]; // We only have two classes so this should be one. Look in svm_predict_values for an explanation.
+ svm.svm_predict_values(bursiModel, xScaled, decValues);
+
+ xScaled[component-1].value = xScaledCompOld;
+
+ pD = decValues[0];
+
+ return pD;
+ }
+
+
+ private void predict() throws DSException{
+
+ prediction = svm.svm_predict(bursiModel, xScaled);
+
+ logger.debug("libsvm prediction: " + prediction);
+
+// // Retrieve the decision function value.
+// double lowPointDecisionFuncValue;
+// double[] decValues = new double[1]; // We only have two classes so this should be one. Look in svm_predict_values for an explanation.
+// svm.svm_predict_values(bursiModel, xScaled, decValues);
+// logger.debug("Decision function value: " + decValues[0]);
+// lowPointDecisionFuncValue = decValues[0];
+//
+// // Confirm that the libsvm prediction and our prediction give the same result.
+// if ((decValues[0] * prediction)<0){
+// throw new DSException("Ambiguous result.");
+// }
+
+ // Searching for the 'numberOfVars' largest (absolute valued) gradients
+ // The easiest way (which is also reasonably fast) is to collect all gradients in a TreeMap
+ varsAndDerivs = new TreeMap<Double, Integer>();
+ for (int key : attributeValues.keySet()) {
+ varsAndDerivs.put(partialDerivative(key), key);
+ }
+ }
+
+
+ private void scale()
+ {
+ //Initialize xScaled. In this case the lower value is -1. This is defined in the range file.
+ for (int i = 0; i < nrSignatures; i++){
+ xScaled[i] = new svm_node();
+ xScaled[i].index = i + 1;
+ xScaled[i].value = lower + (upper-lower) *
+ (x[i]-feature_min[i])/
+ (feature_max[i]-feature_min[i]);
+ }
+ }
+
+
+ private void predictAndComputeSignificance() throws DSException {
+ logger.debug("Predicting and computing significance.");
+
+ // The unscaled attributes.
+ for (int i = 0; i < nrSignatures; i++){
+ int signatureNr = i + 1;
+ if (attributeValues.containsKey(signatureNr) ){
+ x[i] = attributeValues.get(signatureNr);
+ logger.debug("Singature number: " + signatureNr + ", value: " + x[i]);
+ }
+ else{
+ x[i] = 0.0;
+ }
+ }
+ // Do a scaling.
+ scale();
+
+ // Predict
+ predict();
+
+ }
+
+ /**
+ * Use the plugin net.bioclipse.signatures to generate signatures
+ * @param mol Molecule to generate signatures for
+ * @throws BioclipseException
+ */
+ private void createSignatures(IMolecule mol) throws BioclipseException{
+
+ ISignaturesManager sign=net.bioclipse.ds.signatures.Activator.
+ getDefault().getJavaSignaturesManager();
+
+ List<String> signatures = sign.generate( mol );
+
+ //Loop over all generated signature for the current molecule
+ int molSignature=0;
+ for (String sig : signatures){
+
+ molSignature++; //Next signature
+
+ int modelSignatureNr = 0; //The current signature in the model
+ Integer currentAttributeValue = 0;
+
+ //Loop over all signatures in model
+ for (String signature : signatureList) {
+ modelSignatureNr = modelSignatureNr + 1;
+ if (signature.equals(sig)){
+ // We have a matching signature. Add 1 to the attribute and append the atomNr to the signature hashmap list.
+ if (attributeValues.containsKey(modelSignatureNr)){
+ currentAttributeValue = (Integer) attributeValues.get(modelSignatureNr);
+ attributeValues.put(modelSignatureNr, new Integer(currentAttributeValue + 1));
+ }
+ else {
+ attributeValues.put(modelSignatureNr, new Integer(1));
+ }
+ if (signatureAtoms.containsKey(signature)){
+ signatureAtoms.get(signature).add(molSignature);
+ //System.out.println("Significant atom:" + lineNr);
+ //System.out.println(signature);
+ }
+ else {
+ signatureAtoms.put(signature, new ArrayList<Integer>());
+ signatureAtoms.get(signature).add(molSignature);
+ //System.out.println("Significant atom:" + lineNr);
+ //System.out.println(signature);
+ }
+ }
+ }
+ }
+ }
+
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+
+ @Override
+ protected List<? extends ITestResult> doRunTest( ICDKMolecule cdkmol,
+ IProgressMonitor monitor ) {
+
+ ICDKManager cdk=Activator.getDefault().getJavaCDKManager();
+
+ //Remove all hydrogens in molecule
+ //cdkmol=cdk.removeExplicitHydrogens( cdkmol );
+ //cdkmol=cdk.removeImplicitHydrogens( cdkmol );
+ //TODO: Should we remove this?
+
+ //Make room for new predicions
+ attributeValues=new HashMap<Integer, Integer>();
+ signatureAtoms=new HashMap<String, ArrayList<Integer>>();
+// significantAtoms=new ArrayList<Integer>();
+ xScaled = new svm_node[nrSignatures];
+ x=new double[nrSignatures];
+
+ //Check for cancellation
+ if (monitor.isCanceled())
+ return returnError( "Cancelled","");
+
+ //Create signatures for this molecule
+ try {
+ createSignatures( cdkmol);
+ } catch ( BioclipseException e1 ) {
+ return returnError("Signatures error", e1.getMessage());
+ }
+
+ //Ensure we have what we need
+ if (signatureAtoms.size()<=0){
+ return returnError("No signature atoms produced by signaturesrunner"
+ , "");
+ }
+
+ //Check for cancellation
+ if (monitor.isCanceled())
+ return returnError( "Cancelled","");
+
+ //Predict using the signatureatoms and attributevalues
+ try {
+ predictAndComputeSignificance();
+ } catch ( DSException e ) {
+ return returnError( e.getMessage(),"");
+ }
+
+ // Get largest and smallest derivate for scaling (see below)
+ Double largestDeriv = varsAndDerivs.lastKey();
+ Double smallestDeriv = varsAndDerivs.firstKey();
+ // Create a new match with correct coloring
+// RGBMatch match = new RGBMatch("Result: "
+// + formatter.format( prediction ),
+// ITestResult.INCONCLUSIVE);
+ ScaledResultMatch match = new ScaledResultMatch("Result: "
+ + formatter.format( prediction ),
+ ITestResult.INCONCLUSIVE);
+ IAtomContainer significantAtomsContainer = cdkmol.getAtomContainer()
+ .getBuilder().newAtomContainer();
+
+ // How many variabels do we want to look at?
+ int numberOfVars = (int) fractionOfVars*attributeValues.size();
+ // Go through all the variables that we want to look at
+ for (int i = 0; i < numberOfVars; i++) {
+ Double currentDeriv = null;
+ // Select absolute valued largest remaining variables
+ if(Math.abs(varsAndDerivs.lastKey()) >
+ Math.abs(varsAndDerivs.firstKey())) {
+ currentDeriv = varsAndDerivs.lastKey();
+ }
+ else {
+ currentDeriv = varsAndDerivs.firstKey();
+ }
+ Integer currentVar = varsAndDerivs.get(currentDeriv);
+ // Remove current largest derivative
+ varsAndDerivs.remove(currentDeriv);
+ // We should add atoms from the input cdkmol, not the clone!
+ // Get center atom
+ Integer tmp = signatureAtoms.get(signatureList[currentVar-1]).get(0);
+ IAtom currentAtom = cdkmol.getAtomContainer().getAtom(tmp-1);
+ significantAtomsContainer.addAtom(currentAtom);
+// logger.debug("center atom: " + significantAtom);
+// //Also add all atoms connected to significant atoms to list
+// for (IAtom nbr : cdkmol.getAtomContainer().getConnectedAtomsList(cdkmol.getAtomContainer().getAtom( significantAtom-1 )) ){
+// int nbrAtomNr = cdkmol.getAtomContainer().getAtomNumber(nbr) + 1;
+// IAtom atomToAdd = cdkmol.getAtomContainer().getAtom(nbrAtomNr-1);
+// significantAtomsContainer.addAtom(atomToAdd);
+//
+// //This is where we set the color of the atom. These values are just example.
+// match.putAtomColor( atomToAdd, new Color(100,200,150) );
+// logger.debug("nbr: " + nbrAtomNr);
+// }
+
+ // Scaling. We rescale the derivative to be between 1 and 100.
+ double scaledDeriv = (currentDeriv-smallestDeriv)/(largestDeriv-smallestDeriv)*100+1;
+ match.putAtomResult( currentAtom, (int) scaledDeriv );
+
+/*
+
+ // Scaling. We rescale the derivative to be between 0 and 1.
+ // FIXME: The scaling should probably be done in a more clever way. It is probably more desirable that the scaling isn't relative - now small differences will look "inflated".
+ double scaledDeriv = (currentDeriv-smallestDeriv)/(largestDeriv-smallestDeriv);
+ // Calculate color
+ double frequency = 2*Math.PI;
+ int red = (int) Math.round(Math.sin(frequency*scaledDeriv + 0)*127 + 128);
+ int green = (int) Math.round(Math.sin(frequency*scaledDeriv + 2*Math.PI/3)*127 + 128);
+ int blue = (int) Math.round(Math.sin(frequency*scaledDeriv + 4*Math.PI/3)*127 + 128);
+ match.putAtomColor(currentAtom, new Color(red, green, blue));
+*/
+
+ }
+// logger.debug("Number of center atoms: " + significantAtoms.size());
+
+ //We want to set the color of the hilighting depending on the prediction. If the decision function > 0.0 the color should be red, otherwise it should be green.
+ //we also want the filled circles to be larger so that they become visible for non carbons.
+ match.setAtomContainer( significantAtomsContainer );
+
+ match.writeResultsAsProperties(cdkmol.getAtomContainer(),
+ net.bioclipse.ds.cpdb.signatures.Activator.CPDB_RESULT_PROPERTY);
+
+ //We can have multiple hits...
+ List<ITestResult> results=new ArrayList<ITestResult>();
+ //...but here we only have one
+ results.add( match );
+
+ return results;
+
+ }
+
+
+}
View
44 plugins/net.bioclipse.ds.cpdb.signatures/src/net/bioclipse/ds/cpdb/signatures/RGBMatch.java
@@ -0,0 +1,44 @@
+package net.bioclipse.ds.cpdb.signatures;
+
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openscience.cdk.interfaces.IAtom;
+
+import net.bioclipse.ds.impl.result.SubStructureMatch;
+
+
+public class RGBMatch extends SubStructureMatch{
+
+ private Map<IAtom, Color> colorMap;
+
+ public RGBMatch(String name, int resultStatus) {
+ super( name, resultStatus );
+ }
+
+ @Override
+ public Color getHighlightingColor( IAtom atom ) {
+
+ if (getColorMap().containsKey( atom ))
+ return getColorMap().get( atom );
+
+ return null;
+ }
+
+ public void setColorMap( Map<IAtom, Color> colorMap ) {
+
+ this.colorMap = colorMap;
+ }
+
+ public Map<IAtom, Color> getColorMap() {
+ return colorMap;
+ }
+
+ public void putAtomColor( IAtom atomToAdd, Color color ) {
+ if (colorMap==null) colorMap=new HashMap<IAtom, Color>();
+ colorMap.put( atomToAdd, color );
+
+ }
+
+}
View
7 plugins/net.bioclipse.ds.cpdb/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
28 plugins/net.bioclipse.ds.cpdb/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.bioclipse.ds.cpdb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
18 plugins/net.bioclipse.ds.cpdb/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CPDB for DS
+Bundle-SymbolicName: net.bioclipse.ds.cpdb;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: net.bioclipse.ds.cpdb.Activator
+Bundle-Vendor: The Bioclipse Team
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ net.bioclipse.ds,
+ net.bioclipse.cdk.ui.sdfeditor,
+ net.bioclipse.cdk.business,
+ net.bioclipse.core,
+ org.openscience.cdk.interfaces,
+ net.bioclipse.ds.signatures;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.apache.log4j;version="1.2.15"
View
4 plugins/net.bioclipse.ds.cpdb/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
View
150,090 plugins/net.bioclipse.ds.cpdb/data/CPDBAS_CleanMMX-1.sdf
150,090 additions, 0 deletions not shown
View
41,669 plugins/net.bioclipse.ds.cpdb/data/cpdb-processed.sdf
41,669 additions, 0 deletions not shown
View
21 plugins/net.bioclipse.ds.cpdb/html/carcinogenicity.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Mutagenicity Endpoint</title>
+ <link rel="stylesheet" href="../../PRODUCT_PLUGIN/narrow_book.css" type="text/css">
+</head>
+
+<body>
+<h1>Carcinogenicity Endpoint</h1>
+
+<h2>Overview</h2>
+The feature provides near-real-time tests that can predict properties for
+a chemical structure and hence decision support.
+
+<h2>Underlying data</h2>
+Data from <a href="http://potency.berkeley.edu/">The Carcinogenic Potency Database (CPDB)</a>.
+
+</body>
+</html>
View
BIN  plugins/net.bioclipse.ds.cpdb/icons/db.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  plugins/net.bioclipse.ds.cpdb/icons/form.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  plugins/net.bioclipse.ds.cpdb/icons/poison.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  plugins/net.bioclipse.ds.cpdb/icons/poll.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
262 plugins/net.bioclipse.ds.cpdb/plugin.xml
@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.help.toc">
+ <toc
+ file="toc.xml"
+ primary="true"/>
+ </extension>
+
+
+ <extension
+ point="net.bioclipse.decisionsupport">
+
+ <endpoint
+ id="net.bioclipse.ds.carcinogenicity"
+ description="Involved in the promotion of cancer or in the increase of its propagation"
+ icon="icons/poison.gif"
+ name="Carcinogenicity">
+ </endpoint>
+
+ <test
+ id="cpdb.sdflookup.exact"
+ name="CPDB exact matches"
+ endpoint="net.bioclipse.ds.carcinogenicity"
+ class="net.bioclipse.ds.impl.SDFPosNegExactMatchFP"
+ propertycalculator="CPDB Exact Match"
+ informative="true"
+ reportmodel="net.bioclipse.ds.impl.report.ExactMatchReportModel">
+ <resource name="file"
+ path="data/cpdb-processed.sdf">
+ </resource>
+ <parameter name="responseProperty" value="ActivityOutcome_CPDBAS_Rat" />
+ <parameter name="positiveValue" value="active" />
+ <parameter name="negativeValue" value="inactive" />
+ </test>
+
+ <test
+ id="cpdb.sdflookup.nearest"
+ name="CPDB nearest neighbour"
+ endpoint="net.bioclipse.ds.carcinogenicity"
+ class="net.bioclipse.ds.impl.SDFPosNegNearestMatchFP"
+ consensus="net.bioclipse.ds.consensus.majority.emptynegative"
+ propertycalculator="CPDB Nearest Neighbours"
+ reportmodel="net.bioclipse.ds.impl.report.NNReportModel">
+ <resource name="file"
+ path="data/cpdb-processed.sdf">
+ </resource>
+ <parameter name="distance.tanimoto" value="0.7" />
+ <parameter name="responseProperty" value="ActivityOutcome_CPDBAS_Rat" />
+ <parameter name="positiveValue" value="active" />
+ <parameter name="negativeValue" value="inactive" />
+ </test>
+
+ <test
+ id="cpdb.consensus"
+ name="Carcinogenicity Consensus"
+ visible="false"
+ endpoint="net.bioclipse.ds.carcinogenicity"
+ class="net.bioclipse.ds.impl.BogusTest"
+ icon="icons/db.gif">
+ </test>
+
+ </extension>
+
+
+
+
+ <extension
+ point="net.bioclipse.cdk.propertyCalculator">
+ <Calculator
+ class="net.bioclipse.ds.cpdb.calc.ExactMatchCalculator"
+ id="CPDB Exact Match">
+ </Calculator>
+ <Calculator
+ class="net.bioclipse.ds.cpdb.calc.NearestMatchCalculator"
+ id="CPDB Nearest Neighbours">
+ </Calculator>
+
+ <Calculator
+ class="net.bioclipse.ds.cpdb.calc.SignaturesMatchCalculator"
+ id="CPDB Signatures">
+ </Calculator>
+
+ <Calculator
+ class="net.bioclipse.ds.cpdb.calc.CarcinogenicityConsensusCalculator"
+ id="Carcinogenicity Consensus">
+ </Calculator>
+
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:net.bioclipse.ds.context?after=single">
+ <command
+ commandId="net.bioclipse.cdk.ui.sdfeditor.addProperty"
+ label="CPDB Exact Matches"
+ icon="icons/db.gif"
+ style="push">
+ <parameter
+ name="net.bioclipse.cdk.ui.sdfeditor.calculatorId"
+ value="CPDB Exact Match">
+ </parameter>
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="net.bioclipse.cdk.ui.sdfeditor.editor.MultiPageMoleculesEditorPart">
+ </instanceof>
+ </with>
+ </visibleWhen>
+ </command>
+
+ <command
+ commandId="net.bioclipse.cdk.ui.sdfeditor.addProperty"
+ label="CPDB Nearest Neighbors"
+ icon="icons/db.gif"
+ style="push">
+ <parameter
+ name="net.bioclipse.cdk.ui.sdfeditor.calculatorId"
+ value="CPDB Nearest Neighbours">
+ </parameter>
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="net.bioclipse.cdk.ui.sdfeditor.editor.MultiPageMoleculesEditorPart">
+ </instanceof>
+ </with>
+ </visibleWhen>
+ </command>
+
+ <command
+ commandId="net.bioclipse.cdk.ui.sdfeditor.addProperty"
+ label="CPDB Signatures Matches"
+ icon="icons/form.gif"
+ style="push">
+ <parameter
+ name="net.bioclipse.cdk.ui.sdfeditor.calculatorId"
+ value="CPDB Signatures">
+ </parameter>
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="net.bioclipse.cdk.ui.sdfeditor.editor.MultiPageMoleculesEditorPart">
+ </instanceof>
+ </with>
+ </visibleWhen>
+ </command>
+
+ </menuContribution>
+ </extension>
+
+
+
+ <extension
+ point="org.eclipse.ui.menus">
+
+
+ <menuContribution
+ locationURI="popup:net.bioclipse.ds.context?after=consensus">
+
+ <command
+ commandId="net.bioclipse.cdk.ui.sdfeditor.addProperty"
+ label="Carcinogenicity Consensus Clasification"
+ icon="icons/poll.gif"
+ style="push">
+ <parameter
+ name="net.bioclipse.cdk.ui.sdfeditor.calculatorId"
+ value="CPDB Exact Match,CPDB Nearest Neighbours,CPDB Signatures,CPDB Signature Significance,Carcinogenicity Consensus">
+ </parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="net.bioclipse.cdk.ui.sdfeditor.menu.fileOrEditor">
+ </reference>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+
+
+ <!--extension
+ point="org.eclipse.core.expressions.definitions">
+ <definition
+ id="net.bioclipse.cdk.ui.sdfeditor.menu.file">
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <or>
+ <test
+ property="org.eclipse.core.resources.contentTypeId"
+ value="net.bioclipse.contenttypes.sdf0d">
+ </test>
+ <test
+ property="org.eclipse.core.resources.contentTypeId"
+ value="net.bioclipse.contenttypes.sdf2d">
+ </test>
+ <test
+ property="org.eclipse.core.resources.contentTypeId"
+ value="net.bioclipse.contenttypes.sdf3d">
+ </test>
+ </or>
+ </adapt>
+ </iterate>
+ </definition>
+
+ <definition
+ id="net.bioclipse.cdk.ui.sdfeditor.menu.editor">
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="net.bioclipse.cdk.ui.sdfeditor.editor.MultiPageMoleculesEditorPart">
+ </instanceof>
+ </with>
+ </definition>
+ <definition
+ id="net.bioclipse.cdk.ui.sdfeditor.menu.fileOrEditor">
+ <or>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <or>
+ <test
+ property="org.eclipse.core.resources.contentTypeId"
+ value="net.bioclipse.contenttypes.sdf0d">
+ </test>
+ <test
+ property="org.eclipse.core.resources.contentTypeId"
+ value="net.bioclipse.contenttypes.sdf2d">
+ </test>
+ <test
+ property="org.eclipse.core.resources.contentTypeId"
+ value="net.bioclipse.contenttypes.sdf3d">
+ </test>
+ </or>
+ </adapt>
+ </iterate>
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="net.bioclipse.cdk.ui.sdfeditor.editor.MultiPageMoleculesEditorPart">
+ </instanceof>
+ </with>
+ </or>
+ </definition>
+ </extension-->
+
+
+
+</plugin>
View
50 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/Activator.java
@@ -0,0 +1,50 @@
+package net.bioclipse.ds.cpdb;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "net.bioclipse.ds.cpdb";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
View
29 ....bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/calc/CarcinogenicityConsensusCalculator.java
@@ -0,0 +1,29 @@
+package net.bioclipse.ds.cpdb.calc;
+
+import net.bioclipse.ds.impl.calc.DSConsensusCalculator;
+
+/**
+ *
+ * @author ola
+ *
+ */
+public class CarcinogenicityConsensusCalculator extends DSConsensusCalculator {
+
+
+
+ @Override
+ public String getPropertyName() {
+ return "Carcinogenicity Consensus";
+ }
+
+ @Override
+ protected String getTestID() {
+ return "carcinogenicity.consensus";
+ }
+
+ protected String getEndpoint(){
+ return "net.bioclipse.ds.carcinogenicity";
+ }
+
+
+}
View
33 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/calc/ExactMatchCalculator.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ola Spjuth - initial API and implementation
+ ******************************************************************************/
+package net.bioclipse.ds.cpdb.calc;
+
+import net.bioclipse.ds.impl.calc.BaseDSPropertyCalculator;
+
+
+/**
+ *
+ * @author ola
+ *
+ */
+public class ExactMatchCalculator extends BaseDSPropertyCalculator{
+
+ @Override
+ public String getPropertyName() {
+ return "CPDB exact matches";
+ }
+
+ @Override
+ public String getTestID() {
+ return "cpdb.sdflookup.exact";
+ }
+
+}
View
33 plugins/net.bioclipse.ds.cpdb/src/net/bioclipse/ds/cpdb/calc/NearestMatchCalculator.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ola Spjuth.
+ * All rights reserved. This program and the accompanying mater