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

Merge branch '1434-annotations-missing-after-upload' into 'devel_15.1.x'

Resolve "No Protein annotations after uploading the map"

See merge request !1262
parents d57a2953 c681fe1f
Pipeline #36109 passed with stage
in 24 minutes and 42 seconds
image: node
image: node:14
stages:
- build
......
minerva (15.1.2) stable; urgency=medium
* Bug fix: automatic annotations are sometimes missing after project upload
(#1434)
* Bug fix: export to SBML failed if reactant/product line had length=0
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 7 Jan 2021 15:00:00 +0200
minerva (15.1.1) stable; urgency=medium
* Bug fix: export to CD maps with species containing ":" or "." in species id
generated files that could not be opened in CellDesigner (#1363)
......
......@@ -36,7 +36,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi
/**
* Version of the rest API that is supported by this annotator.
*/
static final String SUPPORTED_VERSION = "13.0";
static final String SUPPORTED_VERSION = "13.1";
/**
* Url address of ensembl restful service.
......
......@@ -14,6 +14,8 @@ import lcsb.mapviewer.annotation.AnnotationTestFunctions;
import lcsb.mapviewer.annotation.services.annotators.ElementAnnotator;
import lcsb.mapviewer.common.IProgressUpdater;
import lcsb.mapviewer.model.map.*;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.compartment.SquareCompartment;
import lcsb.mapviewer.model.map.model.*;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.*;
......@@ -49,15 +51,15 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions {
model.addReaction(new Reaction());
Species proteinAlias1 = new GenericProtein("a1");
proteinAlias1.setName("SNCA");
Species protein1 = new GenericProtein("a1");
protein1.setName("SNCA");
Species proteinAlias2 = new GenericProtein("a2");
proteinAlias2.setName("PDK1");
proteinAlias2.addMiriamData(new MiriamData(MiriamRelationType.BQ_BIOL_IS_DESCRIBED_BY, MiriamType.CAS, "c"));
Species protein2 = new GenericProtein("a2");
protein2.setName("PDK1");
protein2.addMiriamData(new MiriamData(MiriamRelationType.BQ_BIOL_IS_DESCRIBED_BY, MiriamType.CAS, "c"));
model.addElement(proteinAlias1);
model.addElement(proteinAlias2);
model.addElement(protein1);
model.addElement(protein2);
modelAnnotator.annotateModel(model, updater, modelAnnotator.createDefaultAnnotatorSchema());
......
......@@ -293,10 +293,14 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
return createStyle(reaction.getLine());
}
private void removeColinearPoints(ReactionGlyph glyph) {
void removeColinearPoints(ReactionGlyph glyph) {
PolylineData line = createLine(glyph.getCurve());
line = PolylineDataFactory.removeCollinearPoints(line);
Curve curve = createCurve(line, false, (int) glyph.getCurve().getCurveSegment(0).getStart().getZ());
int z = 0;
if (glyph.getCurve().getCurveSegmentCount() > 0) {
z = (int) glyph.getCurve().getCurveSegment(0).getStart().getZ();
}
Curve curve = createCurve(line, false, z);
glyph.setCurve(curve);
}
......
......@@ -81,4 +81,16 @@ public class SbmlReactionExporterTest {
return exporter;
}
@Test
public void removeColinearPointsForEmptyLine() throws InconsistentModelException {
ModelFullIndexed model = new ModelFullIndexed(null);
SbmlReactionExporter exporter = createExporter(model);
ReactionGlyph glyph = new ReactionGlyph("id", 3, 2);
glyph.setReaction("r_id");
glyph.setCurve(new Curve());
exporter.removeColinearPoints(glyph);
assertNotNull(glyph.getCurve());
}
}
......@@ -189,7 +189,7 @@ public class ModelService implements IModelService {
@Override
public void removeModelFromCache(Model model) {
models.remove(model.getProject().getProjectId());
removeModelFromCacheByProjectId(model.getProject().getProjectId());
}
......@@ -219,11 +219,26 @@ public class ModelService implements IModelService {
@Override
public void removeModelFromCache(ModelData model) {
models.remove(model.getProject().getProjectId());
removeModelFromCacheByProjectId(model.getProject().getProjectId());
}
@Override
public void removeModelFromCacheByProjectId(String projectId) {
boolean waitForModel = false;
do {
synchronized (modelsInLoadStage) {
waitForModel = modelsInLoadStage.contains(projectId);
}
// if model is being loaded then wait until it's loaded
if (waitForModel) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
logger.fatal(e, e);
}
}
} while (waitForModel);
models.remove(projectId);
}
......
......@@ -425,6 +425,7 @@ public class ProjectService implements IProjectService {
// new session for db connection
dbUtils.createSessionForCurrentThread();
}
modelService.removeModelFromCacheByProjectId(params.getProjectId());
modelService.getLastModelByProjectId(params.getProjectId());
} finally {
if (params.isAsync()) {
......
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