Commit c82c2cf4 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge remote-tracking branch 'origin/devel_16.0.x' into 1617-export-to-sbml

parents 4e8fff4e d0862f1f
Pipeline #51101 failed with stage
in 16 minutes and 10 seconds
minerva (16.0.6) stable; urgency=medium
* Bug fix (performance): fetching all bioEntities using plugin API is faster;
reactions and elements are fetched in parallel (#1605)
* Bug fix (performance): showing data overlay is faster on projects with
multiple maps
* Bug fix (performance): postgres database is vacuumed every night at 2:15 to
improve performance (#1589)
* Bug fix: REST API did not respect mapId when listing overlay elements in a
project
* Bug fix: log4j2 updated to address security issue CVE-2021-44832
* Bug fix: multiple conversion between formats SBGN->SBML->SBGN->SBML could
crash if in the meantime there were additional elements added (#1617)
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>CellDesigner-plugin</artifactId>
<!-- dependency from the MapViewer model -->
......@@ -50,19 +50,19 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>commons</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>annotation</artifactId>
<name>Annotation module</name>
......@@ -18,7 +18,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<!-- dependency from the MapViewer dao -->
......@@ -26,7 +26,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<!-- dependency from the MapViewer cell designer parser (we need access
......@@ -34,13 +34,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>commons</artifactId>
<name>Mapviewer commons</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>converter-CellDesigner</artifactId>
<name>CellDesigner converter</name>
......@@ -17,13 +17,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>converter-SBGNML</artifactId>
......@@ -20,26 +20,26 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>converter-graphics</artifactId>
<name>MapViewer graphics converter</name>
......@@ -18,13 +18,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<!-- Log4J2-->
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>converter-sbml</artifactId>
<name>converter-sbml</name>
......@@ -40,22 +40,22 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<!-- Log4J2 -->
......@@ -154,7 +154,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
<scope>test</scope>
</dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>converter</artifactId>
......@@ -15,7 +15,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
......
package lcsb.mapviewer.converter;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.awt.Color;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.TextFileUtils;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.overlay.*;
import lcsb.mapviewer.model.overlay.DataOverlayEntry;
import lcsb.mapviewer.model.overlay.GeneVariant;
import lcsb.mapviewer.model.overlay.GeneVariantDataOverlayEntry;
import lcsb.mapviewer.model.overlay.InvalidDataOverlayException;
public class ColorSchemaReaderTest extends ConverterTestFunctions {
Logger logger = LogManager.getLogger();
......@@ -76,7 +92,7 @@ public class ColorSchemaReaderTest extends ConverterTestFunctions {
assertEquals(1, schemas.size());
}
private byte[] fileToByteArray(File f) throws FileNotFoundException, IOException {
private byte[] fileToByteArray(final File f) throws FileNotFoundException, IOException {
InputStream in = new FileInputStream(f);
byte[] buff = new byte[8000];
......@@ -282,7 +298,7 @@ public class ColorSchemaReaderTest extends ConverterTestFunctions {
for (DataOverlayEntry colorSchema : schemas) {
for (MiriamData md : colorSchema.getMiriamData()) {
assertFalse(md.getResource().isEmpty());
assertNull(colorSchema.getName());
assertEquals("", colorSchema.getName());
}
}
}
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.5</version>
<version>16.0.6</version>
</parent>
<artifactId>frontend-js</artifactId>
<name>frontend-js</name>
......
......@@ -1922,25 +1922,45 @@ ServerConnector.getOverlayElements = function (overlayId, projectId) {
if (overlayId === undefined) {
throw new Error("Overlay id must be defined");
}
var queryParams = {
overlayId: overlayId,
modelId: "*"
};
var filterParams = {};
var modelIds = ["*"];
return self.getProjectId(projectId).then(function (result) {
queryParams.projectId = result;
return self.sendGetRequest(self.getOverlayElementsUrl(queryParams, filterParams));
}).then(function (content) {
var arr = JSON.parse(content);
var queryParams = {
overlayId: overlayId,
projectId: result,
modelId: "*"
};
if (self.getSessionData().getProject()!==null) {
modelIds = [];
var project = self.getSessionData().getProject();
for (var i=0;i< project.getModels().length;i++) {
modelIds.push(project.getModels()[i].getId());
}
}
console.log(modelIds);
var promises = [];
for (var j=0;j<modelIds.length;j++) {
promises.push(self.sendGetRequest(self.getOverlayElementsUrl({
overlayId: overlayId,
projectId: result,
modelId: modelIds[j]
}, filterParams)));
}
return Promise.all(promises);
}).then(function (contentList) {
var result = [];
for (var i = 0; i < arr.length; i++) {
var element = arr[i];
if (element.type === "REACTION") {
result.push(new LayoutReaction(element.overlayContent));
} else if (element.type === "ALIAS") {
result.push(new LayoutAlias(element.overlayContent));
} else {
throw new Error("Unknown element type: " + element.type);
for (var j=0;j<contentList.length;j++) {
var content = contentList[j];
var arr = JSON.parse(content);
for (var i = 0; i < arr.length; i++) {
var element = arr[i];
if (element.type === "REACTION") {
result.push(new LayoutReaction(element.overlayContent));
} else if (element.type === "ALIAS") {
result.push(new LayoutAlias(element.overlayContent));
} else {
throw new Error("Unknown element type: " + element.type);
}
}
}
return result;
......
......@@ -125,20 +125,22 @@ function MapModel(configuration) {
*/
MapModel.prototype.getAliases = function (params) {
var self = this;
var columns = "id,bounds,modelId,linkedSubmodel";
if (params.complete) {
columns = undefined;
}
return ServerConnector.getAliases({
columns: "id,modelId",
columns: columns,
type: params.type,
modelId: self.getId(),
includedCompartmentIds: params.includedCompartmentIds,
excludedCompartmentIds: params.excludedCompartmentIds
}).then(function (lightAliases) {
var identifiedElements = [];
for (var i = 0; i < lightAliases.length; i++) {
self.addAlias(lightAliases[i]);
identifiedElements.push(new IdentifiedElement(lightAliases[i]));
}).then(function (aliases) {
for (var i = 0; i < aliases.length; i++) {
self.addAlias(aliases[i]);
}
return self.getByIdentifiedElements(identifiedElements, params.complete);
return aliases;
});
};
......@@ -822,6 +824,41 @@ MapModel.prototype.getReactionsForElements = function (elements, complete) {
});
};
/**
*
* @return {Promise}
*/
MapModel.prototype.getReactions = function ( ) {
var self = this;
var result = [];
return ServerConnector.getReactions({
modelId: self.getId()
}).then(function (reactions) {
result = reactions;
for (var i = 0; i < reactions.length; i++) {
var reaction = reactions[i];
var id = reaction.getId();
if (self._reactions[id] === undefined) {
self._reactions[id] = reaction;
} else {
self._reactions[id].update(reaction);
}
}
var ids = self._getMissingReactionsElementIds(reactions);
return self.getMissingElements({
aliasIds: ids,
complete: true
});
}).then(function () {
var promises = [];
for (var i = 0; i < result.length; i++) {
promises.push(self.getCompleteReactionById(result[i].getId()));
}
return Promise.all(promises);
});
};
/**
*
* @returns {Promise}
......
......@@ -598,21 +598,21 @@ Project.prototype.getElementsPointingToSubmap = function (modelId) {
if (self._elementsPointingToSubmap[modelId] !== undefined) {
return Promise.resolve(self._elementsPointingToSubmap[modelId]);
}
var promise = Promise.resolve();
if (self._submapConnections === undefined) {
promise = ServerConnector.getSubmapConnections().then(function (data) {
self._submapConnections = ServerConnector.getSubmapConnections().then(function (data) {
self._submapConnections = data;
return data;
});
}
return promise.then(function () {
return Promise.resolve(self._submapConnections).then(function (data) {
self._elementsPointingToSubmap[modelId] = [];
var queue = [modelId];
while (queue.length > 0) {
var id = queue.shift();
for (var i = 0; i < self._submapConnections.length; i++) {
var connection = self._submapConnections[i];
for (var i = 0; i < data.length; i++) {
var connection = data[i];
if (connection.to === id) {
var elementToAdd = connection.from;
var alreadyAdded = false;
......
......@@ -280,20 +280,12 @@ function createProjectData(options) {
type: map.getConfiguration().getSimpleElementTypeNames(),
complete: true
}));
promises.push(models[i].getReactions());
}
return Promise.all(promises).then(function (aliasesByModel) {
var promises = [];
for (var i = 0; i < models.length; i++) {
promises.push(models[i].getReactionsForElements(aliasesByModel[i], true));
for (var j = 0; j < aliasesByModel[i].length; j++) {
result.push(aliasesByModel[i][j]);
}
}
return Promise.all(promises);
}).then(function (reactionsByModel) {
for (var i = 0; i < models.length; i++) {
for (var j = 0; j < reactionsByModel[i].length; j++) {
result.push(reactionsByModel[i][j]);
return Promise.all(promises).then(function (bioEntitiesLists) {
for (var i = 0; i < bioEntitiesLists.length; i++) {
for (var j = 0; j < bioEntitiesLists[i].length; j++) {
result.push(bioEntitiesLists[i][j]);
}
}
return result;
......
[{"abbreviation":null,"boundaryCondition":null,"bounds":{"height":142.0,"width":144.0,"x":35.0,"y":45.0},"compartmentId":null,"complexId":null,"constant":null,"elementId":"ca1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345323,"initialAmount":null,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"c1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"2","type":"Compartment"},{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":59.0,"y":73.0},"compartmentId":345323,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"2","id":345331,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":16729,"modelId":16728,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"},{"abbreviation":null,"boundaryCondition":null,"bounds":{"height":296.0,"width":291.0,"x":189.0,"y":33.0},"compartmentId":null,"complexId":null,"constant":null,"elementId":"ca2","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345332,"initialAmount":null,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"c2","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"1","type":"Compartment"},{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":356.0,"y":117.0},"compartmentId":345332,"complexId":null,"constant":false,"elementId":"sa3","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"1","id":345333,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"s3","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"},{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":201.0,"y":109.0},"compartmentId":345332,"complexId":null,"constant":false,"elementId":"sa2","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"1","id":345334,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16728,"name":"s2","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"},{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":30.0,"width":80.0,"x":257.0,"y":254.0},"compartmentId":345332,"complexId":null,"constant":false,"elementId":"sa4","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"1","id":345339,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":16731,"modelId":16728,"name":"s4","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Phenotype"}]
\ No newline at end of file
[{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":299.0,"y":152.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa3","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345324,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16729,"name":"x3","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"},{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":148.0,"y":172.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa2","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345325,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16729,"name":"x2","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"},{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":426.0,"y":95.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa4","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345326,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":null,"modelId":16729,"name":"x4","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"},{"abbreviation":null,"boundaryCondition":false,"bounds":{"height":40.0,"width":80.0,"x":65.0,"y":64.0},"compartmentId":null,"complexId":null,"constant":false,"elementId":"sa1","formerSymbols":[],"formula":null,"fullName":null,"hierarchyVisibilityLevel":"0","id":345330,"initialAmount":0.0,"initialConcentration":null,"linkedSubmodel":16730,"modelId":16729,"name":"s1","notes":"","other":{"modifications":[],"structuralState":null,"structures":{}},"references":[],"symbol":null,"synonyms":[],"transparencyLevel":"0","type":"Protein"}]
\ No newline at end of file
[{"centerPoint":{"x":146.50000000000003,"y":138.0},"hierarchyVisibilityLevel":null,"id":161957,"kineticLaw":null,"lines":[{"start":{"x":120.3703703703704,"y":104.0},"end":{"x":144.06257640220798,"y":134.82841266793324},"type":"START"},{"start":{"x":148.93742359779208,"y":141.17158733206676},"end":{"x":172.62962962962965,"y":172.00000000000003},"type":"END"}],"modelId":16729,"modifiers":[],"notes":"","products":[{"aliasId":345325,"stoichiometry":null}],"reactants":[{"aliasId":345330,"stoichiometry":null}],"reactionId":"re3","references":[],"type":"State transition"},{"centerPoint":{"x":222.0,"y":127.99999999999999},"hierarchyVisibilityLevel":null,"id":161956,"kineticLaw":null,"lines":[{"start":{"x":144.9689440993789,"y":99.03105590062111},"end":{"x":218.256,"y":126.59199999999998},"type":"START"},{"start":{"x":225.744,"y":129.408},"end":{"x":299.03105590062114,"y":156.96894409937886},"type":"END"}],"modelId":16729,"modifiers":[],"notes":"","products":[{"aliasId":345324,"stoichiometry":null}],"reactants":[{"aliasId":345330,"stoichiometry":null}],"reactionId":"re2","references":[],"type":"State transition"},{"centerPoint":{"x":285.5,"y":99.5},"hierarchyVisibilityLevel":null,"id":161955,"kineticLaw":null,"lines":[{"start":{"x":145.0,"y":87.43490304709144},"end":{"x":281.5146671306842,"y":99.15776919958783},"type":"START"},{"start":{"x":289.4853328693158,"y":99.84223080041217},"end":{"x":426.0,"y":111.56509695290856},"type":"END"}],"modelId":16729,"modifiers":[],"notes":"","products":[{"aliasId":345326,"stoichiometry":null}],"reactants":[{"aliasId":345330,"stoichiometry":null}],"reactionId":"re1","references":[],"type":"State transition"}]
\ No newline at end of file
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