Author: mes
Date: 2012-04-06 14:21:05 -0700 (Fri, 06 Apr 2012)
New Revision: 28757

Added:
   csplugins/trunk/ucsd/mes/genomespace/cdb-reader/
   csplugins/trunk/ucsd/mes/genomespace/cdb-reader/pom.xml
   
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBFilter.java
   
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBGraphReader.java
   
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBReaderPlugin.java
Removed:
   csplugins/trunk/ucsd/mes/genomespace/cdb-reader/pom.xml
   
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPFilter.java
   
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPGraphReader.java
   
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPReaderPlugin.java
   
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/SBMLVisualStyleFactory.java.hold
   csplugins/trunk/ucsd/mes/genomespace/gxp-reader/
Modified:
   csplugins/trunk/ucsd/mes/genomespace/pom.xml
Log:
more renaming

Deleted: csplugins/trunk/ucsd/mes/genomespace/cdb-reader/pom.xml
===================================================================
--- csplugins/trunk/ucsd/mes/genomespace/gxp-reader/pom.xml     2012-04-06 
21:01:19 UTC (rev 28754)
+++ csplugins/trunk/ucsd/mes/genomespace/cdb-reader/pom.xml     2012-04-06 
21:21:05 UTC (rev 28757)
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <artifactId>genomespace-parent</artifactId>
-    <groupId>cytoscape</groupId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-
-  <groupId>cytoscape</groupId>
-  <artifactId>gxp-reader</artifactId>
-  <packaging>jar</packaging>
-  <name>GXP Reader Plugin</name>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-               <version>2.3.2</version>
-        <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
-          <optimize>true</optimize>
-          <showWarnings>true</showWarnings>
-          <showDeprecation>true</showDeprecation>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <version>2.2-beta-5</version>
-        <configuration>
-          <archive>
-            <manifestEntries>
-              
<Cytoscape-Plugin>cytoscape.gxp.GXPReaderPlugin</Cytoscape-Plugin>
-            </manifestEntries>
-          </archive>
-          <descriptors>
-            <descriptor>src/main/assembly/src.xml</descriptor>
-          </descriptors>
-        </configuration>
-        <executions>
-          <execution>
-            <id>make-assembly</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-    <dependency>
-      <groupId>cytoscape</groupId>
-      <artifactId>application</artifactId>
-      <version>2.8.3-SNAPSHOT</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.1</version>
-      <scope>test</scope>
-    </dependency>
-       <dependency>
-               <groupId>org.jdom</groupId>
-               <artifactId>jdom</artifactId>
-               <version>1.1</version>
-               <scope>provided</scope>
-       </dependency>
-  </dependencies>
-
-  <repositories>
-    <repository>
-      <id>cytoscape_snapshots</id>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <name>Cytoscape Snapshots</name>
-      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
-    </repository>
-    <repository>
-      <id>cytoscape_releases</id>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-      <releases>
-        <enabled>true</enabled>
-      </releases>
-      <name>Cytoscape Releases</name>
-      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url>
-    </repository>
-    <repository>
-      <id>cytoscape_thirdparty</id>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-      <releases>            
-        <enabled>true</enabled>
-      </releases>
-      <name>Cytoscape Third Party</name>
-      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/thirdparty/</url>
-    </repository>
-  </repositories>
-
-</project>

Copied: csplugins/trunk/ucsd/mes/genomespace/cdb-reader/pom.xml (from rev 
28756, csplugins/trunk/ucsd/mes/genomespace/gxp-reader/pom.xml)
===================================================================
--- csplugins/trunk/ucsd/mes/genomespace/cdb-reader/pom.xml                     
        (rev 0)
