Commit a6f6ea1e authored by Piotr Gawron's avatar Piotr Gawron
Browse files

CellDesigner sometimes marked reduced notation reaction as reversible even...

CellDesigner sometimes marked reduced notation reaction as reversible even though they should not be
parent 5ca7ef77
Pipeline #21402 passed with stage
in 14 minutes and 5 seconds
......@@ -4,6 +4,8 @@ minerva (14.0.9) stable; urgency=medium
* Bug fix: refresh data overlay did not hide data overlays that were removed
and selected (#1097)
* Bug fix: transparent complexes are shown with wrong color (#1103)
* Bug fix: CellDesigner sometimes marked reduced notation reaction as
reversible even though they were not visualized so (#1109)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 3 Feb 2020 15:00:00 +0200
......
......@@ -25,6 +25,7 @@ import lcsb.mapviewer.model.map.reaction.*;
import lcsb.mapviewer.model.map.reaction.type.*;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.map.species.Species;
import lcsb.mapviewer.modelutils.map.ElementUtils;
/**
* This is a part of {@link ReactionXmlParser} class functionality that allows
......@@ -176,6 +177,15 @@ public class ReactionFromXml {
} catch (InvalidStateException e) {
throw new ReactionParserException(result, e);
}
if (result instanceof ReducedNotation || result instanceof ModifierReactionNotation) {
// there is a bug in CellDesigner (#1109) that allows to save such reactions
// with reversible flag (even though it cannot be reversible)
if (result.isReversible()) {
logger.warn(
new ElementUtils().getElementTag(result) + "Reacion was marked as reversible but it cannot be reversible");
result.setReversible(false);
}
}
return result;
}
......@@ -409,7 +419,7 @@ public class ReactionFromXml {
}
applyStylingToLine(line, result.getLine());
if (booleanLogicGateType!=null) {
if (booleanLogicGateType != null) {
assignColorFromGateMembers(result, gateMembers);
}
if (reactantsLinkNode != null) {
......@@ -951,7 +961,7 @@ public class ReactionFromXml {
polylines.add(result.getReactants().get(elementIndex - 1).getLine());
}
}
for (PolylineData polyline: polylines) {
for (PolylineData polyline : polylines) {
polyline.setColor(line.getColor());
polyline.setWidth(line.getWidth());
}
......
......@@ -26,7 +26,7 @@ import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.layout.graphics.*;
import lcsb.mapviewer.model.map.model.*;
import lcsb.mapviewer.model.map.reaction.*;
import lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction;
import lcsb.mapviewer.model.map.reaction.type.*;
import lcsb.mapviewer.model.map.species.*;
public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
......@@ -874,4 +874,15 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
assertEquals(c1.getBlue(), c2.getBlue());
}
@Test
public void testTrigger() throws Exception {
CellDesignerXmlParser parser = new CellDesignerXmlParser();
Model model = parser.createModel(new ConverterParams().filename("testFiles/problematic/unknown-rections.xml"));
for (Reaction reaction : model.getReactions()) {
if (reaction instanceof ReducedNotation || reaction instanceof ModifierReactionNotation) {
assertFalse("Reaction cannot be reversible: " + reaction, reaction.isReversible());
}
}
}
}
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