Commit 7f6269a5 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

compartments limited by corner (left-top corner compartment, etc) are parsed...

compartments limited by corner (left-top corner compartment, etc) are parsed properly from CellDesigner files
parent 1990ff3c
......@@ -10,6 +10,8 @@ minerva (15.0.0~alpha.1) stable; urgency=medium
* Small improvement: list of genomes is automatically refreshed during genome
upload (#820)
* Small improvement: items in context menu are reorganized (#787)
* Bug fix: compartments limited by corner (left-top corner compartment, etc)
are parsed properly from CellDesigner files
* Bug fix: structural states of proteins are imported properly from SBGNML PD
(#995)
* Bug fix: clear button icon, refresh comments button and show overview
......
......@@ -69,11 +69,12 @@ public class CompartmentAliasXmlParser extends AbstractAliasXmlParser<Compartmen
elements.addElement(compartment, aliasId);
NodeList nodes = aliasNode.getChildNodes();
String type = null;
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (node.getNodeName().equalsIgnoreCase("celldesigner:class")) {
String type = XmlParser.getNodeValue(node);
type = XmlParser.getNodeValue(node);
if (type.equalsIgnoreCase("SQUARE")) {
result = new SquareCompartment(result);
} else if (type.equalsIgnoreCase("SQUARE_CLOSEUP_NORTH")) {
......@@ -84,6 +85,14 @@ public class CompartmentAliasXmlParser extends AbstractAliasXmlParser<Compartmen
result = new RightSquareCompartment(result, model);
} else if (type.equalsIgnoreCase("SQUARE_CLOSEUP_EAST")) {
result = new LeftSquareCompartment(result, model);
} else if (type.equalsIgnoreCase("SQUARE_CLOSEUP_NORTHWEST")) {
result = new SquareCompartment(result);
} else if (type.equalsIgnoreCase("SQUARE_CLOSEUP_NORTHEAST")) {
result = new SquareCompartment(result);
} else if (type.equalsIgnoreCase("SQUARE_CLOSEUP_SOUTHEAST")) {
result = new SquareCompartment(result);
} else if (type.equalsIgnoreCase("SQUARE_CLOSEUP_SOUTHWEST")) {
result = new SquareCompartment(result);
} else if (type.equalsIgnoreCase("OVAL")) {
result = new OvalCompartment(result);
} else {
......@@ -121,6 +130,26 @@ public class CompartmentAliasXmlParser extends AbstractAliasXmlParser<Compartmen
} else if (result instanceof TopSquareCompartment) {
result.setHeight(XmlParser.getNodeAttr("y", node));
result.setY(0.0);
} else if ("SQUARE_CLOSEUP_NORTHWEST".equals(type)) {
result.setX(XmlParser.getNodeAttr("x", node));
result.setY(XmlParser.getNodeAttr("y", node));
result.setWidth(model.getWidth() - result.getX());
result.setHeight(model.getHeight() - result.getY());
} else if ("SQUARE_CLOSEUP_NORTHEAST".equals(type)) {
result.setWidth(XmlParser.getNodeAttr("x", node));
result.setY(XmlParser.getNodeAttr("y", node));
result.setX(0);
result.setHeight(model.getHeight() - result.getY());
} else if ("SQUARE_CLOSEUP_SOUTHEAST".equals(type)) {
result.setWidth(XmlParser.getNodeAttr("x", node));
result.setHeight(XmlParser.getNodeAttr("y", node));
result.setX(0);
result.setY(0);
} else if ("SQUARE_CLOSEUP_SOUTHWEST".equals(type)) {
result.setX(XmlParser.getNodeAttr("x", node));
result.setHeight(XmlParser.getNodeAttr("y", node));
result.setWidth(model.getWidth() - result.getX());
result.setY(0);
} else {
throw new InvalidXmlSchemaException(
"Don't know what to do with celldesigner:point for class: " + result.getClass());
......
......@@ -70,4 +70,52 @@ public class CompartmentParserTests extends CellDesignerTestFunctions {
assertEquals(1, model.getElements().size());
}
@Test
public void testParseCompartmentBottomRight() throws Exception {
Model model = getModelForFile("testFiles/compartment/bottom_right_compartment.xml");
Compartment c = model.getElementByElementId("ca1");
assertTrue(c.getX() > 0);
assertTrue(c.getY() > 0);
assertTrue(c.getWidth() > 0);
assertTrue(c.getHeight() > 0);
assertEquals(1, model.getElements().size());
}
@Test
public void testParseCompartmentBottomLeft() throws Exception {
Model model = getModelForFile("testFiles/compartment/bottom_left_compartment.xml");
Compartment c = model.getElementByElementId("ca1");
assertEquals(c.getX(), 0, Configuration.EPSILON);
assertTrue(c.getY() > 0);
assertTrue(c.getWidth() > 0);
assertTrue(c.getHeight() > 0);
assertEquals(1, model.getElements().size());
}
@Test
public void testParseCompartmentTopLeft() throws Exception {
Model model = getModelForFile("testFiles/compartment/top_left_compartment.xml");
Compartment c = model.getElementByElementId("ca1");
assertEquals(c.getX(), 0, Configuration.EPSILON);
assertEquals(c.getY(), 0, Configuration.EPSILON);
assertTrue(c.getWidth() > 0);
assertTrue(c.getHeight() > 0);
assertEquals(1, model.getElements().size());
}
@Test
public void testParseCompartmentTopRight() throws Exception {
Model model = getModelForFile("testFiles/compartment/top_right_compartment.xml");
Compartment c = model.getElementByElementId("ca1");
assertTrue(c.getX() > 0);
assertEquals(c.getY(), 0, Configuration.EPSILON);
assertTrue(c.getWidth() > 0);
assertTrue(c.getHeight() > 0);
assertEquals(1, model.getElements().size());
}
}
<?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_CLOSEUP_NORTHEAST</celldesigner:class>
<celldesigner:point x="85.0" y="335.0"/>
<celldesigner:namePoint x="0.0" y="377.0"/>
<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>
</listOfCompartments>
</model>
</sbml>
<?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_CLOSEUP_NORTHWEST</celldesigner:class>
<celldesigner:point x="479.0" y="271.0"/>
<celldesigner:namePoint x="583.0" y="377.0"/>
<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>
</listOfCompartments>
</model>
</sbml>
<?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_CLOSEUP_SOUTHEAST</celldesigner:class>
<celldesigner:point x="182.0" y="104.0"/>
<celldesigner:namePoint x="0.0" y="0.0"/>
<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>
</listOfCompartments>
</model>
</sbml>
<?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_CLOSEUP_SOUTHWEST</celldesigner:class>
<celldesigner:point x="388.0" y="186.0"/>
<celldesigner:namePoint x="583.0" y="0.0"/>
<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>
</listOfCompartments>
</model>
</sbml>
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