Author: mes
Date: 2012-01-27 18:06:09 -0800 (Fri, 27 Jan 2012)
New Revision: 28151

Modified:
   
core3/impl/trunk/psi-mi-impl/impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabParser.java
Log:
minor cleanup to better understand the code

Modified: 
core3/impl/trunk/psi-mi-impl/impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabParser.java
===================================================================
--- 
core3/impl/trunk/psi-mi-impl/impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabParser.java
    2012-01-28 01:29:49 UTC (rev 28150)
+++ 
core3/impl/trunk/psi-mi-impl/impl/src/main/java/org/cytoscape/psi_mi/internal/plugin/PsiMiTabParser.java
    2012-01-28 02:06:09 UTC (rev 28151)
@@ -32,6 +32,7 @@
 
        // Separator for multiple entries.
        private static final String SEPARATOR = "\\|";
+       private static final String SUBSEPARATOR = ":";
        private static final String ATTR_PREFIX = "PSI-MI-25.";
 
        private static final int COLUMN_COUNT = 15;
@@ -132,6 +133,8 @@
                                continue;
 
                        try {
+
+                               //aaa:bbb:ccc|aa:bb:cc|a:b:c<tab>
                                entry = line.split(TAB);
 
                                // Validate entry list.
@@ -140,8 +143,8 @@
 
                                sourceID = entry[0].split(SEPARATOR);
                                targetID = entry[1].split(SEPARATOR);
-                               final String sourceRawID = 
sourceID[0].split(":")[1];
-                               final String targetRawID = 
targetID[0].split(":")[1];
+                               final String sourceRawID = 
sourceID[0].split(SUBSEPARATOR)[1];
+                               final String targetRawID = 
targetID[0].split(SUBSEPARATOR)[1];
 
                                CyNode source = nodeMap.get(sourceRawID);
                                if (source == null) {
@@ -158,9 +161,8 @@
                                network.getRow(target).set(CyTableEntry.NAME, 
targetRawID);
 
                                // Set type if not protein
-                               if (sourceID[0].contains(CHEBI)) {
+                               if (sourceID[0].contains(CHEBI)) 
                                        
network.getRow(source).set(INTERACTOR_TYPE, COMPOUND);
-                               }
                                if (targetID[0].contains(CHEBI))
                                        
network.getRow(target).set(INTERACTOR_TYPE, COMPOUND);
 
@@ -216,7 +218,7 @@
        }
 
        private void setTaxID(CyRow row, String value) {
-               String[] buf = value.split(":", 2);
+               String[] buf = value.split(SUBSEPARATOR, 2);
                String attrName;
                String taxonName;
                if (buf != null && buf.length == 2) {
@@ -243,7 +245,7 @@
                String[] temp;
 
                for (String val : pubID) {
-                       temp = val.split(":", 2);
+                       temp = val.split(SUBSEPARATOR, 2);
                        if (temp == null || temp.length < 2)
                                continue;
 
@@ -263,7 +265,7 @@
                String value;
 
                for (String val : entry) {
-                       temp = val.split(":", 2);
+                       temp = val.split(SUBSEPARATOR, 2);
                        if (temp == null || temp.length < 2)
                                continue;
 
@@ -294,7 +296,7 @@
                String scoreType;
 
                for (String val : entry) {
-                       final String[] parts = val.split(":");
+                       final String[] parts = val.split(SUBSEPARATOR);
                        if (parts == null || parts.length != 2)
                                continue;
 

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