Skip to content
Snippets Groups Projects
Commit 31317384 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

parent compartment is assigned properly when processing compartments

parent c2b216e7
No related branches found
No related tags found
1 merge request!44Resolve "semantic zoom"
......@@ -215,6 +215,7 @@ public class AliasCollectionXmlParser extends XmlParser {
}
if (parent != nullParent) {
child.setCompartment(parent);
parent.addElement(child);
}
}
}
......
......@@ -29,6 +29,7 @@ import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser;
import lcsb.mapviewer.model.graphics.PolylineData;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.layout.graphics.Layer;
import lcsb.mapviewer.model.map.layout.graphics.LayerOval;
import lcsb.mapviewer.model.map.layout.graphics.LayerRect;
......@@ -991,4 +992,27 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
}
}
@Test
public void testCompartmentWithSubcompartments() throws Exception {
try {
CellDesignerXmlParser parser = new CellDesignerXmlParser();
Model model = parser.createModel(new ConverterParams().filename("testFiles/compartment/nested_compartments_in_few_compartments.xml"));
Compartment c3 = model.getElementByElementId("ca3");
Compartment c4 = model.getElementByElementId("ca4");
Compartment c1 = model.getElementByElementId("ca1");
Compartment c2 = model.getElementByElementId("ca2");
assertEquals("ca1", c3.getCompartment().getElementId());
assertEquals("ca2", c4.getCompartment().getElementId());
assertEquals(1, c1.getElements().size());
assertEquals(1, c2.getElements().size());
assertEquals(0, c3.getElements().size());
assertEquals(0, c4.getElements().size());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
}
......@@ -289,7 +289,6 @@ public class RestAnnotationParserTest extends CellDesignerTestFunctions {
element.addFormerSymbol(former2);
element.setCharge(1);
String str = rap.createAnnotationString(element, true);
logger.debug(str);
assertTrue(str.contains(former1));
assertTrue(str.contains(former2));
......
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level2/version4" xmlns:celldesigner="http://www.sbml.org/2001/ns/celldesigner" level="2" version="4">
<model metaid="untitled" id="untitled">
<annotation>
<celldesigner:extension>
<celldesigner:modelVersion>4.0</celldesigner:modelVersion>
<celldesigner:modelDisplay sizeX="600" sizeY="400"/>
<celldesigner:listOfCompartmentAliases>
<celldesigner:compartmentAlias id="ca1" compartment="c1">
<celldesigner:class>SQUARE</celldesigner:class>
<celldesigner:bounds x="35.0" y="77.0" w="171.0" h="179.0"/>
<celldesigner:namePoint x="98.5" y="153.5"/>
<celldesigner:doubleLine thickness="12.0" outerWidth="2.0" innerWidth="1.0"/>
<celldesigner:paint color="ffcccc00" scheme="Color"/>
<celldesigner:info state="empty" angle="-1.5707963267948966"/>
</celldesigner:compartmentAlias>
<celldesigner:compartmentAlias id="ca2" compartment="c2">
<celldesigner:class>SQUARE</celldesigner:class>
<celldesigner:bounds x="316.0" y="110.0" w="248.0" h="149.0"/>
<celldesigner:namePoint x="432.5" y="222.5"/>
<celldesigner:doubleLine thickness="12.0" outerWidth="2.0" innerWidth="1.0"/>
<celldesigner:paint color="ffcccc00" scheme="Color"/>
<celldesigner:info state="empty" angle="-1.5707963267948966"/>
</celldesigner:compartmentAlias>
<celldesigner:compartmentAlias id="ca3" compartment="c3">
<celldesigner:class>SQUARE</celldesigner:class>
<celldesigner:bounds x="64.0" y="144.0" w="105.0" h="68.0"/>
<celldesigner:namePoint x="109.0" y="175.5"/>
<celldesigner:doubleLine thickness="12.0" outerWidth="2.0" innerWidth="1.0"/>
<celldesigner:paint color="ffcccc00" scheme="Color"/>
<celldesigner:info state="empty" angle="-1.5707963267948966"/>
</celldesigner:compartmentAlias>
<celldesigner:compartmentAlias id="ca4" compartment="c3">
<celldesigner:class>SQUARE</celldesigner:class>
<celldesigner:bounds x="351.0" y="180.0" w="86.0" h="33.0"/>
<celldesigner:namePoint x="386.5" y="184.5"/>
<celldesigner:doubleLine thickness="12.0" outerWidth="2.0" innerWidth="1.0"/>
<celldesigner:paint color="ffcccc00" scheme="Color"/>
<celldesigner:info state="empty" angle="-1.5707963267948966"/>
</celldesigner:compartmentAlias>
</celldesigner:listOfCompartmentAliases>
<celldesigner:listOfComplexSpeciesAliases/>
<celldesigner:listOfSpeciesAliases/>
<celldesigner:listOfGroups/>
<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"/>
<compartment metaid="c1" id="c1" name="c1" size="1" units="volume" outside="default">
<annotation>
<celldesigner:extension>
<celldesigner:name>c1</celldesigner:name>
</celldesigner:extension>
</annotation>
</compartment>
<compartment metaid="c2" id="c2" name="c2" size="1" units="volume" outside="default">
<annotation>
<celldesigner:extension>
<celldesigner:name>c2</celldesigner:name>
</celldesigner:extension>
</annotation>
</compartment>
<compartment metaid="c3" id="c3" name="c3" size="1" units="volume" outside="c2">
<annotation>
<celldesigner:extension>
<celldesigner:name>c3</celldesigner:name>
</celldesigner:extension>
</annotation>
</compartment>
</listOfCompartments>
</model>
</sbml>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment