Author: mes
Date: 2010-06-15 10:24:15 -0700 (Tue, 15 Jun 2010)
New Revision: 20542
Added:
csplugins/trunk/ucsd/mes/PDBImageFunction/
csplugins/trunk/ucsd/mes/PDBImageFunction/build.xml
csplugins/trunk/ucsd/mes/PDBImageFunction/lib/
csplugins/trunk/ucsd/mes/PDBImageFunction/resources/
csplugins/trunk/ucsd/mes/PDBImageFunction/resources/plugin.props
csplugins/trunk/ucsd/mes/PDBImageFunction/src/
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunction.java
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunctionPlugin.java
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageSize.java
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBMoleculeType.java
Log:
added functions that fetch images of 3d structures from PDB
Added: csplugins/trunk/ucsd/mes/PDBImageFunction/build.xml
===================================================================
--- csplugins/trunk/ucsd/mes/PDBImageFunction/build.xml
(rev 0)
+++ csplugins/trunk/ucsd/mes/PDBImageFunction/build.xml 2010-06-15 17:24:15 UTC
(rev 20542)
@@ -0,0 +1,232 @@
+
+<project name="PDBImageFunctions" default="all" basedir=".">
+
+ <!-- =================================================================== -->
+ <!-- Initialization target -->
+ <!-- =================================================================== -->
+ <target name="init">
+ <tstamp/>
+ <property name="name" value="PDBImageFunctions"/>
+ <property name="version" value="1.0.1"/>
+
+ <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="cytoscape.dir" value="${root.dir}/../../../../cytoscape"/>
+ <property name="cytoscape.lib.dir" value="${cytoscape.dir}/lib"/>
+ <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="${root.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}.jar"/>
+ <property name="test.jar" value="${name}-tests.jar"/>
+
+ <!-- Define the class path -->
+ <path id="project.class.path">
+ <fileset dir="${cytoscape.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${cytoscape.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <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="${cytoscape.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${cytoscape.lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ </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}"
+ 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" >
+<!--
+ <copy toDir="${build.dir}">
+ <fileset dir="${resources.dir}/testData" includes="*" />
+ </copy>
+-->
+ <copy file="${resources.dir}/plugin.props"
todir="${build.dir}/org/cytoscape/equations/internal/pdb"/>
+ <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="org.cytoscape.equations.internal.pdb.PDBImageFunctionPlugin"/>
+ </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}"
+ 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,docs,test" />
+
+ <!-- =================================================================== -->
+ <!-- Clean up, get back to original state -->
+ <!-- =================================================================== -->
+ <target name="clean"
+ depends="init">
+ <delete dir="${build.dir}"/>
+ <delete dir="${javadoc.dir}"/>
+ <delete file="${project.jar}"/>
+ <delete file="${test.jar}"/>
+ <echo message="Successfully ran clean task!"/>
+ </target>
+
+</project>
+
Added: csplugins/trunk/ucsd/mes/PDBImageFunction/resources/plugin.props
===================================================================
--- csplugins/trunk/ucsd/mes/PDBImageFunction/resources/plugin.props
(rev 0)
+++ csplugins/trunk/ucsd/mes/PDBImageFunction/resources/plugin.props
2010-06-15 17:24:15 UTC (rev 20542)
@@ -0,0 +1,30 @@
+# This props file would 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=PDB Image Functions
+
+# Description used to give users information about the plugin such as what it
does.
+# Html tags are encouraged for formatting purposes.
+pluginDescription=Functions that return URLs to 3D protein structures from
PDB.
+
+# Plugin version number, this must be two numbers separated by a decimlal.
Ex. 0.2, 14.03
+pluginVersion=0.1
+
+# Compatible Cytoscape version
+cytoscapeVersion=2.8
+
+# Category, use one of the categories listed on the website or create your own
+pluginCategory=Other
+
+
+# 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=MikeSmoot
+
+# -- The following properties should be set ONLY BY CORE PLUGINS -- #
+downloadURL=http://cytoscape.org/plugins/plugins.xml
+uniqueID=5553486641
+
Added:
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunction.java
===================================================================
---
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunction.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunction.java
2010-06-15 17:24:15 UTC (rev 20542)
@@ -0,0 +1,108 @@
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.equations.internal.pdb;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import org.cytoscape.equations.Function;
+import org.cytoscape.equations.FunctionUtil;
+
+
+class PDBImageFunction implements Function {
+
+ final private PDBImageSize size;
+ final private PDBMoleculeType type;
+
+ PDBImageFunction(PDBMoleculeType type, PDBImageSize size) {
+ this.type = type;
+ this.size = size;
+ }
+
+ /**
+ * Used to parse the function string. This name is treated in a
case-insensitive manner!
+ * @return the name by which you must call the function when used in
an attribute equation.
+ */
+ public String getName() { return
"PDB"+type.getName()+size.toString()+"IMAGE"; }
+
+ /**
+ * Used to provide help for users.
+ * @return a description of what this function does
+ */
+ public String getFunctionSummary() { return "Gets a PDB Bio image based
the supplied PDB ID."; }
+
+ /**
+ * Used to provide help for users.
+ * @return a description of how to use this function
+ */
+ public String getUsageDescription() { return "Call this with \"" +
getName() + "(pdb_id)\""; }
+
+ public Class getReturnType() { return String.class; }
+
+ /**
+ * @return String.class or null if the args passed in have the wrong
arity or a type mismatch was found
+ */
+ public Class validateArgTypes(final Class[] argTypes) {
+ if (argTypes.length != 1)
+ return null;
+
+ if ( argTypes[0] != String.class )
+ return null;
+
+ return String.class;
+ }
+
+ public Object evaluateFunction(final Object[] args) {
+
+ final String pdbId =
FunctionUtil.getArgAsString(args[0]).trim().toLowerCase();
+
+ return "http://www.rcsb.org/pdb/images/" + pdbId + "_" +
type.getType() + "_" +
+ size.getSize() + ".jpg?bioNum=1";
+ }
+
+ /**
+ * Used with the equation builder.
+ *
+ * @param leadingArgs the types of the arguments that have already
been selected by the user.
+ * @return the set of arguments (must be a collection of String.class,
Long.class, Double.class,
+ * Boolean.class and List.class) that are candidates for the
next argument. An empty
+ * set indicates that no further arguments are valid.
+ */
+ public List<Class> getPossibleArgTypes(final Class[] leadingArgs) {
+ if (leadingArgs.length == 1)
+ return null;
+
+ final List<Class> possibleNextArgs = new ArrayList<Class>();
+
+ if (leadingArgs.length == 0) {
+ possibleNextArgs.add(String.class);
+ }
+
+ return possibleNextArgs;
+ }
+}
Added:
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunctionPlugin.java
===================================================================
---
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunctionPlugin.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageFunctionPlugin.java
2010-06-15 17:24:15 UTC (rev 20542)
@@ -0,0 +1,52 @@
+
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+
+package org.cytoscape.equations.internal.pdb;
+
+import cytoscape.Cytoscape;
+import cytoscape.plugin.CytoscapePlugin;
+
+import org.cytoscape.equations.Parser;
+
+public class PDBImageFunctionPlugin extends CytoscapePlugin {
+
+ public PDBImageFunctionPlugin() {
+ for ( PDBMoleculeType type : PDBMoleculeType.values() )
+ for ( PDBImageSize size : PDBImageSize.values() )
+ Parser.getParser().registerFunction( new
PDBImageFunction(type,size) );
+ }
+}
+
Added:
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageSize.java
===================================================================
---
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageSize.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBImageSize.java
2010-06-15 17:24:15 UTC (rev 20542)
@@ -0,0 +1,48 @@
+
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.equations.internal.pdb;
+
+
+
+enum PDBImageSize {
+
+ LARGE("500"),
+ MEDIUM("250"),
+ SMALL("80"),
+ XSMALL("65"),
+ ;
+
+ private String size;
+
+ private PDBImageSize(String size) {
+ this.size = size;
+ }
+
+ public String getSize() { return size; }
+}
Added:
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBMoleculeType.java
===================================================================
---
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBMoleculeType.java
(rev 0)
+++
csplugins/trunk/ucsd/mes/PDBImageFunction/src/org/cytoscape/equations/internal/pdb/PDBMoleculeType.java
2010-06-15 17:24:15 UTC (rev 20542)
@@ -0,0 +1,53 @@
+
+
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.equations.internal.pdb;
+
+
+
+enum PDBMoleculeType {
+
+ BIO("bio","BIO"),
+ ASR("asr","ASR"),
+ BIO_1("bio_1","BIO1"),
+ BIO_2("bio_2","BIO2"),
+ BIO_3("bio_3","BIO3"),
+ ;
+
+ private String type;
+ private String name;
+
+ private PDBMoleculeType(String type, String name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ public String getType() { return type; }
+ public String getName() { return name; }
+}
--
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.