Commit e105c901 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

line type is used on operator for boolean gates

parent 480fd3d7
......@@ -20,6 +20,8 @@ minerva (14.0.0~beta.0) unstable; urgency=low
"Edit Project", "Edit User" (#881)
* Bug fix: all colors in boolean reaction (from CellDesigner) are processed
properly (#907)
* Bug fix: proper line type for boolean reaction is used on the whole
reaction (#908)
* Bug fix: user with modify access to the project can edit it in admin panel
(#901)
......
......@@ -914,6 +914,7 @@ public class ReactionFromXml {
Point2D thirdPoint = pointTransformation.getPointOnLine(product.getLine().getPoints().get(0),
product.getLine().getPoints().get(1), 0.6);
line.addPoint(pointTransformation.copyPoint(secondPoint));
line.setType(product.getLine().getType());
operator.setLine(line);
// center line
......
......@@ -3,12 +3,11 @@ package lcsb.mapviewer.converter.model.celldesigner;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
import java.awt.*;
import java.awt.Color;
import java.awt.geom.*;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -20,6 +19,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.InvalidInputDataExecption;
import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser;
import lcsb.mapviewer.model.graphics.LineType;
import lcsb.mapviewer.model.graphics.PolylineData;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.compartment.Compartment;
......@@ -786,5 +786,18 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
assertEquals(0, new ModelComparator().compare(model, model2));
}
@Test
public void testParseDottedBooleanReaction() throws Exception {
CellDesignerXmlParser parser = new CellDesignerXmlParser();
Model model = parser.createModel(new ConverterParams().filename("testFiles/reactions/boolean-colors.xml"));
Reaction r1 = model.getReactionByReactionId("re1");
Set<LineType> reactionTypes = new HashSet<>();
for (AbstractNode node : r1.getNodes()) {
reactionTypes.add(node.getLine().getType());
}
assertEquals("Whole reaction should use the same reaction type", 1, reactionTypes.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:listOfComplexSpeciesAliases/>
<celldesigner:listOfSpeciesAliases>
<celldesigner:speciesAlias id="sa1" species="s1">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="121.0" y="102.0" w="80.0" h="40.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.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:speciesAlias id="sa2" species="s2">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="126.0" y="254.0" w="80.0" h="40.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.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:speciesAlias id="sa3" species="s3">
<celldesigner:activity>inactive</celldesigner:activity>
<celldesigner:bounds x="463.0" y="180.0" w="80.0" h="40.0"/>
<celldesigner:font size="12"/>
<celldesigner:view state="usual"/>
<celldesigner:usualView>
<celldesigner:innerPosition x="0.0" y="0.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="s1" type="GENERIC"/>
<celldesigner:protein id="pr2" name="s2" type="GENERIC"/>
<celldesigner:protein id="pr3" name="s3" 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="CDMT00004" kind="mole"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="volume" id="volume" name="volume">
<listOfUnits>
<unit metaid="CDMT00005" kind="litre"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="area" id="area" name="area">
<listOfUnits>
<unit metaid="CDMT00006" kind="metre" exponent="2"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="length" id="length" name="length">
<listOfUnits>
<unit metaid="CDMT00007" kind="metre"/>
</listOfUnits>
</unitDefinition>
<unitDefinition metaid="time" id="time" name="time">
<listOfUnits>
<unit metaid="CDMT00008" 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>PROTEIN</celldesigner:class>
<celldesigner:proteinReference>pr1</celldesigner:proteinReference>
</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>PROTEIN</celldesigner:class>
<celldesigner:proteinReference>pr2</celldesigner:proteinReference>
</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>PROTEIN</celldesigner:class>
<celldesigner:proteinReference>pr3</celldesigner:proteinReference>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
<reaction metaid="re1" id="re1" reversible="false">
<annotation>
<celldesigner:extension>
<celldesigner:reactionType>BOOLEAN_LOGIC_GATE</celldesigner:reactionType>
<celldesigner:baseReactants>
<celldesigner:baseReactant species="s2" alias="sa2"/>
<celldesigner:baseReactant species="s1" alias="sa1"/>
</celldesigner:baseReactants>
<celldesigner:baseProducts>
<celldesigner:baseProduct species="s3" alias="sa3"/>
</celldesigner:baseProducts>
<celldesigner:connectScheme connectPolicy="direct"/>
<celldesigner:editPoints>286.66666666666663,199.66666666666666</celldesigner:editPoints>
<celldesigner:line width="1.0" color="ff000000"/>
<celldesigner:listOfGateMember>
<celldesigner:GateMember type="BOOLEAN_LOGIC_GATE_OR" aliases="sa2,sa1" modificationType="UNKNOWN_POSITIVE_INFLUENCE" targetLineIndex="-1,-1" editPoints="286.66666666666663,199.66666666666666">
<celldesigner:connectScheme connectPolicy="direct">
<celldesigner:listOfLineDirection>
<celldesigner:lineDirection index="0" value="unknown"/>
</celldesigner:listOfLineDirection>
</celldesigner:connectScheme>
<celldesigner:line width="1.0" color="ff000000"/>
</celldesigner:GateMember>
<celldesigner:GateMember type="UNKNOWN_POSITIVE_INFLUENCE" aliases="sa2" targetLineIndex="-1,0">
<celldesigner:connectScheme connectPolicy="direct">
<celldesigner:listOfLineDirection>
<celldesigner:lineDirection index="0" value="unknown"/>
</celldesigner:listOfLineDirection>
</celldesigner:connectScheme>
<celldesigner:line width="1.0" color="ff000000"/>
</celldesigner:GateMember>
<celldesigner:GateMember type="UNKNOWN_POSITIVE_INFLUENCE" aliases="sa1" targetLineIndex="-1,0">
<celldesigner:connectScheme connectPolicy="direct">
<celldesigner:listOfLineDirection>
<celldesigner:lineDirection index="0" value="unknown"/>
</celldesigner:listOfLineDirection>
</celldesigner:connectScheme>
<celldesigner:line width="1.0" color="ff000000"/>
</celldesigner:GateMember>
</celldesigner:listOfGateMember>
</celldesigner:extension>
</annotation>
<listOfReactants>
<speciesReference metaid="CDMT00001" species="s2">
<annotation>
<celldesigner:extension>
<celldesigner:alias>sa2</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
<speciesReference metaid="CDMT00002" species="s1">
<annotation>
<celldesigner:extension>
<celldesigner:alias>sa1</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfReactants>
<listOfProducts>
<speciesReference metaid="CDMT00003" species="s3">
<annotation>
<celldesigner:extension>
<celldesigner:alias>sa3</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