Author: jm
Date: 2011-06-23 12:37:26 -0700 (Thu, 23 Jun 2011)
New Revision: 25901

Modified:
   csplugins/trunk/mskcc/gbader/mcode/build.xml
   csplugins/trunk/mskcc/gbader/mcode/resources/plugin.props
   csplugins/trunk/mskcc/gbader/mcode/src/csplugins/mcode/MCODEResultsPanel.java
Log:
Fixed MCODE so it compiles/runs against Cytoscape 2.6-2.8.  Workaround involves 
reflection because an API method was renamed :(
Updated build script to accommodate Mavenized 2.7/2.8 layout.

Modified: csplugins/trunk/mskcc/gbader/mcode/build.xml
===================================================================
--- csplugins/trunk/mskcc/gbader/mcode/build.xml        2011-06-23 17:46:25 UTC 
(rev 25900)
+++ csplugins/trunk/mskcc/gbader/mcode/build.xml        2011-06-23 19:37:26 UTC 
(rev 25901)
@@ -6,16 +6,15 @@
        <!-- Change this to the name of your Plug In -->
        <!-- The name is used to create the plugin JAR file -->
        <property name="plugin.name" value="MCODE" />
-       <property name="version" value="1_31" />
+       <property name="version" value="1_32" />
 
        <!-- The directory containing source code -->
        <property name="src.dir" value="src" />
        <property name="resources.dir" value="resources" />
        <property name="cytoscape.dir" value="../../../../cytoscape" />
 
-       <!--  The directory containing library jar files -->
-       <property name="lib.dir" value="${cytoscape.dir}/lib" />
-
+    <property name="junit.jar" value="" />
+    
        <!-- Temporary build directories -->
        <property name="build.dir" value="build" />
        <property name="build.classes" value="${build.dir}/classes" />
@@ -28,10 +27,11 @@
 
        <!-- Classpath with all lib JAR Files and all Cytoscape Core classes -->
        <path id="classpath">
+               <pathelement path="${junit.jar}" />
                <pathelement path="${build.classes}" />
                <pathelement path="${cytoscape.dir}/cytoscape.jar" />
-               <fileset dir="${lib.dir}">
-                       <include name="**/*.jar" />
+               <fileset dir="${cytoscape.dir}">
+                       <include name="lib/*.jar" />
                </fileset>
        </path>
 

Modified: csplugins/trunk/mskcc/gbader/mcode/resources/plugin.props
===================================================================
--- csplugins/trunk/mskcc/gbader/mcode/resources/plugin.props   2011-06-23 
17:46:25 UTC (rev 25900)
+++ csplugins/trunk/mskcc/gbader/mcode/resources/plugin.props   2011-06-23 
19:37:26 UTC (rev 25901)
@@ -11,10 +11,10 @@
 pluginDescription=MCODE finds clusters (highly interconnected regions) in a 
network. Clusters mean different things in different types of networks. For 
instance, clusters in a protein-protein interaction network are often protein 
complexes and parts of pathways, while clusters in a protein similarity network 
represent protein families.
 
 # Plugin version number, this must be two numbers separated by a decimlal.  
Ex. 0.2, 14.03
-pluginVersion=1.31
+pluginVersion=1.32
 
 # Compatible Cytoscape version
-cytoscapeVersion=2.6
+cytoscapeVersion=2.6,2.7,2.8
 
 # Category, use one of the categories listed on the website or create your own
 pluginCategory=Analysis

Modified: 
csplugins/trunk/mskcc/gbader/mcode/src/csplugins/mcode/MCODEResultsPanel.java
===================================================================
--- 
csplugins/trunk/mskcc/gbader/mcode/src/csplugins/mcode/MCODEResultsPanel.java   
    2011-06-23 17:46:25 UTC (rev 25900)
+++ 
csplugins/trunk/mskcc/gbader/mcode/src/csplugins/mcode/MCODEResultsPanel.java   
    2011-06-23 19:37:26 UTC (rev 25901)
@@ -12,6 +12,8 @@
 import java.awt.Image;
 import java.awt.event.ActionEvent;
 import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -390,9 +392,7 @@
                                        } else {
                                                
clusterArrayList.add(cluster.getClusterName());
                                        }
-                                       
Cytoscape.getNodeAttributes().setAttributeList(
-                                                       n.getIdentifier(), 
"MCODE_Cluster",
-                                                       clusterArrayList);
+                                       
setAttributeList(Cytoscape.getNodeAttributes(), n.getIdentifier(), 
"MCODE_Cluster", clusterArrayList);
 
                                        if (cluster.getSeedNode().intValue() == 
rgi) {
                                                
Cytoscape.getNodeAttributes().setAttribute(
@@ -412,6 +412,26 @@
        }
 
        /**
+        * This method only exists due to an unfortunately renamed API method.
+        */
+       private void setAttributeList(CyAttributes attributes, String 
identifier, String name, List list) {
+               // Try all variants of the renamed API
+               for (String methodName : new String[] {"getAttributeList", 
"getListAttribute"}) {
+                       try {
+                               Method method = 
attributes.getClass().getMethod(methodName, String.class, String.class, 
List.class);
+                               method.invoke(identifier, name, list);
+                               return;
+                       } catch (SecurityException e) {
+                       } catch (NoSuchMethodException e) {
+                       } catch (IllegalArgumentException e) {
+                       } catch (IllegalAccessException e) {
+                       } catch (InvocationTargetException e) {
+                       }
+               }
+               return;
+       }
+
+       /**
         * Handles the create child network press in the cluster exploration 
panel
         */
        private class CreateChildAction extends AbstractAction {

-- 
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.

Reply via email to