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

Issue with importing SBML with reactions having species in both modifier and product role

parent 3c8d4232
No related branches found
No related tags found
4 merge requests!678Merge 12.2.0 beta.2 into master,!67712.2.0~beta.2 into master,!676Devel 12.2.0~beta.2 into master,!666Resolve "Issue with importing SBML with reactions having species in both modifier and product role"
Pipeline #8969 passed
minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: import from SBML issue - reaction with product and modifier being
the same element caused exception (#703)
* Bug fix: plugin can be added after plugin has been removed in admin plugin
panel (#686)
* Bug fix: too many annotations (>=100) caused misaligning in the left panel
......
......@@ -130,7 +130,8 @@ public class SbmlReactionParser extends SbmlBioEntityParser {
if (nodeClass == null) {
minervaNode = node;
nodeClass = node.getClass();
} else if (node.getClass().isAssignableFrom(nodeClass)) {
} else if (node.getClass().isAssignableFrom(nodeClass) || nodeClass.isAssignableFrom(node.getClass())) {
nodeClass = node.getClass();
minervaNode = node;
}
}
......@@ -390,9 +391,10 @@ public class SbmlReactionParser extends SbmlBioEntityParser {
case SUBSTRATE:
nodeClass = Reactant.class;
break;
case UNDEFINED:
case MODIFIER:
nodeClass = null;
nodeClass = Modifier.class;
break;
case UNDEFINED:
break;
}
}
......
......@@ -215,7 +215,7 @@ public class SbmlParserTest {
new CreateHierarchyCommand(model, 8, 80).execute();
for (Species species : model.getSpeciesList()) {
Set<Element> parents = new HashSet<Element>();
Set<Element> parents = new HashSet<>();
while (species.getComplex() != null) {
assertFalse("Cyclic nesting", parents.contains(species.getComplex()));
species= species.getComplex();
......@@ -229,4 +229,15 @@ public class SbmlParserTest {
}
}
@Test
public void testCyclicComplsexes() throws Exception {
try {
Model model = parser.createModel(new ConverterParams().filename("testFiles/reaction_with_species_used_twice.xml"));
assertEquals(1, model.getReactions().size());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1" level="3" version="1" layout:required="false">
<model substanceUnits="mole" timeUnits="second" extentUnits="mole">
<listOfUnitDefinitions>
<unitDefinition id="per_second">
<listOfUnits>
<unit kind="second" exponent="-1" scale="0" multiplier="1"/>
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>
<listOfCompartments>
<compartment id="comp_0" name="chl" constant="false"/>
</listOfCompartments>
<listOfSpecies>
<species sboTerm="SBO:0000247" id="species_9" name="Lysine" compartment="comp_0" initialAmount="0" hasOnlySubstanceUnits="true" boundaryCondition="false" constant="false"/>
<species sboTerm="SBO:0000327" id="species_13" name="Aspartate semialdehyde" compartment="comp_0" initialAmount="0" hasOnlySubstanceUnits="true" boundaryCondition="false" constant="false"/>
<species sboTerm="SBO:0000252" id="species_1" name="DHDPS1" compartment="comp_0" initialAmount="0" hasOnlySubstanceUnits="true" boundaryCondition="false" constant="false"/>
</listOfSpecies>
<listOfReactions>
<reaction sboTerm="SBO:0000205" id="reaction_glyph_16" reversible="false" fast="false">
<listOfReactants>
<speciesReference species="species_13" constant="false"/>
</listOfReactants>
<listOfProducts>
<speciesReference species="species_9" constant="false"/>
</listOfProducts>
<listOfModifiers>
<modifierSpeciesReference species="species_9"/>
<modifierSpeciesReference species="species_1"/>
</listOfModifiers>
</reaction>
</listOfReactions>
<layout:listOfLayouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1">
<layout:layout layout:id="predicted_layout">
<layout:dimensions layout:width="3003.53089771722" layout:height="1872.10846837268"/>
<layout:listOfCompartmentGlyphs>
<layout:compartmentGlyph layout:id="cg_comp_0" layout:compartment="comp_0">
<layout:boundingBox layout:id="bb_cg_comp_0">
<layout:position layout:x="0" layout:y="0"/>
<layout:dimensions layout:width="3084" layout:height="1912"/>
</layout:boundingBox>
</layout:compartmentGlyph>
</layout:listOfCompartmentGlyphs>
<layout:listOfSpeciesGlyphs>
<layout:speciesGlyph layout:id="sg_Lys__sa7661" layout:species="species_9">
<layout:boundingBox layout:id="bb_sg_Lys__sa7661">
<layout:position layout:x="993.6630278981" layout:y="253.764759320153"/>
<layout:dimensions layout:width="80" layout:height="40"/>
</layout:boundingBox>
</layout:speciesGlyph>
<layout:speciesGlyph layout:id="sg_ASA__sa7670" layout:species="species_13">
<layout:boundingBox layout:id="bb_sg_ASA__sa7670">
<layout:position layout:x="579.395442443615" layout:y="576.651298580278"/>
<layout:dimensions layout:width="80" layout:height="40"/>
</layout:boundingBox>
</layout:speciesGlyph>
<layout:speciesGlyph layout:id="sg_Vdhdps1_DHDPS1" layout:species="species_1">
<layout:boundingBox layout:id="bb_sg_Vdhdps1_DHDPS1">
<layout:position layout:x="617.716819753301" layout:y="339.666214868463"/>
<layout:dimensions layout:width="80" layout:height="40"/>
</layout:boundingBox>
</layout:speciesGlyph>
</layout:listOfSpeciesGlyphs>
<layout:listOfReactionGlyphs>
<layout:reactionGlyph layout:id="rg_Vdhdps1" layout:reaction="reaction_glyph_16">
<layout:curve>
<layout:listOfCurveSegments>
<layout:curveSegment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LineSegment">
<layout:start layout:x="826.529235170857" layout:y="435.208028950216"/>
<layout:end layout:x="826.529235170857" layout:y="435.208028950216"/>
</layout:curveSegment>
</layout:listOfCurveSegments>
</layout:curve>
<layout:listOfSpeciesReferenceGlyphs>
<layout:speciesReferenceGlyph layout:id="srg_Lys__sa7661_modifier_2" layout:speciesGlyph="sg_Lys__sa7661" layout:role="modifier">
<layout:curve>
<layout:listOfCurveSegments>
<layout:curveSegment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LineSegment">
<layout:start layout:x="1033.6630278981" layout:y="273.764759320153"/>
<layout:end layout:x="905.506328076439" layout:y="322.937359825161"/>
</layout:curveSegment>
<layout:curveSegment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LineSegment">
<layout:start layout:x="905.506328076439" layout:y="322.937359825161"/>
<layout:end layout:x="826.529235170857" layout:y="435.208028950216"/>
</layout:curveSegment>
</layout:listOfCurveSegments>
</layout:curve>
</layout:speciesReferenceGlyph>
<layout:speciesReferenceGlyph layout:id="srg_Lys__sa7661_product_1" layout:speciesGlyph="sg_Lys__sa7661" layout:role="product">
<layout:curve>
<layout:listOfCurveSegments>
<layout:curveSegment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LineSegment">
<layout:start layout:x="826.529235170857" layout:y="435.208028950216"/>
<layout:end layout:x="1033.6630278981" layout:y="273.764759320153"/>
</layout:curveSegment>
</layout:listOfCurveSegments>
</layout:curve>
</layout:speciesReferenceGlyph>
<layout:speciesReferenceGlyph layout:id="srg_ASA__sa7670_substrate_1" layout:speciesGlyph="sg_ASA__sa7670" layout:role="substrate">
<layout:curve>
<layout:listOfCurveSegments>
<layout:curveSegment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LineSegment">
<layout:start layout:x="826.529235170857" layout:y="435.208028950216"/>
<layout:end layout:x="619.395442443615" layout:y="596.651298580278"/>
</layout:curveSegment>
</layout:listOfCurveSegments>
</layout:curve>
</layout:speciesReferenceGlyph>
<layout:speciesReferenceGlyph layout:id="srg_Vdhdps1_DHDPS1_modifier_1" layout:speciesGlyph="sg_Vdhdps1_DHDPS1" layout:role="modifier">
<layout:curve>
<layout:listOfCurveSegments>
<layout:curveSegment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LineSegment">
<layout:start layout:x="657.716819753301" layout:y="359.666214868463"/>
<layout:end layout:x="817.401465289127" layout:y="431.123446109071"/>
</layout:curveSegment>
</layout:listOfCurveSegments>
</layout:curve>
</layout:speciesReferenceGlyph>
</layout:listOfSpeciesReferenceGlyphs>
</layout:reactionGlyph>
</layout:listOfReactionGlyphs>
</layout:layout>
</layout:listOfLayouts>
</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