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

export of position to compartment uses proper names

parent ee3aaf7b
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"
......@@ -8,7 +8,7 @@ public enum BioEntityFeature {
STRUCTURAL_STATE("Structural state", "", new Class<?>[] { Protein.class, Complex.class },
"minerva_structural_state_"),
POSITION_TO_COMPARTMENT("Position to compartment", "undefined", new Class<?>[] { Element.class },
POSITION_TO_COMPARTMENT("Position to compartment", MultiPackageNamingUtils.NULL_REPRESENTATION, new Class<?>[] { Element.class },
"minerva_position_to_compartment_"),
SYNONYM("Synonym", null, new Class<?>[] { Element.class },
......
......@@ -266,9 +266,9 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
private void assignPostionToCompartmentToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
String value = "undefined";
String value = MultiPackageNamingUtils.NULL_REPRESENTATION;
if (element.getPositionToCompartment() != null) {
value = element.getPositionToCompartment().name();
value = element.getPositionToCompartment().getStringName();
}
assignValueToFeature(element, multiExtension, speciesType, value, BioEntityFeature.POSITION_TO_COMPARTMENT);
}
......@@ -289,17 +289,23 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
private void assignSymbolToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
assignValueToFeature(element, multiExtension, speciesType, element.getSymbol(), BioEntityFeature.SYMBOL);
if (element.getSymbol() != null) {
assignValueToFeature(element, multiExtension, speciesType, element.getSymbol(), BioEntityFeature.SYMBOL);
}
}
private void assignFullNameToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
assignValueToFeature(element, multiExtension, speciesType, element.getFullName(), BioEntityFeature.FULL_NAME);
if (element.getFullName() != null) {
assignValueToFeature(element, multiExtension, speciesType, element.getFullName(), BioEntityFeature.FULL_NAME);
}
}
private void assignFormulaToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
assignValueToFeature(element, multiExtension, speciesType, element.getFormula(), BioEntityFeature.FORMULA);
if (element.getFormula() != null) {
assignValueToFeature(element, multiExtension, speciesType, element.getFormula(), BioEntityFeature.FORMULA);
}
}
private void assignDimerToMulti(Species element, MultiSpeciesPlugin multiExtension,
......@@ -335,8 +341,10 @@ public class SbmlSpeciesExporter extends SbmlElementExporter<Species, org.sbml.j
private void assignAbbreviationToMulti(Species element, MultiSpeciesPlugin multiExtension,
MultiSpeciesType speciesType) {
assignValueToFeature(element, multiExtension, speciesType, element.getAbbreviation(),
BioEntityFeature.ABBREVIATION);
if (element.getAbbreviation() != null) {
assignValueToFeature(element, multiExtension, speciesType, element.getAbbreviation(),
BioEntityFeature.ABBREVIATION);
}
}
private void assignValueToFeature(Species element, MultiSpeciesPlugin multiExtension, MultiSpeciesType speciesType,
......
......@@ -467,6 +467,18 @@ public class SbmlExporterTest {
comparator.compare(model, deserializedModel));
}
@Test
public void testExportOuterSurfacePositionToCompartment() throws Exception {
Model model = createEmptyModel();
GenericProtein element = createProtein();
element.setPositionToCompartment(PositionToCompartment.OUTER_SURFACE);
model.addElement(element);
Model deserializedModel = getModelAfterSerializing(model);
assertEquals("Postion to compartment not exported/imported properly", 0,
comparator.compare(model, deserializedModel));
}
@Test
public void testMultiExtensionProteinStateInTypes() throws Exception {
String structuralState = "xxx";
......
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