Commit 1f4090a0 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when target or source of AF reaction is invalid provide warning instead of exception

parent 46c8bb18
......@@ -244,7 +244,9 @@ public class SbgnmlXmlParser {
for (Arc arc : activityFlowArcs) {
try {
Reaction r = createActivityFlowReaction(arc, model);
model.addReaction(r);
if (r != null) {
model.addReaction(r);
}
} catch (Exception e) {
throw new InvalidInputDataExecption("Unable to parse the reaction: " + arc.getId(), e);
}
......@@ -301,11 +303,19 @@ public class SbgnmlXmlParser {
}
Glyph source = getSourceGlyph(arc);
if (model.getElementByElementId(source.getId()) == null) {
logger.warn(new SbgnLogMarker(ProjectLogEntryType.PARSING_ISSUE, arc, model), "Cannot find source element. Skipping arc.");
return null;
}
Reactant reactant = new Reactant(model.getElementByElementId(source.getId()));
reactant.setLine(new PolylineData(reactantPoints));
result.addReactant(reactant);
Glyph target = getTargetGlyph(arc);
if (model.getElementByElementId(target.getId()) == null) {
logger.warn(new SbgnLogMarker(ProjectLogEntryType.PARSING_ISSUE, arc, model), "Cannot find target element. Skipping arc.");
return null;
}
Product product = new Product(model.getElementByElementId(target.getId()));
product.setLine(parseLine(arc, productPoints));
result.addProduct(product);
......
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<sbgn xmlns="http://sbgn.org/libsbgn/0.2">
<map language="process description">
<glyph id="n59" class="macromolecule">
<label text="C4"/>
<bbox x="662.16473" y="277.00546" w="80" h="40"/>
</glyph>
<glyph id="n61" class="and">
<label text="C4a"/>
<bbox x="662.16473" y="472.85104" w="80" h="40"/>
</glyph>
<glyph id="glyph3" orientation="vertical" class="process">
<bbox y="448.0" x="478.0" h="24.0" w="24.0"/>
<port y="436.0" x="490.0" id="glyph3.1"/>
<port y="484.0" x="490.0" id="glyph3.2"/>
</glyph>
<arc id="e28" class="production" source="n59" target="n61">
<start x="702.16473" y="317.50546"/>
<end x="702.16473" y="382.92825"/>
</arc>
</map>
</sbgn>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment