Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
e5887345
Commit
e5887345
authored
Jan 24, 2020
by
Piotr Gawron
Browse files
export to SBGN fixed
parent
cbf71479
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
e5887345
...
...
@@ -11,6 +11,8 @@ minerva (14.0.8) stable; urgency=medium
information (#1062)
* Bug fix: import of stimulation modifiers from SBGN-ML crashed converter
(#1063)
* Bug fix: export to SBGN files created from newt source produced corrupted
disconnected reactions
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 23 Jan 2020 12:00:00 +0200
...
...
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java
View file @
e5887345
...
...
@@ -192,7 +192,7 @@ public class SbgnmlXmlExporter {
}
}
sourceTargetMap
.
put
(
newGlyph
.
ge
tId
(),
newGlyph
);
sourceTargetMap
.
put
(
element
.
getElemen
tId
(),
newGlyph
);
return
newGlyph
;
}
...
...
@@ -844,6 +844,7 @@ public class SbgnmlXmlExporter {
if
(!
node
.
getLine
().
getEndAtd
().
getArrowType
().
equals
(
ArrowType
.
NONE
))
{
arc
.
setTarget
(
sourceTargetMap
.
get
(
node
.
getReaction
().
getIdReaction
()));
}
else
{
boolean
found
=
false
;
for
(
NodeOperator
operator
:
node
.
getReaction
().
getOperators
())
{
if
(
operator
.
getInputs
().
contains
(
node
))
{
if
(!
parsedOperators
.
contains
(
operator
))
{
...
...
@@ -851,8 +852,13 @@ public class SbgnmlXmlExporter {
glyphList
.
add
(
newOperator
);
}
arc
.
setTarget
(
sourceTargetMap
.
get
(
operatorIds
.
get
(
operator
).
concat
(
".1"
)));
found
=
true
;
}
}
if
(!
found
)
{
throw
new
InvalidArgumentException
(
new
ElementUtils
().
getElementTag
((
Modifier
)
node
)
+
"Problem with exportin modifier"
);
}
}
}
else
if
(
node
instanceof
NodeOperator
)
{
if
((
node
instanceof
DissociationOperator
)
||
(
node
instanceof
AssociationOperator
))
{
...
...
@@ -873,7 +879,7 @@ public class SbgnmlXmlExporter {
}
}
}
List
<
Point2D
>
arcPoints
=
node
.
getLine
().
getPoints
();
Start
start
=
new
Start
();
if
((
node
instanceof
Product
)
||
(
node
instanceof
NodeOperator
))
{
...
...
converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParserTest2.java
View file @
e5887345
...
...
@@ -3,6 +3,7 @@ package lcsb.mapviewer.converter.model.sbgnml;
import
static
org
.
junit
.
Assert
.*;
import
java.awt.geom.Point2D
;
import
java.io.InputStream
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -13,6 +14,7 @@ import lcsb.mapviewer.converter.Converter;
import
lcsb.mapviewer.converter.ConverterParams
;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.ModelComparator
;
import
lcsb.mapviewer.model.map.reaction.*
;
import
lcsb.mapviewer.model.map.species.Complex
;
import
lcsb.mapviewer.model.map.species.GenericProtein
;
...
...
@@ -116,7 +118,35 @@ public class SbgnmlXmlParserTest2 extends SbgnmlTestFunctions {
logger
.
debug
(
sbgn
);
assertTrue
(
"State variable is missing"
,
sbgn
.
contains
(
"state variable"
));
assertTrue
(
"State variable doesn't contain variable"
,
sbgn
.
contains
(
"variable=\"g\""
));
}
@Test
public
void
testStimulationModification
()
throws
Exception
{
Converter
converter
=
new
SbgnmlXmlConverter
();
Model
model
=
converter
.
createModel
(
new
ConverterParams
().
filename
(
"testFiles/sbgnmlParserTestFiles/sbgnmlFiles/stimulation_modification.sbgn"
));
for
(
Reaction
r
:
model
.
getReactions
())
{
assertEquals
(
1
,
r
.
getModifiers
().
size
());
}
}
@Test
public
void
testExportStimulationModification
()
throws
Exception
{
Converter
converter
=
new
SbgnmlXmlConverter
();
Model
model
=
converter
.
createModel
(
new
ConverterParams
().
filename
(
"testFiles/sbgnmlParserTestFiles/sbgnmlFiles/stimulation_modification.sbgn"
));
InputStream
is
=
converter
.
model2InputStream
(
model
);
Model
model2
=
converter
.
createModel
(
new
ConverterParams
().
inputStream
(
is
));
for
(
Reaction
r
:
model2
.
getReactions
())
{
assertEquals
(
1
,
r
.
getModifiers
().
size
());
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment