Commit 6ca0573d authored by Piotr Gawron's avatar Piotr Gawron

Merge branch '1055-copasi-does-not-preserve-elements-shape' into 'master'

Resolve "COPASI does not preserve elements shape"

Closes #1055

See merge request !1282
parents 8ab015f3 32db43a5
Pipeline #38542 failed with stage
in 31 minutes and 14 seconds
......@@ -15,6 +15,9 @@ minerva (16.0.0~alpha.1) stable; urgency=medium
(#1376)
* Small improvement: context menu exporting map is more precise about scope
(#1447)
* Small improvement: styling of GENERIC search tab title improved (#1364)
* Small improvement: SBML render contains information about species shapes
(#1055)
* Bug fix: refreshing page after removing last project on the page redirect to
proper page (#1051)
* Bug fix: removing plugin that does not exist anymore does not raise an error
......
......@@ -54,7 +54,9 @@ public class SbmlExporter {
return stream.toString("UTF-8")
// TODO bug: https://github.com/sbmlteam/jsbml/issues/158
.replace("<listOfSpeciesFeatures>", "<multi:listOfSpeciesFeatures>")
.replace("</listOfSpeciesFeatures>", "</multi:listOfSpeciesFeatures>");
.replace("</listOfSpeciesFeatures>", "</multi:listOfSpeciesFeatures>")
//TODO bug: https://github.com/sbmlteam/jsbml/pull/222
.replace("render:basepoint", "render:basePoint");
} catch (UnsupportedEncodingException | XMLStreamException e) {
throw new InvalidStateException(e);
}
......
......@@ -5,7 +5,11 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({ SbmlSpeciesExporterTest.class, SbmlSpeciesParserTest.class })
@SuiteClasses({
SbmlSpeciesExporterRenderShapeTest.class,
SbmlSpeciesExporterTest.class,
SbmlSpeciesParserTest.class })
public class AllSbmlSpeciesTests {
}
package lcsb.mapviewer.converter.model.sbml.species;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.sbml.jsbml.ext.render.LocalStyle;
import lcsb.mapviewer.converter.model.sbml.SbmlTestFunctions;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelFullIndexed;
import lcsb.mapviewer.model.map.species.Species;
import lcsb.mapviewer.modelutils.map.ElementUtils;
@RunWith(Parameterized.class)
public class SbmlSpeciesExporterRenderShapeTest extends SbmlTestFunctions {
static Logger logger = LogManager.getLogger();
private Species species;
public SbmlSpeciesExporterRenderShapeTest(String name, Species species) {
this.species = species;
}
SbmlSpeciesExporterTestHelper helper;
@Before
public void setUp() {
helper = new SbmlSpeciesExporterTestHelper();
}
@Parameters(name = "{index} : {0}")
public static Collection<Object[]> data() throws Exception {
Collection<Object[]> data = new ArrayList<Object[]>();
for (Class<?> clazz : new ElementUtils().getAvailableElementSubclasses()) {
if (Species.class.isAssignableFrom(clazz)) {
Species species = (Species) (clazz.getConstructor(String.class).newInstance("s1"));
species.setX(10);
species.setY(20);
species.setWidth(50);
species.setHeight(50);
data.add(new Object[] { species.getClass().getName(), species });
}
}
return data;
}
@Test
public void createModelTest() throws Exception {
Model model = new ModelFullIndexed(null);
model.addElement(species);
SbmlSpeciesExporter exporter = helper.createExporter(model);
LocalStyle style = exporter.createStyle(species);
assertNotNull(style);
assertEquals("Style was not generated without issues", 0, super.getWarnings().size());
}
}
......@@ -4,15 +4,14 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.util.Arrays;
import java.util.Collection;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import org.sbml.jsbml.SBMLDocument;
import lcsb.mapviewer.converter.model.sbml.*;
import lcsb.mapviewer.converter.model.sbml.compartment.SbmlCompartmentExporter;
import lcsb.mapviewer.converter.model.sbml.SbmlExtension;
import lcsb.mapviewer.converter.model.sbml.SbmlTestFunctions;
import lcsb.mapviewer.model.map.InconsistentModelException;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.model.Model;
......@@ -24,7 +23,12 @@ public class SbmlSpeciesExporterTest extends SbmlTestFunctions {
Logger logger = LogManager.getLogger();
org.sbml.jsbml.Model sbmlModel;
SbmlSpeciesExporterTestHelper helper;
@Before
public void setUp() {
helper = new SbmlSpeciesExporterTestHelper();
}
@Test
public void testOneElementWithTwoAliases() throws InconsistentModelException {
......@@ -34,11 +38,11 @@ public class SbmlSpeciesExporterTest extends SbmlTestFunctions {
model.addElement(protein1);
model.addElement(protein2);
SbmlSpeciesExporter exporter = createExporter(model);
SbmlSpeciesExporter exporter = helper.createExporter(model);
exporter.exportElements();
assertEquals(1, sbmlModel.getSpeciesCount());
assertEquals(1, helper.sbmlModel.getSpeciesCount());
}
@Test
......@@ -54,31 +58,11 @@ public class SbmlSpeciesExporterTest extends SbmlTestFunctions {
model.addElement(protein2);
model.addElement(compartment);
SbmlSpeciesExporter exporter = createExporter(model);
SbmlSpeciesExporter exporter = helper.createExporter(model);
exporter.exportElements();
assertEquals(2, sbmlModel.getSpeciesCount());
}
private SbmlSpeciesExporter createExporter(Model model) throws InconsistentModelException {
return createExporter(model, Arrays.asList(new SbmlExtension[] { SbmlExtension.RENDER, SbmlExtension.LAYOUT }));
}
private SbmlSpeciesExporter createExporter(Model model, Collection<SbmlExtension> sbmlExtensions)
throws InconsistentModelException {
SBMLDocument doc = new SBMLDocument(3, 1);
sbmlModel = doc.createModel(model.getIdModel());
SbmlExporter sbmlExporter = new SbmlExporter();
sbmlExporter.createSbmlLayout(model, sbmlModel);
SbmlCompartmentExporter compartmentExporter = new SbmlCompartmentExporter(sbmlModel, model,
Arrays.asList(SbmlExtension.values()));
compartmentExporter.exportElements();
SbmlSpeciesExporter result = new SbmlSpeciesExporter(sbmlModel, model, sbmlExtensions, compartmentExporter);
return result;
assertEquals(2, helper.sbmlModel.getSpeciesCount());
}
@Test
......@@ -92,7 +76,7 @@ public class SbmlSpeciesExporterTest extends SbmlTestFunctions {
model.addElement(protein1);
model.addElement(protein2);
SbmlSpeciesExporter exporter = createExporter(model, Arrays.asList(SbmlExtension.values()));
SbmlSpeciesExporter exporter = helper.createExporter(model, Arrays.asList(SbmlExtension.values()));
assertFalse(exporter.getSbmlIdKey(protein1).equals(exporter.getSbmlIdKey(protein2)));
}
......
package lcsb.mapviewer.converter.model.sbml.species;
import java.util.Arrays;
import java.util.Collection;
import org.sbml.jsbml.SBMLDocument;
import lcsb.mapviewer.converter.model.sbml.SbmlExporter;
import lcsb.mapviewer.converter.model.sbml.SbmlExtension;
import lcsb.mapviewer.converter.model.sbml.compartment.SbmlCompartmentExporter;
import lcsb.mapviewer.model.map.InconsistentModelException;
import lcsb.mapviewer.model.map.model.Model;
public class SbmlSpeciesExporterTestHelper {
org.sbml.jsbml.Model sbmlModel;
public SbmlSpeciesExporter createExporter(Model model, Collection<SbmlExtension> sbmlExtensions)
throws InconsistentModelException {
SBMLDocument doc = new SBMLDocument(3, 1);
sbmlModel = doc.createModel(model.getIdModel());
SbmlExporter sbmlExporter = new SbmlExporter();
sbmlExporter.createSbmlLayout(model, sbmlModel);
SbmlCompartmentExporter compartmentExporter = new SbmlCompartmentExporter(sbmlModel, model,
Arrays.asList(SbmlExtension.values()));
compartmentExporter.exportElements();
SbmlSpeciesExporter result = new SbmlSpeciesExporter(sbmlModel, model, sbmlExtensions, compartmentExporter);
return result;
}
public SbmlSpeciesExporter createExporter(Model model) throws InconsistentModelException {
return createExporter(model, Arrays.asList(new SbmlExtension[] { SbmlExtension.RENDER, SbmlExtension.LAYOUT }));
}
}
......@@ -35,9 +35,10 @@ function GenericSearchPanel(params) {
params["placeholder"] = "keyword";
AbstractDbPanel.call(self, params);
self.getControlElement(PanelControlElementType.SEARCH_LABEL).innerHTML = "SEARCH IN CONTENT:";
$(params.element).addClass("minerva-generic-search-panel");
$(".minerva-generic-search-tab-link").css("border-top-color", "white");
self.createSearchGui();
self.getMap().addListener("onBioEntityClick", function (e) {
......
......@@ -192,7 +192,7 @@ LeftPanel.prototype.showElementDetails = function (element) {
openTabName = undefined;
}
if (element !== undefined && openTabName !== undefined && (openTabName.indexOf("SEARCH") === -1 || searchTabName !== "GENERIC")) {
if (element !== undefined && openTabName !== undefined && (openTabName.indexOf("SEARCH") === -1 || searchTabName !== "CONTENT")) {
var model = self.getMap().getSubmapById(element.getModelId()).getModel();
var bioEntity;
return model.getByIdentifiedElement(element, true).then(function (result) {
......
......@@ -57,7 +57,7 @@ SearchPanel.prototype._createPanelGui = function () {
*/
SearchPanel.prototype.getPanelsDefinition = function () {
return [{
name: "GENERIC",
name: "CONTENT",
panelClass: GenericSearchPanel,
linkClassName: "minerva-generic-search-tab-link",
options: {parent: this}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment