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

import of stimulation modifiers crashed minerva

parent b4df7d8d
minerva (14.0.8) stable; urgency=medium
* Bug fix: API didn't allow to upload pluins with local url (#1084,
* Bug fix: API didn't allow to upload pluins with local url (#1084,
regression 14.0.7)
* Bug fix: upload of data overlay with two entries having different uniprot
identifier but pointing to the same gene crashed (#1083)
* Bug fix: don't allow to remove plugin twice (#1081)
* Bug fix: upload of SBML file with very short reaction length could produce
a map that couldn't be exported to SBML anymore (#1078)
* Bug fix: import of structural state from SBGN-ML PD that cannot be
* Bug fix: import of structural state from SBGN-ML PD that cannot be
normalized to residue is changed into structural state without losing
information (#1062)
* Bug fix: import of stimulation modifiers from SBGN-ML crashed converter
(#1063)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 23 Jan 2020 12:00:00 +0200
......
......@@ -4,14 +4,14 @@ import java.awt.Color;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.sbgn.*;
import org.sbgn.bindings.*;
import org.sbgn.bindings.Arc.*;
import org.sbgn.bindings.Map;
import lcsb.mapviewer.common.comparator.DoubleComparator;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
......@@ -390,8 +390,9 @@ public class SbgnmlXmlParser {
* arc to be parsed
* @param model
* model to be updated
* @throws InvalidInputDataExecption
*/
private void parseArc(Arc a, Model model) {
private void parseArc(Arc a, Model model) throws InvalidInputDataExecption {
switch (ArcClazz.fromClazz(a.getClazz())) {
case CONSUMPTION:
Port arcTargetPort = (Port) a.getTarget();
......@@ -422,35 +423,56 @@ public class SbgnmlXmlParser {
case MODULATION:
case NECESSARY_STIMULATION:
case STIMULATION:
Glyph targetGlyph = (Glyph) a.getTarget();
if (GlyphClazz.fromClazz(targetGlyph.getClazz()).equals(GlyphClazz.PHENOTYPE)) {
if (!(a.getSource() instanceof Glyph)) {
logger.warn("Invalid phenotype arc: " + a.getId());
break;
}
try {
parsePhenotypeArc(a, model);
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
break;
}
if (a.getSource() instanceof Glyph) {
Glyph sourceGlyph = (Glyph) a.getSource();
if (GlyphClazz.fromClazz(sourceGlyph.getClazz()).equals(GlyphClazz.PHENOTYPE)
&& (model.getElementByElementId(targetGlyph.getId()) instanceof Species)) {
if (a.getTarget() instanceof Glyph) {
Glyph targetGlyph = (Glyph) a.getTarget();
if (GlyphClazz.fromClazz(targetGlyph.getClazz()).equals(GlyphClazz.PHENOTYPE)) {
if (!(a.getSource() instanceof Glyph)) {
logger.warn("Invalid phenotype arc: " + a.getId());
break;
}
try {
parsePhenotypeArc(a, model);
} catch (InvalidArgumentException ex) {
logger.warn("The arc " + a.getId() + " of class " + a.getClazz() + " is not a valid reduced notation arc.");
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
break;
}
}
for (Process p : processes) {
if (p.getCentralPoint().getId().equals(targetGlyph.getId())) {
p.addInfluenceArc(a);
break;
if (a.getSource() instanceof Glyph) {
Glyph sourceGlyph = (Glyph) a.getSource();
if (GlyphClazz.fromClazz(sourceGlyph.getClazz()).equals(GlyphClazz.PHENOTYPE)
&& (model.getElementByElementId(targetGlyph.getId()) instanceof Species)) {
try {
parsePhenotypeArc(a, model);
} catch (InvalidArgumentException ex) {
logger
.warn("The arc " + a.getId() + " of class " + a.getClazz() + " is not a valid reduced notation arc.");
}
break;
}
}
for (Process p : processes) {
if (p.getCentralPoint().getId().equals(targetGlyph.getId())) {
p.addInfluenceArc(a);
break;
}
}
} else {
Port targetPort = (Port) a.getTarget();
boolean found = false;
for (Process p : processes) {
Set<String> ids = new HashSet<>();
ids.add(p.getCentralPoint().getId());
for (Port port : p.getCentralPoint().getPort()) {
ids.add(port.getId());
}
if (ids.contains(targetPort.getId())) {
p.addInfluenceArc(a);
found = true;
break;
}
}
if (!found) {
throw new InvalidInputDataExecption("Problem with processing arc: " + a.getId());
}
}
break;
......@@ -1180,6 +1202,7 @@ public class SbgnmlXmlParser {
throw new InvalidArgumentException(
p.getCentralPoint().getId() + ": The process must have at least one outgoing arc.");
}
p.setProductsPort((Port) p.getProductArcs().get(0).getSource());
for (Arc productArc : p.getProductArcs()) {
if (!((Port) productArc.getSource()).equals(p.getProductsPort())) {
......
Supports Markdown
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