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

export/import of charge implemented

parent 2e3ca9ce
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"
......@@ -29,6 +29,9 @@ public enum BioEntityFeature {
DIMER("Dimer", null, new Class<?>[] { Element.class },
"minerva_dimer_"),
CHARGE("Charge", null, new Class<?>[] { Element.class },
"minerva_charge_"),
ABBREVIATION("Abbreviation", null, new Class<?>[] { Element.class },
"minerva_abbreviation_"),
......
......@@ -106,6 +106,7 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
assignDimerToMulti(element, multiExtension, speciesType);
assignHypotheticalToMulti(element, multiExtension, speciesType);
assignAbbreviationToMulti(element, multiExtension, speciesType);
assignChargeToMulti(element, multiExtension, speciesType);
}
private void assignElementModificationResiduesToMulti(Species element, MultiSpeciesPlugin multiExtension,
......@@ -305,6 +306,13 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
}
}
private void assignChargeToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
if (element.getCharge() != null) {
assignValueToFeature(element, multiExtension, speciesType, element.getCharge().toString(), BioEntityFeature.CHARGE);
}
}
private void assignHypotheticalToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
if (element.getHypothetical() != null) {
......
......@@ -86,6 +86,9 @@ public class SbmlSpeciesParser extends SbmlElementParser<org.sbml.jsbml.Species>
if (species.isSetConstant()) {
result.setConstant(species.getConstant());
}
if (species.isSetCharge()) {
result.setCharge(species.getCharge());
}
assignBioEntityData(species, result);
if (getLayout() == null) {
assignCompartment(result, species.getCompartment());
......@@ -157,6 +160,16 @@ public class SbmlSpeciesParser extends SbmlElementParser<org.sbml.jsbml.Species>
logger.warn(warnPrefix + "Dimer must have integer value, instead found: " + featureValues.get(0));
}
}
} else if (MultiPackageNamingUtils.isFeatureId(featureTypeString, BioEntityFeature.CHARGE)) {
if (featureValues.size() != 1) {
logger.warn(warnPrefix + "Charge must have exactly one value");
} else {
try {
minervaElement.setCharge(Integer.parseInt(featureValues.get(0)));
} catch (NumberFormatException e) {
logger.warn(warnPrefix + "Charge must have integer value, instead found: " + featureValues.get(0));
}
}
} else if (MultiPackageNamingUtils.isFeatureId(featureTypeString, BioEntityFeature.SYMBOL)) {
if (featureValues.size() != 1) {
logger.warn(warnPrefix + "Symbol must have exactly one value");
......
......@@ -60,6 +60,10 @@ public class ElementPropertiesExportToMultiTest {
element.setHomodimer(4);
data.add(createTestEntry("Homodimer", element));
element = createElement();
element.setCharge(5);
data.add(createTestEntry("Charge", element));
element = createElement();
element.setHypothetical(true);
data.add(createTestEntry("Hypothetical", 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