+++ csplugins/trunk/ucsd/mes/genomespace/cdb-reader/pom.xml     2012-04-06 
21:21:05 UTC (rev 28757)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>genomespace-parent</artifactId>
+    <groupId>cytoscape</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>cytoscape</groupId>
+  <artifactId>cdb-reader</artifactId>
+  <packaging>jar</packaging>
+  <name>CDB Reader Plugin</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+               <version>2.3.2</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+          <optimize>true</optimize>
+          <showWarnings>true</showWarnings>
+          <showDeprecation>true</showDeprecation>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.2-beta-5</version>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              
<Cytoscape-Plugin>cytoscape.gxp.CDBReaderPlugin</Cytoscape-Plugin>
+            </manifestEntries>
+          </archive>
+          <descriptors>
+            <descriptor>src/main/assembly/src.xml</descriptor>
+          </descriptors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>make-assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>cytoscape</groupId>
+      <artifactId>application</artifactId>
+      <version>2.8.3-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+       <dependency>
+               <groupId>org.jdom</groupId>
+               <artifactId>jdom</artifactId>
+               <version>1.1</version>
+               <scope>provided</scope>
+       </dependency>
+  </dependencies>
+
+  <repositories>
+    <repository>
+      <id>cytoscape_snapshots</id>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <name>Cytoscape Snapshots</name>
+      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
+    </repository>
+    <repository>
+      <id>cytoscape_releases</id>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+      <name>Cytoscape Releases</name>
+      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url>
+    </repository>
+    <repository>
+      <id>cytoscape_thirdparty</id>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>            
+        <enabled>true</enabled>
+      </releases>
+      <name>Cytoscape Third Party</name>
+      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/thirdparty/</url>
+    </repository>
+  </repositories>
+
+</project>

Copied: 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBFilter.java
 (from rev 28756, 
csplugins/trunk/ucsd/mes/genomespace/gxp-reader/src/main/java/cytoscape/gxp/CDBFilter.java)
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBFilter.java
                          (rev 0)
+++ 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBFilter.java
  2012-04-06 21:21:05 UTC (rev 28757)
@@ -0,0 +1,81 @@
+
+/*
+ Copyright (c) 2006, 2007, 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 cytoscape.gxp;
+
+import cytoscape.data.ImportHandler;
+
+import cytoscape.data.readers.GraphReader;
+
+import cytoscape.util.CyFileFilter;
+
+import java.io.File;
+import java.io.IOException;
+
+
+public class CDBFilter extends CyFileFilter {
+       /**
+        * CDB Files are Graphs.
+        */
+       private static String fileNature = ImportHandler.GRAPH_NATURE;
+
+       /**
+        * File Extensions.
+        */
+       private static String[] fileExtensions = { "cdb" };
+
+       /**
+        * Filter Description.
+        */
+       private static String description = "CDB files";
+
+       /**
+        * Constructor.
+        */
+       public CDBFilter() {
+               super(fileExtensions, description, fileNature);
+       }
+
+       /**
+        * Gets the appropirate GraphReader object.
+        *
+        * @param fileName File Name.
+        * @return GraphReader Object.
+        */
+       public GraphReader getReader(String fileName) {
+               return new CDBGraphReader(fileName);
+       }
+}

Copied: 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBGraphReader.java
 (from rev 28756, 
csplugins/trunk/ucsd/mes/genomespace/gxp-reader/src/main/java/cytoscape/gxp/CDBGraphReader.java)
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBGraphReader.java
                             (rev 0)
+++ 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBGraphReader.java
     2012-04-06 21:21:05 UTC (rev 28757)
