Commit 4d6b36cf authored by Piotr Gawron's avatar Piotr Gawron
Browse files

phenotype shape changed to reflect celldesigner shapes better

parent 0e9498da
minerva (15.1.4) stable; urgency=medium
* Bug fix: structural state information data was not available for complexes
(#1476)
* Bug fix: orthogonal reactions to phenotypes from CellDesigner were drawn
incorrectly (#1454)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 30 Apr 2021 17:00:00 +0200
......
......@@ -53,16 +53,18 @@ public class PhenotypeCellDesignerAliasConverter extends AbstractCellDesignerAli
double y = alias.getY();
double width = alias.getWidth();
double height = alias.getHeight();
double cutSize = Math.min(width, height)/2;
// CHECKSTYLE:OFF
list.add(new Point2D.Double(x, y + height / 2));
list.add(new Point2D.Double(x + width / 6, y));
list.add(new Point2D.Double(x + cutSize, y));
list.add(new Point2D.Double(x + width / 2, y));
list.add(new Point2D.Double(x + width * 5 / 6, y));
list.add(new Point2D.Double(x + width - cutSize, y));
list.add(new Point2D.Double(x + width, y + height / 2));
list.add(new Point2D.Double(x + width * 5 / 6, y + height));
list.add(new Point2D.Double(x + width - cutSize, y + height));
list.add(new Point2D.Double(x + width / 2, y + height));
list.add(new Point2D.Double(x + width / 6, y + height));
list.add(new Point2D.Double(x + cutSize, y + height));
// CHECKSTYLE:ON
return list;
}
......
......@@ -928,4 +928,13 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
assertEquals(2, model.getAuthors().size());
}
@Test
public void testOrthogonalReactionToPhenotype() throws Exception {
CellDesignerXmlParser parser = new CellDesignerXmlParser();
Model model = parser.createModel(new ConverterParams().filename("testFiles/orthogonal_reaction_to_phenotype.xml"));
Reaction r = model.getReactionByReactionId("re2");
assertEquals(r.getReactants().get(0).getLine().getBeginPoint().getY(), r.getProducts().get(0).getLine().getBeginPoint().getY(), Configuration.EPSILON);
}
}
<?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:listOfComplexSpeciesAliases>
<celldesigner:complexSpeciesAlias id="csa1" species="s1">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="97.0" y="159.0" w="100.0" h="120.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:backupSize w="0.0" h="0.0"/>
<celldesigner:backupView state="none"/>
<celldesigner:structuralState angle="1.5707963267948966"/>
<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">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="328.0" y="93.0" w="186.0" h="29.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="186.0" height="29.0"/>
<celldesigner:singleLine width="1.0"/>
<celldesigner:paint color="ffcc99ff" 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: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:state>
<celldesigner:listOfStructuralStates>
<celldesigner:structuralState structuralState="open"/>
</celldesigner:listOfStructuralStates>
</celldesigner:state>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
<species metaid="s2" id="s2" name="s2" compartment="default" initialAmount="0">
<annotation>
<celldesigner:extension>
<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment>
<celldesigner:speciesIdentity>
<celldesigner:class>PHENOTYPE</celldesigner:class>
<celldesigner:name>s2</celldesigner:name>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
<reaction metaid="re2" id="re2" reversible="false">
<annotation>
<celldesigner:extension>
<celldesigner:reactionType>STATE_TRANSITION</celldesigner:reactionType>
<celldesigner:baseReactants>
<celldesigner:baseReactant species="s1" alias="csa1">
<celldesigner:linkAnchor position="ESE"/>
</celldesigner:baseReactant>
</celldesigner:baseReactants>
<celldesigner:baseProducts>
<celldesigner:baseProduct species="s2" alias="sa1">
<celldesigner:linkAnchor position="SSW"/>
</celldesigner:baseProduct>
</celldesigner:baseProducts>
<celldesigner:connectScheme connectPolicy="square" rectangleIndex="0">
<celldesigner:listOfLineDirection>
<celldesigner:lineDirection index="0" value="horizontal"/>
<celldesigner:lineDirection index="1" value="vertical"/>
</celldesigner:listOfLineDirection>
</celldesigner:connectScheme>
<celldesigner:editPoints>0.6790987148479515,0.46682293253418083</celldesigner:editPoints>
<celldesigner:line width="1.0" color="ff000000"/>
</celldesigner:extension>
</annotation>
<listOfReactants>
<speciesReference metaid="CDMT00006" species="s1">
<annotation>
<celldesigner:extension>
<celldesigner:alias>csa1</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfReactants>
<listOfProducts>
<speciesReference metaid="CDMT00007" species="s2">
<annotation>
<celldesigner:extension>
<celldesigner:alias>sa1</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfProducts>
</reaction>
</listOfReactions>
</model>
</sbml>
......@@ -64,12 +64,21 @@ public class PhenotypeConverter extends SpeciesConverter<Phenotype> {
private GeneralPath getPhenotypePath(final Phenotype phenotype) {
// CHECKSTYLE:OFF
GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, 6);
path.moveTo(phenotype.getX() + phenotype.getWidth() / 6, phenotype.getY());
path.lineTo(phenotype.getX() + phenotype.getWidth() * 5 / 6, phenotype.getY());
path.lineTo(phenotype.getX() + phenotype.getWidth(), phenotype.getY() + phenotype.getHeight() / 2);
path.lineTo(phenotype.getX() + phenotype.getWidth() * 5 / 6, phenotype.getY() + phenotype.getHeight());
path.lineTo(phenotype.getX() + phenotype.getWidth() / 6, phenotype.getY() + phenotype.getHeight());
path.lineTo(phenotype.getX(), phenotype.getY() + phenotype.getHeight() / 2);
double x = phenotype.getX();
double y = phenotype.getY();
double width = phenotype.getWidth();
double height = phenotype.getHeight();
double cutSize = Math.min(width, height)/2;
path.moveTo(x, y + height / 2);
path.lineTo(x + cutSize, y);
path.lineTo(x + width - cutSize, y);
path.lineTo(x + width, y + height / 2);
path.lineTo(x + width - cutSize, y + height);
path.lineTo(x + cutSize, y + height);
// CHECKSTYLE:ON
path.closePath();
return path;
......
This diff is collapsed.
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