Commit 23e33396 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge remote-tracking branch 'origin/master' into...

Merge remote-tracking branch 'origin/master' into 1199-modifier-boolean-reaction-not-exported-to-sbml
parents 18996253 80e5f08b
Pipeline #26683 passed with stage
in 11 minutes and 15 seconds
......@@ -25,6 +25,8 @@ minerva (15.0.0~beta.4) unstable; urgency=medium
* Bug fix: Select annotation dialog width is at least 840px (#1210)
* Bug fix: modifiers joined by operator were exported to SBML without line
corresponding to the operator (#1199)
* Bug fix: first state variable that does not match modification residue is
translated to structural state when importing from SBGNML (#1088)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 12 May 2020 15:00:00 +0200
......
......@@ -756,15 +756,22 @@ public class SbgnmlXmlParser {
for (Glyph child : children) {
if (GlyphClazz.fromClazz(child.getClazz()).equals(GlyphClazz.STATE_VARIABLE)) {
if (child.getState() == null || child.getState().getVariable() != null) {
boolean canAssignStructuralState = false;
if (newSpecies instanceof Protein || newSpecies instanceof Complex) {
if (newSpecies.getStructuralState() == null) {
canAssignStructuralState = true;
}
}
Residue residue = stateVariableToResidue(child);
if (residue != null) {
if (residue != null && (!canAssignStructuralState || residue.getState() != null
|| (child.getState() == null || child.getState().getValue() == null))) {
// if (residue != null) {
if (newSpecies instanceof Protein) {
((Protein) newSpecies).addResidue(residue);
} else if (newSpecies instanceof Complex) {
StructuralState state = createStructuralState(child);
if (state != null) {
Complex complex = (Complex) newSpecies;
complex.setStructuralState(state);
newSpecies.setStructuralState(state);
}
} else {
logger.warn(new SbgnLogMarker(ProjectLogEntryType.PARSING_ISSUE, child, model),
......@@ -773,11 +780,8 @@ public class SbgnmlXmlParser {
} else {
StructuralState state = createStructuralState(child);
if (state != null) {
if (newSpecies instanceof Protein) {
((Protein) newSpecies).setStructuralState(state);
} else if (newSpecies instanceof Complex) {
Complex complex = (Complex) newSpecies;
complex.setStructuralState(state);
if (newSpecies instanceof Protein || newSpecies instanceof Complex) {
newSpecies.setStructuralState(state);
} else {
logger.warn(new SbgnLogMarker(ProjectLogEntryType.PARSING_ISSUE, child, model),
"Only macromolecule elements can have state.");
......
......@@ -260,6 +260,17 @@ public class SbgnmlXmlParserTest2 extends SbgnmlTestFunctions {
}
@Test
public void testStateWithInvalidType() throws Exception {
Converter converter = new SbgnmlXmlConverter();
Model model = converter.createModel(
new ConverterParams().filename("testFiles/sbgnmlParserTestFiles/sbgnmlFiles/state_with_invalid_type.sbgn"));
Species species = model.getSpeciesList().get(0);
assertNotNull(species.getStructuralState());
}
@Test
public void testReactionWithoutPort() throws Exception {
Converter converter = new SbgnmlXmlConverter();
......
......@@ -16,7 +16,7 @@
</glyph>
<glyph class="state variable" id="glyph11">
<state value="var" variable="val"/>
<bbox x="100" y="0" w="60" h="40"/>
<bbox x="0" y="10" w="81" h="20"/>
</glyph>
</glyph>
......@@ -52,7 +52,7 @@
</glyph>
<glyph class="state variable" id="glyph15">
<state value="var" variable="val"/>
<bbox x="540" y="0" w="60" h="40"/>
<bbox x="540" y="10" w="81" h="20"/>
</glyph>
</glyph>
......
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<sbgn xmlns="http://sbgn.org/libsbgn/0.2">
<map language="process description">
<glyph id="nwtN_1971d320-1063-48cd-bf7f-9e1d45890b30" class="macromolecule">
<label text="SNCA"/>
<bbox x="870.5080167238589" y="379" w="237.05288937425868" h="46.57516411163276"/>
<glyph id="nwtSV_59a9944c-73bc-46f1-854d-724b1e3a400f" class="state variable">
<state value="ABC" variable="XYZ123"/>
<bbox x="1020" y="369" w="110" h="20"/>
</glyph>
<glyph id="nwtUOI_727eae1f-daf3-4346-9fde-d2199529354e" class="unit of information">
<label text="there-is-information"/>
<bbox x="1035.854012111548" y="420.57516411163266" w="48" h="20"/>
</glyph>
</glyph>
</map>
</sbgn>
\ No newline at end of file
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