From 61ad8af9ac40d8b680b2ac5174296dbf2c47dce2 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Fri, 4 Jan 2019 15:52:53 +0100 Subject: [PATCH] export/import of activity proerty implemented --- .../sbml/extension/multi/BioEntityFeature.java | 3 +++ .../model/sbml/species/SbmlSpeciesExporter.java | 9 +++++++++ .../model/sbml/species/SbmlSpeciesParser.java | 14 ++++++++++++++ .../sbml/ElementPropertiesExportToMultiTest.java | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/extension/multi/BioEntityFeature.java b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/extension/multi/BioEntityFeature.java index a1b95b4d59..42425defdf 100644 --- a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/extension/multi/BioEntityFeature.java +++ b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/extension/multi/BioEntityFeature.java @@ -26,6 +26,9 @@ public enum BioEntityFeature { HYPOTHETICAL("Hypothetical", null, new Class<?>[] { Element.class }, "minerva_hypothetical_"), + ACTIVITY("Activity", null, new Class<?>[] { Element.class }, + "minerva_activity_"), + DIMER("Dimer", null, new Class<?>[] { Element.class }, "minerva_dimer_"), diff --git a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java index cb70338973..6215374c9d 100644 --- a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java +++ b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesExporter.java @@ -109,6 +109,7 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j assignHypotheticalToMulti(element, multiExtension, speciesType); assignAbbreviationToMulti(element, multiExtension, speciesType); assignChargeToMulti(element, multiExtension, speciesType); + assignActivityToMulti(element, multiExtension, speciesType); } private void assignElementModificationResiduesToMulti(Species element, MultiSpeciesPlugin multiExtension, @@ -323,6 +324,14 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j } } + private void assignActivityToMulti(Species element, MultiSpeciesPlugin multiExtension, + MultiSpeciesType speciesType) { + if (element.getActivity() != null) { + assignValueToFeature(element, multiExtension, speciesType, element.getActivity().toString(), + BioEntityFeature.ACTIVITY); + } + } + private void assignAbbreviationToMulti(Species element, MultiSpeciesPlugin multiExtension, MultiSpeciesType speciesType) { assignValueToFeature(element, multiExtension, speciesType, element.getAbbreviation(), diff --git a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java index 468348e344..d458857d6d 100644 --- a/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java +++ b/converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/species/SbmlSpeciesParser.java @@ -209,6 +209,20 @@ public class SbmlSpeciesParser extends SbmlElementParser<org.sbml.jsbml.Species> } minervaElement.setHypothetical(value); } + } else if (MultiPackageNamingUtils.isFeatureId(featureTypeString, BioEntityFeature.ACTIVITY)) { + if (featureValues.size() != 1) { + logger.warn(warnPrefix + "Activity 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 + "Activity must be true/false value. Found: " + featureValues.get(0)); + } + minervaElement.setActivity(value); + } } else if (MultiPackageNamingUtils.isModificationFeatureId(featureTypeString)) { createModificationResidues(minervaElement, speciesType, feature); } else { diff --git a/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/ElementPropertiesExportToMultiTest.java b/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/ElementPropertiesExportToMultiTest.java index ea0af3d658..d9bdefc238 100644 --- a/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/ElementPropertiesExportToMultiTest.java +++ b/converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/ElementPropertiesExportToMultiTest.java @@ -68,6 +68,10 @@ public class ElementPropertiesExportToMultiTest { element.setHypothetical(true); data.add(createTestEntry("Hypothetical", element)); + element = createElement(); + element.setActivity(true); + data.add(createTestEntry("Activity", element)); + element = createElement(); element.setSymbol("H2O"); data.add(createTestEntry("Symbol", element)); -- GitLab