diff --git a/CHANGELOG b/CHANGELOG index a5120ad222be5552f3e77badd08cf951554cfee3..c3aa767ef0c85ea8bcf0ba799d6eaf667e3223f1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ minerva (14.0.11) stable; urgency=medium * Bug fix: miRTarBase was down and targetting by miRNA stopped working on new installations (#1207) + * Bug fix: complex with no border was inproperly imported from CellDesigner + (#1198) -- Piotr Gawron Mon, 30 Mar 2020 10:00:00 +0200 diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java index ee84daedd66d96f37b405104bee40903f6f71d54..104e454d05de9ee3505731d33ae9dedb53f48e85 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java @@ -20,6 +20,7 @@ import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; import lcsb.mapviewer.model.map.species.Complex; import lcsb.mapviewer.model.map.species.Species; +import lcsb.mapviewer.modelutils.map.ElementUtils; /** * Parser of CellDesigner xml used for parsing complex aliases. Important: Only @@ -132,9 +133,13 @@ public class ComplexAliasXmlParser extends AbstractAliasXmlParser { if (state.equalsIgnoreCase("usual")) { view = usualView; } else if (state.equalsIgnoreCase("brief")) { - view = briefView; + view = usualView; + } else if (state.equalsIgnoreCase("complexnoborder")) { + view = usualView; } else if (state.equalsIgnoreCase("complexparentbrief")) { view = briefView; + } else { + throw new InvalidXmlSchemaException(new ElementUtils().getElementTag(result)+"Don't know how to process state: " + state); } if (view != null) { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java index c630d756dd0086f00468a3b1e701555d3e1a48ea..8dc20654c180681f8b825dc85fdcecd554cecbae 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java @@ -2,10 +2,9 @@ package lcsb.mapviewer.converter.model.celldesigner; import static org.junit.Assert.*; -import java.awt.*; +import java.awt.Color; import java.io.ByteArrayInputStream; import java.util.*; -import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -317,4 +316,12 @@ public class ComplexParserTests extends CellDesignerTestFunctions { testXmlSerialization(model); } + @Test + public void testComplexNoBorder() throws Exception { + CellDesignerXmlParser parser = new CellDesignerXmlParser(); + Model model = parser.createModel(new ConverterParams().filename("testFiles/problematic/complex_no_border.xml")); + assertTrue(model.getElementByElementId("csa1").getWidth() > 0); + testXmlSerialization(model); + } + } diff --git a/converter-CellDesigner/testFiles/problematic/complex_no_border.xml b/converter-CellDesigner/testFiles/problematic/complex_no_border.xml new file mode 100644 index 0000000000000000000000000000000000000000..eef68e44eedf4b700e2aff18c438bcb68c420349 --- /dev/null +++ b/converter-CellDesigner/testFiles/problematic/complex_no_border.xml @@ -0,0 +1,127 @@ + + + + + +4.0 + + + + + + + +</head> +<body/> +</html> +</celldesigner:notes> +<celldesigner:annotation> +<celldesigner:complexSpecies>s1</celldesigner:complexSpecies> +<celldesigner:speciesIdentity> +<celldesigner:class>PROTEIN</celldesigner:class> +<celldesigner:proteinReference>pr1</celldesigner:proteinReference> +</celldesigner:speciesIdentity> +</celldesigner:annotation> +</celldesigner:species> +</celldesigner:listOfIncludedSpecies> +<celldesigner:listOfCompartmentAliases/> +<celldesigner:listOfComplexSpeciesAliases> +<celldesigner:complexSpeciesAlias id="csa1" species="s1"> +<celldesigner:activity>inactive</celldesigner:activity> +<celldesigner:bounds x="171.0" y="79.0" w="100.0" h="120.0"/> +<celldesigner:font size="12"/> +<celldesigner:view state="complexnoborder"/> +<celldesigner:backupSize w="0.0" h="0.0"/> +<celldesigner:backupView state="none"/> +<celldesigner:usualView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="100.0" height="120.0"/> +<celldesigner:singleLine width="2.0"/> +<celldesigner:paint color="fff7f7f7" scheme="Color"/> +</celldesigner:usualView> +<celldesigner:briefView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="60.0"/> +<celldesigner:singleLine width="2.0"/> +<celldesigner:paint color="fff7f7f7" scheme="Color"/> +</celldesigner:briefView> +<celldesigner:info state="empty" angle="-1.5707963267948966"/> +</celldesigner:complexSpeciesAlias> +</celldesigner:listOfComplexSpeciesAliases> +<celldesigner:listOfSpeciesAliases> +<celldesigner:speciesAlias id="sa1" species="s2" complexSpeciesAlias="csa1"> +<celldesigner:activity>inactive</celldesigner:activity> +<celldesigner:bounds x="183.0" y="91.0" w="80.0" h="40.0"/> +<celldesigner:font size="12"/> +<celldesigner:view state="usual"/> +<celldesigner:usualView> +<celldesigner:innerPosition x="12.0" y="12.0"/> +<celldesigner:boxSize width="80.0" height="40.0"/> +<celldesigner:singleLine width="1.0"/> +<celldesigner:paint color="ffccffcc" scheme="Color"/> +</celldesigner:usualView> +<celldesigner:briefView> +<celldesigner:innerPosition x="0.0" y="0.0"/> +<celldesigner:boxSize width="80.0" height="60.0"/> +<celldesigner:singleLine width="0.0"/> +<celldesigner:paint color="3fff0000" scheme="Color"/> +</celldesigner:briefView> +<celldesigner:info state="empty" angle="-1.5707963267948966"/> +</celldesigner:speciesAlias> +</celldesigner:listOfSpeciesAliases> +<celldesigner:listOfGroups/> +<celldesigner:listOfProteins> +<celldesigner:protein id="pr1" name="s2" type="GENERIC"/> +</celldesigner:listOfProteins> +<celldesigner:listOfGenes/> +<celldesigner:listOfRNAs/> +<celldesigner:listOfAntisenseRNAs/> +<celldesigner:listOfLayers/> +<celldesigner:listOfBlockDiagrams/> +</celldesigner:extension> +</annotation> +<listOfUnitDefinitions> +<unitDefinition metaid="substance" id="substance" name="substance"> +<listOfUnits> +<unit metaid="CDMT00001" kind="mole"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="volume" id="volume" name="volume"> +<listOfUnits> +<unit metaid="CDMT00002" kind="litre"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="area" id="area" name="area"> +<listOfUnits> +<unit metaid="CDMT00003" kind="metre" exponent="2"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="length" id="length" name="length"> +<listOfUnits> +<unit metaid="CDMT00004" kind="metre"/> +</listOfUnits> +</unitDefinition> +<unitDefinition metaid="time" id="time" name="time"> +<listOfUnits> +<unit metaid="CDMT00005" kind="second"/> +</listOfUnits> +</unitDefinition> +</listOfUnitDefinitions> +<listOfCompartments> +<compartment metaid="default" id="default" size="1" units="volume"/> +</listOfCompartments> +<listOfSpecies> +<species metaid="s1" id="s1" name="s1" compartment="default" initialAmount="0"> +<annotation> +<celldesigner:extension> +<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment> +<celldesigner:speciesIdentity> +<celldesigner:class>COMPLEX</celldesigner:class> +<celldesigner:name>s1</celldesigner:name> +</celldesigner:speciesIdentity> +</celldesigner:extension> +</annotation> +</species> +</listOfSpecies> +</model> +</sbml>