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

fix on kinetics in reactions with complex modifiers

parent 475c4384
No related branches found
No related tags found
1 merge request!186Resolve "upload of sbml"
......@@ -55,15 +55,18 @@ public class KineticsXmlParser extends XmlParser {
if (element == null) {
element = model.getFunctionById(id);
}
if (element == null) {
element = model.getElementByElementId(id);
}
if (element != null) {
ciNode.setTextContent(element.getElementId());
} else {
elementsUsedInKinetics.add(element);
} else if (!id.equals("default")) {
throw new InvalidXmlSchemaException("Unknown symbol in kinetics: " + id);
}
elementsUsedInKinetics.add(element);
}
result.addArguments(elementsUsedInKinetics);
String definition = super.nodeToString(mathNode, true);
definition = definition.replace(" xmlns=\"http://www.sbml.org/sbml/level2/version4\"", "");
definition = definition.replace("<math>", "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">");
......
......@@ -233,20 +233,30 @@ public class ReactionFromXml extends XmlParser {
String aliasId = super.getNodeAttr("alias", node);
addElementMapping(model, result, speciesId, aliasId);
}
for (Node node : super.getAllNotNecessirellyDirectChild("celldesigner:productLink", annotationNode)) {
String speciesId = super.getNodeAttr("product", node);
String aliasId = super.getNodeAttr("alias", node);
addElementMapping(model, result, speciesId, aliasId);
}
for (Node node : super.getAllNotNecessirellyDirectChild("celldesigner:modification", annotationNode)) {
String speciesId = super.getNodeAttr("modifiers", node);
String aliasId = super.getNodeAttr("aliases", node);
addElementMapping(model, result, speciesId, aliasId);
}
return result;
}
private void addElementMapping(Model model, Map<String, Element> result, String speciesId, String aliasId) {
Element element = model.getElementByElementId(aliasId);
result.put(speciesId, element);
addCompartmentMapping(result, element);
String[] aliasIds = aliasId.split(",");
String[] speciesIds = speciesId.split(",");
for (int i = 0; i < aliasIds.length; i++) {
Element element = model.getElementByElementId(aliasIds[i]);
result.put(speciesIds[i], element);
addCompartmentMapping(result, element);
}
}
private void addCompartmentMapping(Map<String, Element> result, Element element) {
......
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