@@ -0,0 +1,211 @@
+
+/*
+ Copyright (c) 2006, 2007, 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 cytoscape.gxp;
+
+import cytoscape.CyEdge;
+import cytoscape.CyNetwork;
+import cytoscape.CyNode;
+import cytoscape.Cytoscape;
+
+import cytoscape.data.CyAttributes;
+import cytoscape.data.Semantics;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+
+import org.jdom.input.SAXBuilder;
+
+
+import cytoscape.data.readers.AbstractGraphReader;
+import cytoscape.data.readers.GraphReader;
+
+import cytoscape.view.CyNetworkView;
+import cytoscape.view.CytoscapeDesktop;
+
+import cytoscape.visual.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.net.URL;
+
+import java.util.*;
+
+
+/**
+ * @author  Mike Smoot
+ */
+public class CDBGraphReader extends AbstractGraphReader implements GraphReader 
{
+       // node id from file -> node
+       private Map<String,CyNode> geneIdMap; 
+
+       private List<Integer> nodeIds;
+       private List<Integer> edgeIds;
+       private URL fileURL;
+
+       /**
+        * Creates a new SBMLGraphReader object.
+        *
+        * @param filename  DOCUMENT ME!
+        */
+       public CDBGraphReader(String filename) {
+               super(filename);
+               fileURL = null;
+       }
+
+       /**
+        * Creates a new SBMLGraphReader object.
+        *
+        * @param url  DOCUMENT ME!
+        */
+       public CDBGraphReader(URL url) {
+               super(null);
+               fileURL = url;
+               fileName = null;
+       }
+
+       /**
+        *  DOCUMENT ME!
+        *
+        * @throws IOException DOCUMENT ME!
+        */
+       public void read() throws IOException {
+               InputStream instream;
+
+               if ((fileURL == null) && (fileName != null))
+                       instream = new FileInputStream(fileName);
+               else if ((fileURL != null) && (fileName == null))
+                       instream = fileURL.openStream();
+               else
+                       throw new IOException("No file to open!");
+
+               nodeIds = new ArrayList<Integer>();
+               edgeIds = new ArrayList<Integer>();
+
+               geneIdMap = new HashMap<String,CyNode>();
+
+               try {
+
+                       // Actual work
+                       SAXBuilder builder = new SAXBuilder(false);
+                       Document doc = builder.build(instream);
+
+                       createGeneNodes( getTable(doc,"Genes") );
+                       createRegulatorsRegulatorsEdges( 
getTable(doc,"Regulators_Regulators") );
+
+               } catch (JDOMException je) { 
+                       throw new IOException("JDOM failure parsing file.",je); 
+               }
+       }
+
+       private void createRegulatorsRegulatorsEdges(Element 
regulatorsRegulators) {
+               for ( Object o : 
regulatorsRegulators.getChildren("Regulator_Gene") ) {
+                       Element regulatorGene = (Element)o;
+                       String regulatorId = 
regulatorGene.getAttributeValue("Regulator_Id");
+                       String geneId = 
regulatorGene.getAttributeValue("Gene_Id");
+                       if ( regulatorId == null || 
+                            geneId == null || 
+                            !geneIdMap.containsKey(regulatorId) || 
+                                !geneIdMap.containsKey(geneId) )
+                               continue;
+
+                       CyNode na = geneIdMap.get(regulatorId);
+                       CyNode nb = geneIdMap.get(geneId);
+                       CyEdge e = 
Cytoscape.getCyEdge(na,nb,Semantics.INTERACTION,"regulates",true,true);
+                       edgeIds.add( e.getRootGraphIndex() );
+               }
+       }
+
+
+       private void createGeneNodes(Element genes) {
+               for ( Object o : genes.getChildren("Gene") ) {
+                       Element gene = (Element) o;
+                       CyNode node = 
Cytoscape.getCyNode(gene.getAttributeValue("ORF"),true);
+                       String id = gene.getAttributeValue("Id");
+                       geneIdMap.put(id,node);
+                       nodeIds.add( node.getRootGraphIndex() );        
+               }
+       }
+
+       private Element getTable(Document doc, String tableName) {
+               for ( Object e : doc.getRootElement().getChildren("Table") )
+                       if ( 
tableName.equals(((Element)e).getAttributeValue("Type")) )
+                               return (Element)e;
+
+               return null;
+       }
+
+       public void doPostProcessing(CyNetwork network) {
+       /*
+               // Set SBML specific visual style
+               VisualMappingManager manager = 
Cytoscape.getVisualMappingManager();
+               CalculatorCatalog catalog = manager.getCalculatorCatalog();
+
+               VisualStyle vs = 
catalog.getVisualStyle(SBMLVisualStyleFactory.SBMLReader_VS);
+
+               if (vs == null) {
+                       vs = SBMLVisualStyleFactory.createVisualStyle(network);
+                       catalog.addVisualStyle(vs);
+               }
+
+               manager.setVisualStyle(vs);
+               Cytoscape.getCurrentNetworkView().setVisualStyle(vs.getName());
+               Cytoscape.getCurrentNetworkView().applyVizmapper(vs);
+               */
+       }
+
+       public int[] getNodeIndicesArray() {
+               int[] nodes = new int[nodeIds.size()];
+
+               for (int i = 0; i < nodes.length; i++)
+                       nodes[i] = nodeIds.get(i).intValue();
+
+               return nodes;
+       }
+
+       public int[] getEdgeIndicesArray() {
+               int[] edges = new int[edgeIds.size()];
+
+               for (int i = 0; i < edges.length; i++)
+                       edges[i] = edgeIds.get(i).intValue();
+
+               return edges;
+       }
+}

