Skip to content

Commit

Permalink
Fixed GraphML visualization of reactions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemens82 committed Jul 26, 2012
1 parent 690941b commit 9d5a7cb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/de/zbit/kegg/io/KEGG2yGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -1214,23 +1214,27 @@ private void addKGMLReaction(Reaction r, Pathway p, Graph2D graph, Map<String, N
Entry one = p.getEntryForReactionComponent(sub);
for (ReactionComponent prod:r.getProducts()) {
Entry two = p.getEntryForReactionComponent(prod);
if (one==null || two==null) continue;
if (one==null || two==null) {
log.warning("No component for " + sub + " or " + prod);
continue;
}

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

// Create edge, if not existent.
if (nOne.getEdgeTo(nTwo)==null) {
graph.createEdge(nOne, nTwo, er);
graph.createEdge(nOne, nTwo, er.createCopy());
}

// Consider reaction modifiers
Node modifier = reactionModifiers.get(r.getName().toLowerCase().trim());
if (modifier!=null && modifier.getEdgeTo(nTwo)==null) {
er.setSourceArrow(Arrow.NONE);
er.setTargetArrow(Arrow.TRANSPARENT_CIRCLE);
graph.createEdge(modifier, nTwo, er);
EdgeRealizer er2 = er.createCopy();
er2.setSourceArrow(Arrow.NONE);
er2.setTargetArrow(Arrow.TRANSPARENT_CIRCLE);
graph.createEdge(modifier, nTwo, er2);
}
}
}
Expand Down

0 comments on commit 9d5a7cb

Please sign in to comment.