Commit 79e345e9 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

import of structural state check if data is not null

parent ef19828d
...@@ -11,6 +11,8 @@ minerva (15.0.0~alpha.1) stable; urgency=medium ...@@ -11,6 +11,8 @@ minerva (15.0.0~alpha.1) stable; urgency=medium
exporter violates SBGN specification (#707) exporter violates SBGN specification (#707)
* Bug fix: unknown catalysis boolean gate modifiers in CellDesigner are * Bug fix: unknown catalysis boolean gate modifiers in CellDesigner are
visualized with proper line type across all included modifiers (#957) visualized with proper line type across all included modifiers (#957)
* Bug fix: dimension of the modifications is the same as in minerva when
exporting to SBGNML-PD (#554)
minerva (15.0.0~alpha.0) stable; urgency=medium minerva (15.0.0~alpha.0) stable; urgency=medium
* Improvement: logs provided for validation data model are structurized (#325) * Improvement: logs provided for validation data model are structurized (#325)
......
...@@ -4,15 +4,14 @@ import java.awt.Color; ...@@ -4,15 +4,14 @@ import java.awt.Color;
import java.awt.geom.Line2D; import java.awt.geom.Line2D;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.List;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.sbgn.*; import org.sbgn.*;
import org.sbgn.bindings.*; import org.sbgn.bindings.*;
import org.sbgn.bindings.Arc.*; import org.sbgn.bindings.Arc.*;
import org.sbgn.bindings.Map;
import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.comparator.DoubleComparator; import lcsb.mapviewer.common.comparator.DoubleComparator;
...@@ -80,6 +79,8 @@ public class SbgnmlXmlParser { ...@@ -80,6 +79,8 @@ public class SbgnmlXmlParser {
*/ */
private List<Arc> logicArcs = new ArrayList<Arc>(); private List<Arc> logicArcs = new ArrayList<Arc>();
Model model;
/** /**
* Method used to create a model from SBGN-ML file. * Method used to create a model from SBGN-ML file.
* *
...@@ -94,7 +95,7 @@ public class SbgnmlXmlParser { ...@@ -94,7 +95,7 @@ public class SbgnmlXmlParser {
*/ */
public Model createModel(String filename, File inputSbgnmlFile) throws InvalidInputDataExecption { public Model createModel(String filename, File inputSbgnmlFile) throws InvalidInputDataExecption {
Model model = new ModelFullIndexed(null); model = new ModelFullIndexed(null);
model.setIdModel(filename); model.setIdModel(filename);
Sbgn sbgnData; Sbgn sbgnData;
...@@ -598,7 +599,7 @@ public class SbgnmlXmlParser { ...@@ -598,7 +599,7 @@ public class SbgnmlXmlParser {
logger.warn("Only macromolecule elements can have state variables."); logger.warn("Only macromolecule elements can have state variables.");
} }
} else { } else {
StructuralState state = stateVariableToStructuralState(child); StructuralState state = createStructuralState(child);
if (newSpecies instanceof Protein) { if (newSpecies instanceof Protein) {
((Protein) newSpecies).setStructuralState(state); ((Protein) newSpecies).setStructuralState(state);
} else { } else {
...@@ -625,21 +626,12 @@ public class SbgnmlXmlParser { ...@@ -625,21 +626,12 @@ public class SbgnmlXmlParser {
} }
private StructuralState stateVariableToStructuralState(Glyph glyph) {
StructuralState state = new StructuralState();
state.setFontSize(10);
state.setPosition(new Point2D.Double(glyph.getBbox().getX(), glyph.getBbox().getY()));
state.setHeight((double) glyph.getBbox().getH());
state.setWidth((double) glyph.getBbox().getW());
if (glyph.getState() != null) {
state.setValue(glyph.getState().getValue());
}
return state;
}
private StructuralState createStructuralState(Glyph glyph) { private StructuralState createStructuralState(Glyph glyph) {
if (glyph.getState() == null || glyph.getState().getValue() == null) {
logger.warn(new LogMarker(ProjectLogEntryType.PARSING_ISSUE, glyph.getId(), "state", model.getName()),
"Invalid structural state");
return null;
}
StructuralState structuralState = new StructuralState(); StructuralState structuralState = new StructuralState();
double height = new Double(glyph.getBbox().getH()); double height = new Double(glyph.getBbox().getH());
......
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