Copied: 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBReaderPlugin.java
 (from rev 28756, 
csplugins/trunk/ucsd/mes/genomespace/gxp-reader/src/main/java/cytoscape/gxp/CDBReaderPlugin.java)
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBReaderPlugin.java
                            (rev 0)
+++ 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/CDBReaderPlugin.java
    2012-04-06 21:21:05 UTC (rev 28757)
@@ -0,0 +1,23 @@
+package cytoscape.gxp;
+
+import cytoscape.Cytoscape;
+import cytoscape.data.ImportHandler;
+import cytoscape.plugin.CytoscapePlugin;
+
+
+/**
+ * This class is used to instantiate your plugin. Put whatever initialization 
code
+ * you need into the no argument constructor (the only one that will be 
called).
+ * The actual functionality of your plugin can be in this class, but should 
+ * probably be separated into separted classes that get instantiated here.
+ */
+public class CDBReaderPlugin extends CytoscapePlugin {
+
+       public CDBReaderPlugin() {
+               super();
+               ImportHandler ih = Cytoscape.getImportHandler();
+               ih.addFilter(new CDBFilter());
+       }
+}      
+
+

Deleted: 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPFilter.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/gxp-reader/src/main/java/cytoscape/gxp/GXPFilter.java
  2012-04-06 21:01:19 UTC (rev 28754)
+++ 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPFilter.java
  2012-04-06 21:21:05 UTC (rev 28757)
@@ -1,81 +0,0 @@
-
-/*
- Copyright (c) 2006, 2007, 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 cytoscape.gxp;
-
-import cytoscape.data.ImportHandler;
-
-import cytoscape.data.readers.GraphReader;
-
-import cytoscape.util.CyFileFilter;
-
-import java.io.File;
-import java.io.IOException;
-
-
-public class GXPFilter extends CyFileFilter {
-       /**
-        * GXP Files are Graphs.
-        */
-       private static String fileNature = ImportHandler.GRAPH_NATURE;
-
-       /**
-        * File Extensions.
-        */
-       private static String[] fileExtensions = { "gxp" };
-
-       /**
-        * Filter Description.
-        */
-       private static String description = "GXP files";
-
-       /**
-        * Constructor.
-        */
-       public GXPFilter() {
-               super(fileExtensions, description, fileNature);
-       }
-
-       /**
-        * Gets the appropirate GraphReader object.
-        *
-        * @param fileName File Name.
-        * @return GraphReader Object.
-        */
-       public GraphReader getReader(String fileName) {
-               return new GXPGraphReader(fileName);
-       }
-}

Deleted: 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPGraphReader.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/gxp-reader/src/main/java/cytoscape/gxp/GXPGraphReader.java
     2012-04-06 21:01:19 UTC (rev 28754)
+++ 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPGraphReader.java
     2012-04-06 21:21:05 UTC (rev 28757)
