Author: scooter
Date: 2010-07-23 18:10:31 -0700 (Fri, 23 Jul 2010)
New Revision: 21017
Modified:
cytoscape/trunk/src/cytoscape/data/readers/XGMMLParser.java
Log:
This is the first shot at fixing bug 2265. In the longer term, we should not
use the label
to pull out the interaction, but write it out as an attribute.
Modified: cytoscape/trunk/src/cytoscape/data/readers/XGMMLParser.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/XGMMLParser.java 2010-07-23
23:10:32 UTC (rev 21016)
+++ cytoscape/trunk/src/cytoscape/data/readers/XGMMLParser.java 2010-07-24
01:10:31 UTC (rev 21017)
@@ -897,15 +897,23 @@
String targetAlias = null;
String interaction = "pp";
+ // XXX this is really fragile. Parens in labels will
cause things to break in nasty ways....
+ //
// Parse out the interaction (if this is from Cytoscape)
// parts[0] = source alias
// parts[1] = interaction
// parts[2] = target alias
- String[] parts = label.split("[()]");
- if (parts.length == 3) {
- sourceAlias = parts[0];
- interaction = parts[1];
- targetAlias = parts[2];
+ int interactionStart = label.indexOf('(');
+ int interactionEnd = label.lastIndexOf(')');
+ if (interactionStart != -1 && interactionEnd != -1) {
+ sourceAlias = label.substring(0,
interactionStart-1);
+ if (sourceAlias.length() > 0) sourceAlias =
sourceAlias.trim();
+
+ interaction =
label.substring(interactionStart+1, interactionEnd);
+ if (interaction.length() > 0) interaction =
interaction.trim();
+
+ targetAlias = label.substring(interactionEnd+1);
+ if (targetAlias.length() > 0) targetAlias =
targetAlias.trim();
// logger.debug("Edge label parse: interaction
= "+interaction);
}
--
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.