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

import/export of hypothetical implemented

parent 24c1f8bb
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!560Resolve "add support for modifications and states in sbml export/import"
......@@ -23,6 +23,9 @@ public enum BioEntityFeature {
FORMULA("Formula", null, new Class<?>[] { Element.class },
"minerva_formula_"),
HYPOTHETICAL("Hypothetical", null, new Class<?>[] { Element.class },
"minerva_hypothetical_"),
DIMER("Dimer", null, new Class<?>[] { Element.class },
"minerva_dimer_"),
......
......@@ -104,6 +104,7 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
assignFullNameToMulti(element, multiExtension, speciesType);
assignFormulaToMulti(element, multiExtension, speciesType);
assignDimerToMulti(element, multiExtension, speciesType);
assignHypotheticalToMulti(element, multiExtension, speciesType);
assignAbbreviationToMulti(element, multiExtension, speciesType);
}
......@@ -304,6 +305,14 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
}
}
private void assignHypotheticalToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
if (element.getHypothetical() != null) {
assignValueToFeature(element, multiExtension, speciesType, element.getHypothetical().toString(),
BioEntityFeature.HYPOTHETICAL);
}
}
private void assignAbbreviationToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
assignValueToFeature(element, multiExtension, speciesType, element.getAbbreviation(),
......
......@@ -181,6 +181,20 @@ public class SbmlSpeciesParser extends SbmlElementParser<org.sbml.jsbml.Species>
} else {
minervaElement.setAbbreviation(featureValues.get(0));
}
} else if (MultiPackageNamingUtils.isFeatureId(featureTypeString, BioEntityFeature.HYPOTHETICAL)) {
if (featureValues.size() != 1) {
logger.warn(warnPrefix + "Hypothetical must have exactly one value");
} else {
Boolean value = null;
if (featureValues.get(0).equalsIgnoreCase("true")) {
value = true;
} else if (featureValues.get(0).equalsIgnoreCase("false")) {
value = false;
} else {
logger.warn(warnPrefix + "Hypothetical must be true/false value. Found: " + featureValues.get(0));
}
minervaElement.setHypothetical(value);
}
} else if (MultiPackageNamingUtils.isModificationFeatureId(featureTypeString)) {
createModificationResidues(minervaElement, speciesType, feature);
} else {
......
......@@ -60,6 +60,10 @@ public class ElementPropertiesExportToMultiTest {
element.setHomodimer(4);
data.add(createTestEntry("Homodimer", element));
element = createElement();
element.setHypothetical(true);
data.add(createTestEntry("Hypothetical", element));
element = createElement();
element.setSymbol("H2O");
data.add(createTestEntry("Symbol", 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