@@ -1,211 +0,0 @@
-
-/*
- Copyright (c) 2006, 2007, 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 cytoscape.gxp;
-
-import cytoscape.CyEdge;
-import cytoscape.CyNetwork;
-import cytoscape.CyNode;
-import cytoscape.Cytoscape;
-
-import cytoscape.data.CyAttributes;
-import cytoscape.data.Semantics;
-
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-import org.jdom.input.SAXBuilder;
-
-
-import cytoscape.data.readers.AbstractGraphReader;
-import cytoscape.data.readers.GraphReader;
-
-import cytoscape.view.CyNetworkView;
-import cytoscape.view.CytoscapeDesktop;
-
-import cytoscape.visual.*;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.net.URL;
-
-import java.util.*;
-
-
-/**
- * @author  Mike Smoot
- */
-public class GXPGraphReader extends AbstractGraphReader implements GraphReader 
{
-       // node id from file -> node
-       private Map<String,CyNode> geneIdMap; 
-
-       private List<Integer> nodeIds;
-       private List<Integer> edgeIds;
-       private URL fileURL;
-
-       /**
-        * Creates a new SBMLGraphReader object.
-        *
-        * @param filename  DOCUMENT ME!
-        */
-       public GXPGraphReader(String filename) {
-               super(filename);
-               fileURL = null;
-       }
-
-       /**
-        * Creates a new SBMLGraphReader object.
-        *
-        * @param url  DOCUMENT ME!
-        */
-       public GXPGraphReader(URL url) {
-               super(null);
-               fileURL = url;
-               fileName = null;
-       }
-
-       /**
-        *  DOCUMENT ME!
-        *
-        * @throws IOException DOCUMENT ME!
-        */
-       public void read() throws IOException {
-               InputStream instream;
-
-               if ((fileURL == null) && (fileName != null))
-                       instream = new FileInputStream(fileName);
-               else if ((fileURL != null) && (fileName == null))
-                       instream = fileURL.openStream();
-               else
-                       throw new IOException("No file to open!");
-
-               nodeIds = new ArrayList<Integer>();
-               edgeIds = new ArrayList<Integer>();
-
-               geneIdMap = new HashMap<String,CyNode>();
-
-               try {
-
-                       // Actual work
-                       SAXBuilder builder = new SAXBuilder(false);
-                       Document doc = builder.build(instream);
-
-                       createGeneNodes( getTable(doc,"Genes") );
-                       createRegulatorsRegulatorsEdges( 
getTable(doc,"Regulators_Regulators") );
-
-               } catch (JDOMException je) { 
-                       throw new IOException("JDOM failure parsing file.",je); 
-               }
-       }
-
-       private void createRegulatorsRegulatorsEdges(Element 
regulatorsRegulators) {
-               for ( Object o : 
regulatorsRegulators.getChildren("Regulator_Gene") ) {
-                       Element regulatorGene = (Element)o;
-                       String regulatorId = 
regulatorGene.getAttributeValue("Regulator_Id");
-                       String geneId = 
regulatorGene.getAttributeValue("Gene_Id");
-                       if ( regulatorId == null || 
-                            geneId == null || 
-                            !geneIdMap.containsKey(regulatorId) || 
-                                !geneIdMap.containsKey(geneId) )
-                               continue;
-
-                       CyNode na = geneIdMap.get(regulatorId);
-                       CyNode nb = geneIdMap.get(geneId);
-                       CyEdge e = 
Cytoscape.getCyEdge(na,nb,Semantics.INTERACTION,"regulates",true,true);
-                       edgeIds.add( e.getRootGraphIndex() );
-               }
-       }
-
-
-       private void createGeneNodes(Element genes) {
-               for ( Object o : genes.getChildren("Gene") ) {
-                       Element gene = (Element) o;
-                       CyNode node = 
Cytoscape.getCyNode(gene.getAttributeValue("ORF"),true);
-                       String id = gene.getAttributeValue("Id");
-                       geneIdMap.put(id,node);
-                       nodeIds.add( node.getRootGraphIndex() );        
-               }
-       }
-
-       private Element getTable(Document doc, String tableName) {
-               for ( Object e : doc.getRootElement().getChildren("Table") )
-                       if ( 
tableName.equals(((Element)e).getAttributeValue("Type")) )
-                               return (Element)e;
-
-               return null;
-       }
-
-       public void doPostProcessing(CyNetwork network) {
-       /*
-               // Set SBML specific visual style
-               VisualMappingManager manager = 
Cytoscape.getVisualMappingManager();
-               CalculatorCatalog catalog = manager.getCalculatorCatalog();
-
-               VisualStyle vs = 
catalog.getVisualStyle(SBMLVisualStyleFactory.SBMLReader_VS);
-
-               if (vs == null) {
-                       vs = SBMLVisualStyleFactory.createVisualStyle(network);
-                       catalog.addVisualStyle(vs);
-               }
-
-               manager.setVisualStyle(vs);
-               Cytoscape.getCurrentNetworkView().setVisualStyle(vs.getName());
-               Cytoscape.getCurrentNetworkView().applyVizmapper(vs);
-               */
-       }
-
-       public int[] getNodeIndicesArray() {
-               int[] nodes = new int[nodeIds.size()];
-
-               for (int i = 0; i < nodes.length; i++)
-                       nodes[i] = nodeIds.get(i).intValue();
-
-               return nodes;
-       }
-
-       public int[] getEdgeIndicesArray() {
-               int[] edges = new int[edgeIds.size()];
-
-               for (int i = 0; i < edges.length; i++)
-                       edges[i] = edgeIds.get(i).intValue();
-
-               return edges;
-       }
-}

