Commit 24c85641 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

drug shape in CellDesigner is slightly different

parent 4d6b36cf
......@@ -3,6 +3,8 @@ minerva (15.1.4) stable; urgency=medium
(#1476)
* Bug fix: orthogonal reactions to phenotypes from CellDesigner were drawn
incorrectly (#1454)
* Bug fix: orthogonal reactions to drugs from CellDesigner were drawn
incorrectly (#1454)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 30 Apr 2021 17:00:00 +0200
......
package lcsb.mapviewer.converter.model.celldesigner.geometry;
import java.awt.*;
import java.awt.Shape;
import java.awt.geom.*;
import java.util.ArrayList;
import java.util.List;
import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor;
import lcsb.mapviewer.model.map.species.Element;
......@@ -37,7 +38,7 @@ public class DrugCellDesignerAliasConverter extends AbstractCellDesignerAliasCon
if (invalidAnchorPosition(alias, anchor)) {
return alias.getCenter();
}
ArrayList<Point2D> list = getDrugPoints(alias);
List<Point2D> list = getDrugPoints(alias);
return getPolygonTransformation().getPointOnPolygonByAnchor(list, anchor);
}
......@@ -54,23 +55,25 @@ public class DrugCellDesignerAliasConverter extends AbstractCellDesignerAliasCon
* alias for which we are looking for a border
* @return list of points defining border of the given alias
*/
protected ArrayList<Point2D> getDrugPoints(Species alias) {
ArrayList<Point2D> list = new ArrayList<Point2D>();
protected List<Point2D> getDrugPoints(Species alias) {
List<Point2D> list = new ArrayList<>();
double x = alias.getX();
double y = alias.getY();
double width = alias.getWidth();
double height = alias.getHeight();
double cutSize = width*1/5;
// CHECKSTYLE:OFF
list.add(new Point2D.Double(x, y + height / 2));
list.add(new Point2D.Double(x + width / 12, 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 * 11 / 12, 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 * 11 / 12, 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 / 12, y + height));
list.add(new Point2D.Double(x + cutSize, y + height));
// CHECKSTYLE:ON
return list;
}
......
......@@ -936,5 +936,13 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
assertEquals(r.getReactants().get(0).getLine().getBeginPoint().getY(), r.getProducts().get(0).getLine().getBeginPoint().getY(), Configuration.EPSILON);
}
@Test
public void testOrthogonalReactionToDrug() throws Exception {
CellDesignerXmlParser parser = new CellDesignerXmlParser();
Model model = parser.createModel(new ConverterParams().filename("testFiles/orthogonal_reaction_to_drug.xml"));
Reaction r = model.getReactionByReactionId("re3");
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="29.0" y="213.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="sa2" species="s3">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="219.0" y="46.0" w="375.0" h="74.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.0"/>
<celldesigner:boxSize width="375.0" height="74.0"/>
<celldesigner:singleLine width="1.0"/>
<celldesigner:paint color="ffff00ff" 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="s3" id="s3" name="s3" compartment="default" initialAmount="0">
<annotation>
<celldesigner:extension>
<celldesigner:positionToCompartment>inside</celldesigner:positionToCompartment>
<celldesigner:speciesIdentity>
<celldesigner:class>DRUG</celldesigner:class>
<celldesigner:name>s3</celldesigner:name>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
<reaction metaid="re3" id="re3" 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="s3" alias="sa2">
<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.5937800642735791,0.49112656163645174</celldesigner:editPoints>
<celldesigner:line width="1.0" color="ff000000"/>
</celldesigner:extension>
</annotation>
<listOfReactants>
<speciesReference metaid="CDMT00008" species="s1">
<annotation>
<celldesigner:extension>
<celldesigner:alias>csa1</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfReactants>
<listOfProducts>
<speciesReference metaid="CDMT00009" species="s3">
<annotation>
<celldesigner:extension>
<celldesigner:alias>sa2</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfProducts>
</reaction>
</listOfReactions>
</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