Author: rodche
Date: 2012-10-23 09:49:56 -0700 (Tue, 23 Oct 2012)
New Revision: 30695

Modified:
   core3/impl/trunk/biopax-impl/pom.xml
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
   core3/impl/trunk/cpath2-impl/pom.xml
Log:
Updated to paxtools 4.1.5b2 (fixes a bug in the biopax level 2 to 3 converter). 
Some internal re-factoring (attr. names, constants). 

Modified: core3/impl/trunk/biopax-impl/pom.xml
===================================================================
--- core3/impl/trunk/biopax-impl/pom.xml        2012-10-23 16:40:59 UTC (rev 
30694)
+++ core3/impl/trunk/biopax-impl/pom.xml        2012-10-23 16:49:56 UTC (rev 
30695)
@@ -9,7 +9,7 @@
        <properties>
                
<bundle.symbolicName>org.cytoscape.biopax-impl</bundle.symbolicName>
                <bundle.namespace>org.cytoscape.biopax</bundle.namespace>
-               <paxtools.version>4.1.5b</paxtools.version>
+               <paxtools.version>4.1.5b2</paxtools.version>
        </properties>
        
        <modelVersion>4.0.0</modelVersion>

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
  2012-10-23 16:40:59 UTC (rev 30694)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
  2012-10-23 16:49:56 UTC (rev 30695)
@@ -148,12 +148,12 @@
        private final Model model;
        private final CyNetworkFactory networkFactory;
        private final TaskMonitor taskMonitor;
-       private final CyGroupFactory cyGroupFactory;
+//     private final CyGroupFactory cyGroupFactory;
        
        // BioPAX ID (URI) to CyNode map
        // remark: nodes's CyTable will also have 'URI' (RDF Id) column
        private final Map<BioPAXElement, CyNode> 
-               uriToCyNodeMap = new HashMap<BioPAXElement, CyNode>();
+               bpeToCyNodeMap = new HashMap<BioPAXElement, CyNode>();
        
 
        /**
@@ -169,7 +169,7 @@
                this.model = model;
                this.networkFactory = cyNetworkFactory;
                this.taskMonitor = taskMonitor;
-               this.cyGroupFactory = cyGroupFactory;
+//             this.cyGroupFactory = cyGroupFactory;
        }
        
 
@@ -231,12 +231,12 @@
 //                     List<CyNode> nodeList = new ArrayList<CyNode>();
 //                     List<CyEdge> edgeList = new ArrayList<CyEdge>();
                        
-                       CyNode cyParentNode = uriToCyNodeMap.get(par);
+                       CyNode cyParentNode = bpeToCyNodeMap.get(par);
                        assert cyParentNode != null : "cyParentNode is NULL.";
                        // for each its member PE, add the directed edge
                        for (PhysicalEntity member : members) 
                        {
-                               CyNode cyMemberNode = 
uriToCyNodeMap.get(member);
+                               CyNode cyMemberNode = 
bpeToCyNodeMap.get(member);
                                CyEdge edge = network.addEdge(cyParentNode, 
cyMemberNode, true);
                                AttributeUtil.set(network, edge, 
BIOPAX_EDGE_TYPE, "member", String.class);
                                
@@ -265,7 +265,7 @@
                        
                        //  Create node symbolizing the interaction
                        CyNode node = network.addNode();
-                       uriToCyNodeMap.put(bpe, node);
+                       bpeToCyNodeMap.put(bpe, node);
                                           
                        // traverse
                        createAttributesFromProperties(bpe, node, network);
@@ -321,7 +321,7 @@
                                continue;
 
                        // get node
-                       CyNode complexCyNode = 
uriToCyNodeMap.get(complexElement);
+                       CyNode complexCyNode = 
bpeToCyNodeMap.get(complexElement);
                        
 //                     List<CyNode> nodeList = new ArrayList<CyNode>();
 //                     List<CyEdge> edgeList = new ArrayList<CyEdge>();
@@ -329,7 +329,7 @@
                        // get all components. There can be 0 or more
                        for (PhysicalEntity member : members) 
                        {
-                               CyNode complexMemberCyNode = 
uriToCyNodeMap.get(member);
+                               CyNode complexMemberCyNode = 
bpeToCyNodeMap.get(member);
                                // create edge, set attributes
                                CyEdge edge = network.addEdge(complexCyNode, 
complexMemberCyNode, true);
                                AttributeUtil.set(network, edge, 
BIOPAX_EDGE_TYPE, "contains", String.class);
@@ -378,14 +378,14 @@
        private void linkNodes(CyNetwork network, BioPAXElement bpeA, 
BioPAXElement bpeB, String type) 
        {       
                // Note: getCyNode also assigns cellular location attribute...
-               CyNode nodeA = uriToCyNodeMap.get(bpeA);
+               CyNode nodeA = bpeToCyNodeMap.get(bpeA);
                if(nodeA == null) {
                        log.debug("linkNodes: no node was created for " 
                                + bpeA.getModelInterface() + " " + 
bpeA.getRDFId());
                        return; //e.g., we do not create any pathway nodes 
currently...
                }
                
-               CyNode nodeB = uriToCyNodeMap.get(bpeB);
+               CyNode nodeB = bpeToCyNodeMap.get(bpeB);
                if(nodeB == null) {
                        log.debug("linkNodes: no node was created for " 
                                        + bpeB.getModelInterface() + " " + 
bpeB.getRDFId());
@@ -435,14 +435,11 @@
        }
 
 
-       /**
+       /*
         * Given a binding element (complex or interaction)
         * and type (like left or right),
         * returns chemical modification (abbreviated form).
         *
-        * @param physicalElement Element
-        * @param type            String
-        * @return NodeAttributesWrapper
         */
        private NodeAttributesWrapper 