Deleted: 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPReaderPlugin.java
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/gxp-reader/src/main/java/cytoscape/gxp/GXPReaderPlugin.java
    2012-04-06 21:01:19 UTC (rev 28754)
+++ 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/GXPReaderPlugin.java
    2012-04-06 21:21:05 UTC (rev 28757)
@@ -1,23 +0,0 @@
-package cytoscape.gxp;
-
-import cytoscape.Cytoscape;
-import cytoscape.data.ImportHandler;
-import cytoscape.plugin.CytoscapePlugin;
-
-
-/**
- * This class is used to instantiate your plugin. Put whatever initialization 
code
- * you need into the no argument constructor (the only one that will be 
called).
- * The actual functionality of your plugin can be in this class, but should 
- * probably be separated into separted classes that get instantiated here.
- */
-public class GXPReaderPlugin extends CytoscapePlugin {
-
-       public GXPReaderPlugin() {
-               super();
-               ImportHandler ih = Cytoscape.getImportHandler();
-               ih.addFilter(new GXPFilter());
-       }
-}      
-
-

Deleted: 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/SBMLVisualStyleFactory.java.hold
===================================================================
--- 
csplugins/trunk/ucsd/mes/genomespace/gxp-reader/src/main/java/cytoscape/gxp/SBMLVisualStyleFactory.java.hold
        2012-04-06 21:01:19 UTC (rev 28754)
+++ 
csplugins/trunk/ucsd/mes/genomespace/cdb-reader/src/main/java/cytoscape/gxp/SBMLVisualStyleFactory.java.hold
        2012-04-06 21:21:05 UTC (rev 28757)
