Commit 6fb44960 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

export to celldesigner with undefined units in kinetics didn't work

parent 1f550364
......@@ -103,8 +103,12 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
LocalParameter parameter = new LocalParameter();
parameter.setId(minervaParameter.getElementId());
parameter.setName(minervaParameter.getName());
parameter.setValue(minervaParameter.getValue());
parameter.setUnits(minervaParameter.getUnits().getUnitId());
if (minervaParameter.getValue() != null) {
parameter.setValue(minervaParameter.getValue());
}
if (minervaParameter.getUnits() != null) {
parameter.setUnits(minervaParameter.getUnits().getUnitId());
}
result.addLocalParameter(parameter);
}
}
......
......@@ -13,7 +13,10 @@ import lcsb.mapviewer.converter.model.sbml.SbmlBioEntityExporter;
import lcsb.mapviewer.converter.model.sbml.SbmlCompartmentExporter;
import lcsb.mapviewer.converter.model.sbml.species.SbmlSpeciesExporter;
import lcsb.mapviewer.model.map.InconsistentModelException;
import lcsb.mapviewer.model.map.kinetics.SbmlKinetics;
import lcsb.mapviewer.model.map.kinetics.SbmlParameter;
import lcsb.mapviewer.model.map.model.ModelFullIndexed;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.reaction.type.TriggerReaction;
import lcsb.mapviewer.model.map.species.Species;
......@@ -28,6 +31,22 @@ public class SbmlReactionExporterTest {
assertNotNull(result);
}
@Test
public void testReactionWithKineticsWithoutUnitsToSbml() throws InconsistentModelException {
ModelFullIndexed model = new ModelFullIndexed(null);
SbmlReactionExporter exporter = createExporter(model);
Reaction reaction = new TriggerReaction();
SbmlKinetics kinetics = new SbmlKinetics();
reaction.setKinetics(kinetics);
kinetics.setDefinition("<lambda>" + "<bvar><ci> x </ci></bvar>" + "<bvar><ci> y </ci></bvar>"
+ "<apply><plus/><ci> x </ci><ci> x </ci><cn type=\"integer\"> 2 </cn></apply>" + "</lambda>\n\n");
SbmlParameter parameter = new SbmlParameter("x");
kinetics.addParameter(parameter);
org.sbml.jsbml.Reaction result = exporter.createSbmlElement(reaction);
assertNotNull(result);
}
private SbmlReactionExporter createExporter(ModelFullIndexed model) {
SBMLDocument doc = new SBMLDocument(3, 1);
Model result = doc.createModel(model.getIdModel());
......
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