getInteractionChemicalModifications(BioPAXElement participantElement) 
        {
@@ -502,7 +499,7 @@
        }
 
 
-       /**
+       /*
         * A helper function to get post-translational modifications string.
         */
        private String getModificationsString(NodeAttributesWrapper 
chemicalModificationsWrapper) 
@@ -640,14 +637,13 @@
                Filter<PropertyEditor> filter = new Filter<PropertyEditor>() {
                        @Override
                        // skips for entity-range properties (which map to 
edges rather than attributes!),
-                       // and several utility classes range ones 
-                       // (for which we do not want generate attributes or do 
another way)
+                       // and several utility classes ranges (for which we do 
not want generate attributes or do another way)
                        public boolean filter(PropertyEditor editor) {
                                if(editor instanceof ObjectPropertyEditor) {
                                        Class c = editor.getRange();
                                        String prop = editor.getProperty();
                                        if( Entity.class.isAssignableFrom(c)
-                                               || "name".equals(prop) 
//display/standard name is enough
+                                               || "name".equals(prop) //name 
clash with the Cytoscape reserved column (display/standard name is enough)
                                                || 
Stoichiometry.class.isAssignableFrom(c)
                                                || "nextStep".equals(prop) 
                                                ) {     
@@ -662,8 +658,6 @@
                @SuppressWarnings("unchecked")
                AbstractTraverser bpeAutoMapper = new 
AbstractTraverser(SimpleEditorMap.L3, filter) 
                {
-                       final Logger log = 
LoggerFactory.getLogger(AbstractTraverser.class);
-
                        @SuppressWarnings("rawtypes")
                        @Override
                        protected void visit(Object obj, BioPAXElement bpe, 
Model model,
@@ -711,7 +705,7 @@
                        }
 
                        private String getAttrName(Stack<String> props) {
-                               return "/" + StringUtils.join(props, "/");
+                               return StringUtils.join(props, "/");
                        }
                };
 

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
      2012-10-23 16:40:59 UTC (rev 30694)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
      2012-10-23 16:49:56 UTC (rev 30695)
@@ -204,7 +204,7 @@
                for (CyNode node : network.getNodeList()) {
                        CyRow row = network.getRow(node);
                        String tip = row.get(BIOPAX_ENTITY_TYPE, String.class) 
+ "\n"
-                                       + row.get("/cellularLocation", 
String.class);
+                                       + row.get("cellularLocation", 
String.class);
                        View<CyNode> nodeView = networkView.getNodeView(node);
                        
nodeView.setLockedValue(BasicVisualLexicon.NODE_TOOLTIP, tip);
                }
@@ -224,6 +224,7 @@
                        // get chemical modifications
                        int count = 0;
                        boolean isPhosphorylated = false;
+                       
                        // TODO: MultiHashMap
 //                     MultiHashMapDefinition mhmdef = 
nodeAttributes.getMultiHashMapDefinition();
 //

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
       2012-10-23 16:40:59 UTC (rev 30694)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
       2012-10-23 16:49:56 UTC (rev 30695)
@@ -442,7 +442,7 @@
                if(str != null) {
                        str = str.replaceAll("[\n\r \t]+", " ");
                        if (str.length() > MAX_DISPLAY_STRING_LEN) {
-                               str = str.substring(0, MAX_DISPLAY_STRING_LEN) 
+ "...";
+                               str = str.substring(0, 
MAX_DISPLAY_STRING_LEN/2-1) + "..." + 
str.substring(str.length()-MAX_DISPLAY_STRING_LEN/2);
                        }
                }
                return str;

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
       2012-10-23 16:40:59 UTC (rev 30694)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
       2012-10-23 16:49:56 UTC (rev 30695)
@@ -33,7 +33,6 @@
 
 import java.awt.BorderLayout;
 import java.awt.Color;
-import java.awt.Container;
 import java.awt.Dimension;
 import java.util.List;
 
@@ -53,7 +52,6 @@
 import javax.swing.text.html.ParagraphView;
 import javax.swing.text.html.StyleSheet;
 
-import org.apache.commons.lang.StringEscapeUtils;
 import org.biopax.paxtools.model.level3.PhysicalEntity;
 import org.cytoscape.application.CyApplicationManager;
 
@@ -150,9 +148,9 @@
         */
        public void resetText(String text) {
                StringBuffer temp = new StringBuffer();
-               temp.append("<HTML><BODY>");
+               temp.append("<html><body>");
                temp.append(text);
-               temp.append("</BODY></HTML>");
+               temp.append("</body></html>");
                textPane.setText(temp.toString());
        }
 
@@ -164,7 +162,7 @@
        public void showDetails(CyNetwork network, CyNode node) {
         String stringRef;
 
-               StringBuffer buf = new StringBuffer("<HTML>");
+               StringBuffer buf = new StringBuffer("<html><body>");
 
                CyRow row = network.getRow(node);
                
@@ -178,9 +176,13 @@
         
         // organism
         stringRef = null;
-        stringRef = row.get("/entityReference/organism/displayName", 
String.class);
+        stringRef = row.get("entityReference/organism/displayName", 
String.class);
         if(stringRef == null)
-               stringRef = row.get("/organism/displayName", String.class);
+               stringRef = row.get("entityReference/organism/standardName", 
String.class);
+        if(stringRef == null)
+               stringRef = row.get("organism/displayName", String.class);
+        if(stringRef == null)
+               stringRef = row.get("organism/standardName", String.class);
         if (stringRef != null) {
             buf.append("<h3>" + stringRef + "</h3>");
         }
@@ -190,7 +192,7 @@
         
                // cellular location
                stringRef = null;
-        stringRef = row.get("/cellularLocation", String.class);
+        stringRef = row.get("cellularLocation", String.class);
         if (stringRef != null) {
            appendHeader("Cellular Location: " + stringRef, buf);
         }
@@ -200,7 +202,7 @@
                                 BIOPAX_CHEMICAL_MODIFICATIONS_LIST, "Chemical 
Modifications:", buf);
 
                // data source
-        addAttributeList(network, node, null, "/dataSource", "Data sources:", 
buf);
+        addAttributeList(network, node, null, "dataSource", "Data sources:", 
buf);
         
                
                // links
@@ -216,13 +218,9 @@
 //            buf.append("<pre class='excerpt'>" + 
StringEscapeUtils.escapeXml(stringRef) + "</pre>");
 //        }
                
-               buf.append("</BODY></HTML>");
+               buf.append("</body></html>");
                textPane.setText(buf.toString());
                textPane.setCaretPosition(0);
-
-               //  If the containing parent is a BioPaxDetailsWindow, show it.
-               //  This only applies in Cytoscape 2.1 and local testing
-               Container parent = this.getTopLevelAncestor();
     }
 
        //TODO test; remove or upgrade to PC2 api (URI based)
@@ -279,21 +277,21 @@
                        String listItem = list.get(lc);
 
                        if ((listItem != null) && (listItem.length() > 0)) {
-                displayString.append("<LI> - " + listItem);
-                displayString.append("</LI>"); 
+                displayString.append("<li> - " + listItem);
+                displayString.append("</li>"); 
                        }
                }
         if (tooMany) {
-            displayString.append("<LI>  ...</LI>");
+            displayString.append("<li>  ...</li>");
         }
 
         // do we have a string to display ?
                if (displayString.length() > 0) {
                        if(label != null)
                                appendHeader(label, buf);
-            buf.append ("<UL>");
+            buf.append ("<ul>");
             appendData(displayString.toString(), buf, false);
-            buf.append ("</UL>");
+            buf.append ("</ul>");
         }
        }
 
