Skip to content

Commit 9d5a7cb

Browse files
committed
Fixed GraphML visualization of reactions.
1 parent 690941b commit 9d5a7cb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/de/zbit/kegg/io/KEGG2yGraph.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,23 +1214,27 @@ private void addKGMLReaction(Reaction r, Pathway p, Graph2D graph, Map<String, N
12141214
Entry one = p.getEntryForReactionComponent(sub);
12151215
for (ReactionComponent prod:r.getProducts()) {
12161216
Entry two = p.getEntryForReactionComponent(prod);
1217-
if (one==null || two==null) continue;
1217+
if (one==null || two==null) {
1218+
log.warning("No component for " + sub + " or " + prod);
1219+
continue;
1220+
}
12181221

12191222
// Get nodes, corresponding to entries
12201223
Node nOne = (Node) one.getCustom();
12211224
Node nTwo = (Node) two.getCustom();
12221225

12231226
// Create edge, if not existent.
12241227
if (nOne.getEdgeTo(nTwo)==null) {
1225-
graph.createEdge(nOne, nTwo, er);
1228+
graph.createEdge(nOne, nTwo, er.createCopy());
12261229
}
12271230

12281231
// Consider reaction modifiers
12291232
Node modifier = reactionModifiers.get(r.getName().toLowerCase().trim());
12301233
if (modifier!=null && modifier.getEdgeTo(nTwo)==null) {
1231-
er.setSourceArrow(Arrow.NONE);
1232-
er.setTargetArrow(Arrow.TRANSPARENT_CIRCLE);
1233-
graph.createEdge(modifier, nTwo, er);
1234+
EdgeRealizer er2 = er.createCopy();
1235+
er2.setSourceArrow(Arrow.NONE);
1236+
er2.setTargetArrow(Arrow.TRANSPARENT_CIRCLE);
1237+
graph.createEdge(modifier, nTwo, er2);
12341238
}
12351239
}
12361240
}

0 commit comments

Comments
 (0)