Author: scooter
Date: 2010-10-27 17:46:21 -0700 (Wed, 27 Oct 2010)
New Revision: 22543
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/
csplugins/trunk/ucsf/scooter/bioCycPlugin/build.xml
csplugins/trunk/ucsf/scooter/bioCycPlugin/resources/
csplugins/trunk/ucsf/scooter/bioCycPlugin/resources/plugin.props
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/commands/
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/commands/BioCycCommandHandler.java
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Compound.java
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Database.java
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Protein.java
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reactant.java
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reaction.java
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/
Log:
Beginnings of BioCyc plugin
Added: csplugins/trunk/ucsf/scooter/bioCycPlugin/build.xml
===================================================================
--- csplugins/trunk/ucsf/scooter/bioCycPlugin/build.xml
(rev 0)
+++ csplugins/trunk/ucsf/scooter/bioCycPlugin/build.xml 2010-10-28 00:46:21 UTC
(rev 22543)
@@ -0,0 +1,264 @@
+
+<project name="bioCycPlugin"
+ default="all"
+ basedir="."
+ xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <!-- =================================================================== -->
+ <!-- Project Settings -->
+ <!-- -->
+ <!-- Adjust each property listed in this target with the appropriate -->
+ <!-- information for this project. -->
+ <!-- =================================================================== -->
+ <target name="settings">
+
+ <!-- The name of your plugin and resulting jar file -->
+ <property name="name" value="bioCycPlugin"/>
+
+ <!-- The package that contains your plugin class. -->
+ <property name="plugin.class.package" value="bioCycPlugin"/>
+
+ <!-- The name of your plugin class, i.e. the one that extends Cytoscape
plugin. -->
+ <property name="plugin.class.name"
value="${plugin.class.package}.BioCycPlugin"/>
+
+ <!-- The version of your plugin. To support plugin.props, make sure the
+ version is expressed in decimal notation, e.g. 3.0, 3.1, 3.14, etc.
-->
+ <property name="version" value="1.7"/>
+
+ <!-- The version of Cytoscape that you depend on. -->
+ <property name="cytoscape.version" value="2.8.0-beta2-SNAPSHOT"/>
+
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Project initialization settings -->
+ <!-- Most developers shouldn't *need* to adjust any settings here. -->
+ <!-- =================================================================== -->
+ <target name="init"
+ depends="settings" >
+ <tstamp/>
+ <echo message="Building ${name} version ${version} ..."/>
+
+ <!-- Inheritable properties -->
+ <property name="debug" value="on"/>
+ <property name="optimize" value="off"/>
+ <property name="deprecation" value="on"/>
+ <property name="fork" value="false"/>
+
+ <!-- Define the directories -->
+ <property name="root.dir" value="."/>
+ <property name="resources.dir" value="${root.dir}/resources"/>
+ <property name="src.dir" value="${root.dir}/src"/>
+ <property name="tests.dir" value="${root.dir}/tests"/>
+ <property name="build.dir" value="${root.dir}/build"/>
+ <property name="lib.dir" value="${root.dir}/lib"/>
+ <property name="javadoc.dir" value="${build.dir}/API"/>
+ <property name="log.dir" value="${build.dir}/logs" />
+ <property name="junit.report.dir" value="${log.dir}/junit-reports" />
+
+ <!-- Define the relevant files -->
+ <property name="project.jar" value="${name}-${version}.jar"/>
+ <property name="test.jar" value="${name}-${version}-tests.jar"/>
+
+ <!-- Define external dependencies -->
+ <artifact:remoteRepository
+ id="cytoscape_releases"
+
url="http://cytoscape.wodaklab.org/nexus/content/repositories/releases/" />
+ <artifact:remoteRepository
+ id="cytoscape_snapshots"
+
url="http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/" />
+ <!-- artifact:dependencies pathId="dependency.classpath">
+ <dependency groupId="cytoscape"
+ artifactId="application"
+ version="${cytoscape.version}"/>
+ <dependency groupId="junit"
+ artifactId="junit"
+ version="3.8.1"/>
+ </artifact:dependencies-->
+ <property name="dependency.classpath" value="../../../../cytoscape/"/>
+
+ <!-- Define the class path -->
+ <path id="project.class.path">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="../../../../cytoscape/build/">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <!-- Define the junit class path - It needs to find what we just built -->
+ <path id="junit.class.path" >
+ <fileset dir="${root.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <path refid="dependency.classpath"/>
+ </path>
+
+ <!-- Make sure tests is in the right place -->
+ <condition property="tests.ok">
+ <and>
+ <available file="${tests.dir}" />
+ </and>
+ </condition>
+
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the project -->
+ <!-- =================================================================== -->
+ <target name="compile"
+ depends="init" >
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${log.dir}"/>
+ <javac srcdir="${src.dir}"
+ classpathref="project.class.path"
+ destdir="${build.dir}"
+ debug="${debug}"
+ source="1.5"
+ target="1.5"
+ nowarn="on"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ fork="${fork}">
+ <compilerarg line="-Xlint:all -Xlint:-path"/>
+ </javac>
+ <echo message="Successfully ran compile task!"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- Creates the project jar file -->
+ <!-- =================================================================== -->
+ <target name="jar"
+ depends="compile" >
+ <filter token="version" value="${version}"/>
+ <copy file="${resources.dir}/plugin.props"
+ todir="${build.dir}/${plugin.class.package}"
+ filtering="true"
+ overwrite="true"/>
+ <unjar dest="${build.dir}">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ </unjar>
+
+ <jar destfile="${project.jar}" >
+ <fileset dir="${build.dir}" includes="**"/>
+ <manifest>
+ <attribute name="Cytoscape-Plugin" value="${plugin.class.name}"/>
+ </manifest>
+ </jar>
+ <echo message="Successfully ran jar task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the tests -->
+ <!-- Note that this compilation occurs AFTER the distribution jar has -->
+ <!-- been created, so that the tests aren't distributed. -->
+ <!-- =================================================================== -->
+ <target name="compile-tests"
+ depends="jar"
+ if="tests.ok">
+ <javac srcdir="${tests.dir}"
+ classpathref="project.class.path"
+ destdir="${build.dir}"
+ debug="${debug}"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ source="1.5"
+ target="1.5"
+ fork="${fork}">
+ <compilerarg line="-Xlint:all -Xlint:-path"/>
+ </javac>
+ <echo message="Successfully ran compile-tests task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Creates the project-tests.jar file -->
+ <!-- =================================================================== -->
+ <target name="jar-tests"
+ depends="compile-tests"
+ if="tests.ok">
+ <jar jarfile="${test.jar}"
+ basedir="${build.dir}" >
+ </jar>
+ <echo message="Successfully ran jar-tests task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Runs the unit tests. -->
+ <!-- =================================================================== -->
+ <target name="test"
+ depends="jar-tests"
+ if="tests.ok">
+ <junit printsummary="yes"
+ haltonfailure="no"
+ maxmemory="256m" >
+ <classpath refid="junit.class.path"/>
+ <formatter type="plain"
+ usefile="true" />
+ <formatter type="xml"
+ usefile="true" />
+ <batchtest fork="yes"
+ todir="${log.dir}"
+ failureProperty="junit.test.failure"
+ errorProperty="junit.test.failure">
+ <fileset dir="${tests.dir}"
+ includes="**/*Test.java"
+ excludes="**/AllTests.java" />
+ </batchtest>
+ </junit>
+ <mkdir dir="${junit.report.dir}"/>
+ <junitreport todir="${junit.report.dir}">
+ <fileset dir="${log.dir}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${junit.report.dir}"/>
+ </junitreport>
+ <fail message="TEST FAILURE!!! Details: ${junit.report.dir}/index.html"
+ if="junit.test.failure"/>
+ <echo message="Successfully ran test task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Creates the API documentation -->
+ <!-- =================================================================== -->
+ <target name="docs"
+ depends="init" >
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc sourcepath="${src.dir}"
+ destdir="${javadoc.dir}"
+ packagenames="*"
+ classpathref="project.class.path"
+ author="true"
+ version="true"
+ use="true"
+ splitindex="true"
+ noindex="false"
+ windowtitle="${name} API"
+ doctitle="${name}" />
+ <echo message="Successfully ran docs task!"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Do everything -->
+ <!-- =================================================================== -->
+ <target name="all" depends="jar,test,docs" />
+
+ <!-- =================================================================== -->
+ <!-- Clean up, get back to original state -->
+ <!-- =================================================================== -->
+ <target name="clean"
+ depends="init">
+ <delete dir="${build.dir}"/>
+ <delete file="${project.jar}"/>
+ <delete file="${test.jar}"/>
+ <echo message="Successfully ran clean task!"/>
+ </target>
+
+</project>
+
Added: csplugins/trunk/ucsf/scooter/bioCycPlugin/resources/plugin.props
===================================================================
--- csplugins/trunk/ucsf/scooter/bioCycPlugin/resources/plugin.props
(rev 0)
+++ csplugins/trunk/ucsf/scooter/bioCycPlugin/resources/plugin.props
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,34 @@
+#plugin.props
+
+# This props file should be filled out and included in the plugin jar file.
This props file will be used
+# to put information into the Plugin Manager about the plugin
+
+# -- The following properties are REQUIRED -- #
+
+# The plugin name that will be displayed to users
+pluginName=commandTool
+
+# Description used to give users information about the plugin such as what it
does.
+# Html tags are encouraged for formatting purposes.
+pluginDescription=This plugin provides an interface to the new Cytoscape 2.7
command feature
+
+# Plugin version number, this must be two numbers separated by a decimlal.
Ex. 0.2, 14.03
+pluginVersion=0.9
+
+# Compatible Cytoscape version
+cytoscapeVersion=2.7
+
+# Category, use one of the categories listed on the website or create your own
+pluginCategory=Other
+
+# -- The following properties are OPTIONAL -- #
+
+# URL to a website that gives more information about your plugin, Ex.
http://my-lab-site.org
+projectURL=http://www.rbvi.ucsf.edu/Research/cytoscape/
+
+# List of authors. Note each author and institution pair are separated by a :
(colon)
+# each additional author institution pair must be separated from other pairs
bye a ; (semicolon)
+pluginAuthorsIntsitutions=John "Scooter" Morris:UCSF
+
+# Date this plugin/plugin version was released
+releaseDate=June 1, 2010
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java
===================================================================
---
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java
(rev 0)
+++
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,58 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package bioCycPlugin;
+
+import cytoscape.Cytoscape;
+import cytoscape.command.CyCommandManager;
+import cytoscape.plugin.CytoscapePlugin;
+import cytoscape.CytoscapeInit;
+import cytoscape.logger.CyLogger;
+
+public class BioCycPlugin extends CytoscapePlugin {
+ private CyLogger logger = null;
+
+ /**
+ * We don't do much at initialization time
+ */
+ public BioCycPlugin() {
+ logger = CyLogger.getLogger(BioCycPlugin.class);
+
+ // Register our commands
+ try {
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+
+ // Register ourselves with the web services infrastructure
+ }
+}
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/commands/BioCycCommandHandler.java
===================================================================
---
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/commands/BioCycCommandHandler.java
(rev 0)
+++
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/commands/BioCycCommandHandler.java
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,161 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package bioCycPlugin.commands;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import cytoscape.Cytoscape;
+import cytoscape.CyNode;
+import cytoscape.command.AbstractCommandHandler;
+import cytoscape.command.CyCommandException;
+import cytoscape.command.CyCommandManager;
+import cytoscape.command.CyCommandResult;
+import cytoscape.layout.Tunable;
+import cytoscape.logger.CyLogger;
+
+enum Command {
+ LISTDATABASES("list databases",
+ "List all of the available databases", ""),
+ LISTPATHWAYS("list pathways",
+ "List all of the pathways that meet the criteria",
+ "database=ecoli|protein|gene"),
+ LISTREACTIONS("list reactions",
+ "List all of the reactions that meet the criteria",
+ "database=ecoli|protein|gene"),
+ LOADPATHWAY("load pathway",
+ "Load a pathway in biopax format",
+ "database=ecoli|pathway");
+
+ private String command = null;
+ private String argList = null;
+ private String desc = null;
+
+ Command(String command, String description, String argList) {
+ this.command = command;
+ this.argList = argList;
+ this.desc = description;
+ }
+
+ public String getCommand() { return command; }
+ public String getArgString() { return argList; }
+ public String getDescription() { return desc; }
+ public boolean equals(String com) { return command.equals(com); }
+}
+
+
+/**
+ *
+ */
+public class BioCycCommandHandler extends AbstractCommandHandler {
+ CyLogger logger;
+
+ public BioCycCommandHandler(String namespace, CyLogger logger) {
+ super(CyCommandManager.reserveNamespace(namespace));
+
+ this.logger = logger;
+
+ for (Command command: Command.values()) {
+ addCommand(command.getCommand(),
command.getDescription(), command.getArgString());
+ }
+ }
+
+ public CyCommandResult execute(String command, Collection<Tunable>args)
+ throws
CyCommandException, RuntimeException {
+ return execute(command, createKVMap(args));
+ }
+
+ public CyCommandResult execute(String command, Map<String, Object>args)
+ throws
CyCommandException, RuntimeException {
+ CyCommandResult result = new CyCommandResult();
+
+ // LISTDATABASES("list databases",
+ // "List all of the available databases", ""),
+ if (Command.LISTDATABSES.equals(command)) {
+
+
+ // LISTPATHWAYS("list pathways",
+ // "List all of the pathways that meet the criteria",
+ // "database=ecoli|protein|gene"),
+ } else if (Command.LISTPATHWAYS.equals(command)) {
+
+
+ // LISTREACTIONS("list reactions",
+ // "List all of the reactions that meet the
criteria",
+ // "database=ecoli|protein|gene"),
+ } else if (Command.LISTREACTIONS.equals(command)) {
+
+
+ // LOADPATHWAY("load pathway",
+ // "Load a pathway in biopax format",
+ // "database=ecoli|pathway");
+ } else if (Command.LOADPATHWAY.equals(command)) {
+ }
+
+ return result;
+ }
+
+ private boolean getBooleanArg(String command, String arg, Map<String,
Object>args) {
+ String com = getArg(command, arg, args);
+ if (com == null || com.length() == 0) return false;
+ boolean b = false;
+ b = Boolean.parseBoolean(com);
+ // throw new CyCommandException(arg+" must be 'true' or
'false'");
+ return b;
+ }
+
+ private void addCommand(String command, String description, String
argString) {
+ // Add the description first
+ addDescription(command, description);
+
+ if (argString == null) {
+ addArgument(command);
+ return;
+ }
+
+ // Split up the options
+ String[] options = argString.split("\\|");
+ for (int opt = 0; opt < options.length; opt++) {
+ String[] args = options[opt].split("=");
+ if (args.length == 1)
+ addArgument(command, args[0]);
+ else
+ addArgument(command, args[0], args[1]);
+ }
+ }
+
+}
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Compound.java
===================================================================
---
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Compound.java
(rev 0)
+++
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Compound.java
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,56 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package bioCycPlugin.model;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Element;
+import cytoscape.logger.CyLogger;
+
+/**
+ *
+ */
+public class Compound extends Reactant {
+
+ Element cml = null;
+ String inchi = null;
+ String componentOf = null;
+
+ public Compound(Element compound) {
+ super(compound);
+ cml = compound.getElementByTagName("cml");
+ }
+
+ public Element getCML() { return cml; }
+ public String getInCHI() { return inchi; }
+ public String getComponentOf() { return componentOf; }
+}
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Database.java
===================================================================
---
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Database.java
(rev 0)
+++
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Database.java
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,64 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package bioCycPlugin.model;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Element;
+import cytoscape.logger.CyLogger;
+
+/**
+ *
+ */
+public class Database {
+ CyLogger logger;
+
+ String orgid = null;
+ String version = null;
+ String species = null;
+ String strain = null;
+ List<String> dbLink = null;
+
+ public Database(Element database) {
+ this.orgid = database.getAttribute("orgid");
+ this.version = database.getAttribute("version");
+ this.species = getChildData(database, "species");
+ this.strain = getChildData(database, "strain");
+ this.dbLink = getDbLinks(database);
+ }
+
+ public String getOrgID() { return orgid; }
+ public String getVersion() { return version; }
+ public String getSpecies() { return species; }
+ public String getStrain() { return strain; }
+ public List<String> getDbLinks() { return dbLink; }
+}
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Protein.java
===================================================================
---
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Protein.java
(rev 0)
+++
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Protein.java
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,52 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package bioCycPlugin.model;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Element;
+import cytoscape.logger.CyLogger;
+
+/**
+ *
+ */
+public class Protein extends Reactant {
+
+ Protein parent = null;
+
+ public Protein(Element protein) {
+ super(protein);
+
+ // TO
+ }
+
+}
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reactant.java
===================================================================
---
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reactant.java
(rev 0)
+++
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reactant.java
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,66 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package bioCycPlugin.model;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Element;
+
+/**
+ *
+ */
+public class Reactant {
+ CyLogger logger;
+ String ID;
+ String orgid;
+ String frameid;
+ List<String> dblinks = null;
+ List<String> synonyms = null;
+
+ public Reactant (Element reactant) {
+ this.ID = reactant.getAttribute("ID");
+ this.orgid = reactant.getAttribute("orgid");
+ this.frameid = reactant.getAttribute("frameid");
+ this.dblinks = getDbLinks(reactant);
+ this.synonyms = new ArrayList<String>();
+ List<Element> synonymElements = getChildElements(reactant,
"synonym");
+ for (Element e: synonymElements) {
+ synonyms.add(getChildData(e));
+ }
+ }
+
+ public String getID() { return ID; }
+ public String getOrgID() { return orgid; }
+ public String getFrameID() { return frameid; }
+ public List<String> getDbLinks() { return dblinks; }
+ public List<String> getSynonyms() { return synonyms; }
+}
Added:
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reaction.java
===================================================================
---
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reaction.java
(rev 0)
+++
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/model/Reaction.java
2010-10-28 00:46:21 UTC (rev 22543)
@@ -0,0 +1,110 @@
+/* vim: set ts=2: */
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions, and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * 3. Redistributions must acknowledge that this software was
+ * originally developed by the UCSF Computer Graphics Laboratory
+ * under support by the NIH National Center for Research Resources,
+ * grant P41-RR01081.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+package bioCycPlugin.model;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Element;
+import cytoscape.logger.CyLogger;
+
+/**
+ *
+ */
+public class Reaction {
+ CyLogger logger;
+
+ List<Reaction> parents = null;
+ List<Reactant> left = null;
+ List<Reactant> right = null;
+ String resource;
+ String ID;
+ String orgid;
+ String frameid;
+
+
+ public Reaction(Element reaction) {
+ this.ID = reaction.getAttribute("ID");
+ this.orgid = reaction.getAttribute("orgid");
+ this.frameid = reaction.getAttribute("frameid");
+ this.resource = reaction.getAttribute("resource");
+ List<Element> parentElements = getChildElements(reaction,
"parent");
+ this.parents = getParentReactions(parentElements);
+ List<Element> leftElements = getChildElements(reaction, "left");
+ this.left = getReactants(leftElements);
+ List<Element> rightElements = getChildElements(reaction,
"right");
+ this.right = getReactants(rightElements);
+
+ }
+
+ public String getID() { return ID; }
+ public String getOrgID() { return orgid; }
+ public String getFrameID() { return frameid; }
+ public String getResource() { return resource; }
+ public List<Reaction> getParents() { return parents; }
+ public List<Reactant> getLeft() { return left; }
+ public List<Reactant> getRight() { return right; }
+
+ private List<Reaction> getParentReactions(List<Element> pElements) {
+ if (pElements == null || pElements.length() == 0)
+ return null;
+
+ List<Reaction> resultList = new ArrayList<Reaction>();
+ for (Element e: pElements) {
+ NodeList childList = e.getElementsByTagName("Reaction");
+ // childList is either null or the Reaction element...
+ if (childList == null || childList.getLength() == 0)
continue;
+ resultList.add(new
Reaction((Element)(childList.item(0))));
+ }
+ return resultList;
+ }
+
+ private List<Reactant> getReactants(List<Element> rElements) {
+ if (rElements == null || rElements.length() == 0)
+ return null;
+
+ List<Reactant> resultList = new ArrayList<Reactant>();
+ for (Element e: rElements) {
+ NodeList childList = e.getElementsByTagName("Protein");
+ // childList is either null or the Protein element...
+ if (childList != null && childList.getLength() > 0) {
+ resultList.add(new
Protein((Element)(childList.item(0))));
+ } else {
+ // might be a compound
+ childList = e.getElementsByTagName("Compound");
+ if (childList == null || childList.getLength()
== 0) {
+ continue;
+ }
+ resultList.add(new
Compound((Element)(childList.item(0))));
+ }
+ }
+ return resultList;
+}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.