@@ -1,165 +0,0 @@
-
-/*
- Copyright (c) 2006, 2007, 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 sbmlreader;
-
-import cytoscape.*;
-
-import cytoscape.data.Semantics;
-
-import cytoscape.view.CytoscapeDesktop;
-
-import cytoscape.visual.*;
-
-import cytoscape.visual.calculators.*;
-
-import cytoscape.visual.mappings.*;
-
-import cytoscape.visual.ui.*;
-
-import giny.view.EdgeView;
-
-import java.awt.Color;
-
-
-/**
- * VisualStyleFactory.java
- * This class defines the visualstyle in Cytoscape for the SBMLReader plugin.
- *
- * @author W.P.A. Ligtenberg, Eindhoven University of Technology
- */
-public class SBMLVisualStyleFactory {
-       /**
-        * 
-        */
-       public static final String SBMLReader_VS = "SBMLReader Style";
-
-       /**
-        * 
-        */
-       public static final String NODE_TYPE_ATT = "sbml type";
-
-       /**
-        * 
-        */
-       public static final String EDGE_TYPE_ATT = "interaction";
-
-       /**
-        *  DOCUMENT ME!
-        *
-        * @param network DOCUMENT ME!
-        *
-        * @return  DOCUMENT ME!
-        */
-       public static VisualStyle createVisualStyle(CyNetwork network) {
-               VisualMappingManager vmManager = 
Cytoscape.getVisualMappingManager();
-               NodeAppearanceCalculator nodeAppCalc = new 
NodeAppearanceCalculator();
-               EdgeAppearanceCalculator edgeAppCalc = new 
EdgeAppearanceCalculator();
-               CalculatorCatalog calculatorCatalog = 
vmManager.getCalculatorCatalog();
-
-               // ------------------------------ Set node shapes 
---------------------------//
-               DiscreteMapping disMapping = new DiscreteMapping(NodeShape.RECT,
-                                                                
ObjectMapping.NODE_MAPPING);
-               disMapping.setControllingAttributeName(NODE_TYPE_ATT, network, 
false);
-               disMapping.putMapValue("species", NodeShape.DIAMOND);
-               disMapping.putMapValue("reaction", NodeShape.ELLIPSE);
-
-               Calculator shapeCalculator = new BasicCalculator("SBMLReader 
Shape Calculator",
-                                                                           
disMapping,
-                                                                               
                                                        
VisualPropertyType.NODE_SHAPE);
-               nodeAppCalc.setCalculator(shapeCalculator);
-
-               // ------------------------------ Set the label 
------------------------------//
-               // Display the value for geneName as a label
-               String cName = "sbml name";
-               Calculator nlc = 
calculatorCatalog.getCalculator(VisualPropertyType.NODE_LABEL, cName);
-
-               if (nlc == null) {
-                       PassThroughMapping m = new PassThroughMapping(new 
String(), cName);
-                       nlc = new BasicCalculator(cName, m, 
VisualPropertyType.NODE_LABEL);
-               }
-
-               nodeAppCalc.setCalculator(nlc);
-
-               //--------------------- Set the size of the nodes 
--------------------------//
-               //Discrete mapping on nodeType
-               Double speciesNodeSize = new Double(30);
-               Double reactionNodeSize = new Double(30);
-               DiscreteMapping sizeMapping = new 
DiscreteMapping(reactionNodeSize,
-                                                                 
ObjectMapping.NODE_MAPPING);
-               sizeMapping.setControllingAttributeName(NODE_TYPE_ATT, network, 
false);
-               sizeMapping.putMapValue("species", speciesNodeSize);
-               sizeMapping.putMapValue("reaction", reactionNodeSize);
-
-               Calculator sizeCalculator = new BasicCalculator("SBMLReader 
Size Calculator",
-                                                                               
 sizeMapping,
-                                                                               
                                                                 
VisualPropertyType.NODE_SIZE);
-               nodeAppCalc.setCalculator(sizeCalculator);
-               nodeAppCalc.setNodeSizeLocked(true);
-
-               // ------------------------------ Set edge arrow shape 
---------------------------//
-               DiscreteMapping arrowMapping = new 
DiscreteMapping(ArrowShape.DELTA,
-                                                                  
ObjectMapping.NODE_MAPPING);
-               arrowMapping.setControllingAttributeName(EDGE_TYPE_ATT, 
network, false);
-               arrowMapping.putMapValue("reaction-product", ArrowShape.ARROW);
-               arrowMapping.putMapValue("reaction-reactant", ArrowShape.NONE);
-               arrowMapping.putMapValue("reaction-modifier", 
ArrowShape.CIRCLE);
-
-               Calculator edgeArrowCalculator = new 
BasicCalculator("SBMLReader Edge Arrow Calculator",
-                                                             arrowMapping,
-                                                                               
                                          
VisualPropertyType.EDGE_SRCARROW_SHAPE);
-               edgeAppCalc.setCalculator(edgeArrowCalculator);
-
-               // ------------------------------ Set edge colour 
---------------------------//
-               DiscreteMapping edgeColorMapping = new 
DiscreteMapping(Color.BLACK,
-                                                                      
ObjectMapping.NODE_MAPPING);
-               edgeColorMapping.setControllingAttributeName(EDGE_TYPE_ATT, 
network, false);
-               edgeColorMapping.putMapValue("reaction-product", Color.GREEN);
-               edgeColorMapping.putMapValue("reaction-reactant", Color.RED);
-               edgeColorMapping.putMapValue("reaction-modifier", Color.BLACK);
-
-               Calculator edgeColorCalculator = new 
BasicCalculator("SBMLReader Edge Color Calculator",
-                                                                               
edgeColorMapping,
-                                                                               
                                                                
VisualPropertyType.EDGE_COLOR);
-               edgeAppCalc.setCalculator(edgeColorCalculator);
-
-               //------------------------- Create a visual style 
-------------------------------//
-               GlobalAppearanceCalculator gac = 
vmManager.getVisualStyle().getGlobalAppearanceCalculator();
-               VisualStyle visualStyle = new VisualStyle(SBMLReader_VS, 
nodeAppCalc, edgeAppCalc, gac);
-
-               return visualStyle;
-       }
-}

Modified: csplugins/trunk/ucsd/mes/genomespace/pom.xml
===================================================================
--- csplugins/trunk/ucsd/mes/genomespace/pom.xml        2012-04-06 21:19:10 UTC 
(rev 28756)
+++ csplugins/trunk/ucsd/mes/genomespace/pom.xml        2012-04-06 21:21:05 UTC 
(rev 28757)
@@ -11,7 +11,7 @@
        <modules>
                <module>genomespace-libs-plugin</module>
                <module>genomespace-plugin</module>
-               <module>gxp-reader</module>
+               <module>cdb-reader</module>
                <module>cytable-reader</module>
                <!-- webstart actually has a different parent 
(cytoscape-webstart)
                     so we don't include it here!  It needs to be built 
separately.

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