Author: kono
Date: 2010-07-15 13:55:12 -0700 (Thu, 15 Jul 2010)
New Revision: 20940

Modified:
   
coreplugins/trunk/TableImport/src/edu/ucsd/bioeng/coreplugin/tableImport/reader/NetworkLineParser.java
Log:
Bug ID 0001960: "Network Input Delimiter Issue" is fixed.  Trailing spaces are 
treated as valid values (if delimiter is not space).

Modified: 
coreplugins/trunk/TableImport/src/edu/ucsd/bioeng/coreplugin/tableImport/reader/NetworkLineParser.java
===================================================================
--- 
coreplugins/trunk/TableImport/src/edu/ucsd/bioeng/coreplugin/tableImport/reader/NetworkLineParser.java
      2010-07-15 19:57:51 UTC (rev 20939)
+++ 
coreplugins/trunk/TableImport/src/edu/ucsd/bioeng/coreplugin/tableImport/reader/NetworkLineParser.java
      2010-07-15 20:55:12 UTC (rev 20940)
@@ -81,44 +81,27 @@
        public void parseEntry(String[] parts) {
                final Edge edge = addNodeAndEdge(parts);
 
-               if (edge != null) {
+               if (edge != null)
                        addEdgeAttributes(edge, parts);
-               }
        }
 
+       
        private Edge addNodeAndEdge(final String[] parts) {
-               final Node source;
                
-               if (nmp.getSourceIndex().equals(-1) == false && 
(nmp.getSourceIndex() <= (parts.length - 1)) && (parts[nmp.getSourceIndex()] != 
null)) {
-                       source = 
Cytoscape.getCyNode(parts[nmp.getSourceIndex()].trim(), true);
-                       nodeList.add(source.getRootGraphIndex());
-               } else {
-                       source = null;
-               }
+               final Node source = createNode(parts, nmp.getSourceIndex());
+               final Node target = createNode(parts, nmp.getTargetIndex());    
        
                
-               final Node target;
-
-               if (nmp.getTargetIndex().equals(-1) == false && 
(nmp.getTargetIndex() <= (parts.length - 1)) && (parts[nmp.getTargetIndex()] != 
null)) {
-                       target = 
Cytoscape.getCyNode(parts[nmp.getTargetIndex()].trim(), true);
-                       nodeList.add(target.getRootGraphIndex());
-               } else {
-                       target = null;
-               }
-               
                // Single column nodes list.  Just add nodes.
-               if(source == null || target == null) {
-                       // do not create edge.
+               if(source == null || target == null)
                        return null;
-               }
 
                final String interaction;
 
                if ((nmp.getInteractionIndex() == -1) || 
(nmp.getInteractionIndex() > (parts.length - 1))
                    || (parts[nmp.getInteractionIndex()] == null)) {
                        interaction = nmp.getDefaultInteraction();
-               } else {
-                       interaction = parts[nmp.getInteractionIndex()].trim();
-               }
+               } else
+                       interaction = parts[nmp.getInteractionIndex()];
 
                final Edge edge;
                edge = Cytoscape.getCyEdge(source, target, 
Semantics.INTERACTION, interaction, true, true);
@@ -126,6 +109,18 @@
                
                return edge;
        }
+       
+       
+       private Node createNode(final String[] parts, final Integer nodeIndex) {
+               final Node node;
+               if (nodeIndex.equals(-1) == false && (nodeIndex <= 
(parts.length - 1)) && (parts[nodeIndex] != null)) {
+                       node = Cytoscape.getCyNode(parts[nodeIndex], true);
+                       nodeList.add(node.getRootGraphIndex());
+               } else
+                       node = null;
+               
+               return node;
+       }
 
        private void addEdgeAttributes(final Edge edge, final String[] parts) {
                for (int i = 0; i < parts.length; i++) {

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