@@ -306,7 +304,7 @@
        private void appendData(String data, StringBuffer buf, boolean 
appendBr) {
                buf.append(data);
                if (appendBr) {
-                       buf.append("<BR>");
+                       buf.append("<br/>");
                }
        }
 
@@ -315,9 +313,9 @@
                String ihopLinks = row.get(BIOPAX_IHOP_LINKS, String.class);
 
                if (ihopLinks != null) {
-                       buf.append("<UL>");
+                       buf.append("<ul>");
                        appendData(ihopLinks, buf, false);
-                       buf.append("</UL>");
+                       buf.append("</ul>");
                }
        }
 }

Modified: core3/impl/trunk/cpath2-impl/pom.xml
===================================================================
--- core3/impl/trunk/cpath2-impl/pom.xml        2012-10-23 16:40:59 UTC (rev 
30694)
+++ core3/impl/trunk/cpath2-impl/pom.xml        2012-10-23 16:49:56 UTC (rev 
30695)
@@ -9,7 +9,7 @@
        <properties>
                
<bundle.symbolicName>org.cytoscape.cpath2-impl</bundle.symbolicName>
                <bundle.namespace>org.cytoscape.cpath2</bundle.namespace>
-               <paxtools.version>4.1.5b</paxtools.version>
+               <paxtools.version>4.1.5b2</paxtools.version>
        </properties>
        
        <modelVersion>4.0.0</modelVersion>

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