Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Gitlab will go into maintenance Friday 3rd February from 9:00 to 10:00
Open sidebar
minerva
core
Commits
9aca65b0
Commit
9aca65b0
authored
Feb 25, 2020
by
Piotr Gawron
Browse files
invalid port in sbgn production caused issues
parent
0a6df492
Pipeline
#21472
passed with stage
in 12 minutes and 45 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
9aca65b0
...
...
@@ -21,6 +21,8 @@ minerva (14.0.9) stable; urgency=medium
*
Bug
fix
:
activity
flow
reaction
inside
SBGN
PD
caused
upload
of
map
to
crash
*
Bug
fix
:
reaction
without
product
in
SBGN
crashed
upload
of
map
*
Bug
fix
:
when
SBGN
production
pointed
directly
to
process
instead
of
process
port
upload
crashed
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
3
Feb
2020
15
:
00
:
00
+
0200
...
...
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java
View file @
9aca65b0
...
...
@@ -475,23 +475,42 @@ public class SbgnmlXmlParser {
}
break
;
case
PRODUCTION:
Port
arcSourcePort
;
boolean
processFound
=
false
;
Port
arcSourcePort
=
null
;
if
(
a
.
getSource
()
instanceof
Port
)
{
arcSourcePort
=
(
Port
)
a
.
getSource
();
}
else
if
(
a
.
getTarget
()
instanceof
Port
)
{
logger
.
warn
(
"["
+
a
.
getId
(
)
+
"
]\t
Production is going to process"
);
logger
.
warn
(
getTag
(
a
)
+
"Production is going to process"
);
arcSourcePort
=
(
Port
)
a
.
getTarget
();
}
else
{
logger
.
warn
(
getTag
(
a
)
+
"Activity flow reaction found in PD"
);
activityFlowArcs
.
add
(
a
);
break
;
}
for
(
Process
p
:
processes
)
{
if
(
p
.
getCentralPoint
().
getPort
().
contains
(
arcSourcePort
))
{
p
.
addProductArc
(
a
);
for
(
Process
p
:
processes
)
{
if
(
p
.
getCentralPoint
().
equals
(
a
.
getTarget
()))
{
p
.
addReagentArc
(
a
);
logger
.
warn
(
getTag
(
a
)
+
"Invalid target port"
);
processFound
=
true
;
break
;
}
if
(
p
.
getCentralPoint
().
equals
(
a
.
getSource
()))
{
p
.
addProductArc
(
a
);
logger
.
warn
(
getTag
(
a
)
+
"Invalid source port"
);
processFound
=
true
;
break
;
}
}
if
(!
processFound
)
{
logger
.
warn
(
getTag
(
a
)
+
"Activity flow reaction found in PD"
);
activityFlowArcs
.
add
(
a
);
break
;
}
}
if
(!
processFound
)
{
for
(
Process
p
:
processes
)
{
if
(
p
.
getCentralPoint
().
getPort
().
contains
(
arcSourcePort
))
{
p
.
addProductArc
(
a
);
break
;
}
}
}
break
;
case
EQUIVALENCE_ARC:
logger
.
warn
(
"Submaps are not supported. Equivalence arc: "
+
a
.
getId
()
+
" has not been parsed."
);
...
...
@@ -1314,14 +1333,7 @@ public class SbgnmlXmlParser {
}
if
(
p
.
getReagentsPort
()
==
null
&&
!
p
.
getReagentArcs
().
isEmpty
())
{
Port
port
;
if
(
p
.
getReagentArcs
().
get
(
0
).
getTarget
()
instanceof
Port
)
{
port
=
(
Port
)
p
.
getReagentArcs
().
get
(
0
).
getTarget
();
}
else
if
(
p
.
getReagentArcs
().
get
(
0
).
getSource
()
instanceof
Port
)
{
port
=
(
Port
)
p
.
getReagentArcs
().
get
(
0
).
getSource
();
}
else
{
throw
new
InvalidArgumentException
(
"Cannot find proces for arc: "
+
p
.
getReagentArcs
().
get
(
0
).
getId
());
}
Port
port
=
getTargetPort
(
p
.
getReagentArcs
().
get
(
0
));
p
.
setReagentsPort
(
port
);
}
...
...
@@ -1367,7 +1379,7 @@ public class SbgnmlXmlParser {
if
(
getSourcePort
(
a
).
equals
(
p
.
getProductsPort
())
&&
ports
.
size
()
==
2
||
reaction
.
getProducts
().
size
()
==
0
)
{
Product
product
=
new
Product
();
product
.
setReaction
(
reaction
);
Glyph
target
=
(
Glyph
)
a
.
getTarget
(
);
Glyph
target
=
getTarget
Glyph
(
a
);
product
.
setElement
(
model
.
getElementByElementId
(
target
.
getId
()));
List
<
Point2D
>
pointList
=
getLinePoints
(
a
);
PolylineData
line
=
parseLine
(
a
,
pointList
);
...
...
@@ -1450,8 +1462,12 @@ public class SbgnmlXmlParser {
return
(
Port
)
a
.
getTarget
();
}
else
if
(
a
.
getSource
()
instanceof
Port
)
{
return
(
Port
)
a
.
getSource
();
}
else
if
(
a
.
getTarget
()
instanceof
Glyph
&&
((
Glyph
)
a
.
getTarget
()).
getPort
().
size
()>
0
)
{
return
((
Glyph
)
a
.
getTarget
()).
getPort
().
get
(
0
);
}
else
if
(
a
.
getSource
()
instanceof
Glyph
&&
((
Glyph
)
a
.
getSource
()).
getPort
().
size
()>
0
)
{
return
((
Glyph
)
a
.
getSource
()).
getPort
().
get
(
0
);
}
else
{
throw
new
InvalidArgumentException
(
"Arc is not connected to
glyph
: "
+
a
.
getId
());
throw
new
InvalidArgumentException
(
"Arc is not connected to
port
: "
+
a
.
getId
());
}
}
...
...
@@ -1460,8 +1476,12 @@ public class SbgnmlXmlParser {
return
(
Port
)
a
.
getSource
();
}
else
if
(
a
.
getTarget
()
instanceof
Port
)
{
return
(
Port
)
a
.
getTarget
();
}
else
if
(
a
.
getSource
()
instanceof
Glyph
&&
((
Glyph
)
a
.
getSource
()).
getPort
().
size
()>
0
)
{
return
((
Glyph
)
a
.
getSource
()).
getPort
().
get
(
0
);
}
else
if
(
a
.
getTarget
()
instanceof
Glyph
&&
((
Glyph
)
a
.
getTarget
()).
getPort
().
size
()>
0
)
{
return
((
Glyph
)
a
.
getTarget
()).
getPort
().
get
(
0
);
}
else
{
throw
new
InvalidArgumentException
(
"Arc is not connected to
glyph
: "
+
a
.
getId
());
throw
new
InvalidArgumentException
(
"Arc is not connected to
port
: "
+
a
.
getId
());
}
}
...
...
converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParserTest2.java
View file @
9aca65b0
...
...
@@ -172,4 +172,20 @@ public class SbgnmlXmlParserTest2 extends SbgnmlTestFunctions {
assertEquals
(
0
,
model
.
getReactions
().
size
());
}
@Test
public
void
testInvalidTargetPort
()
throws
Exception
{
Converter
converter
=
new
SbgnmlXmlConverter
();
Model
model
=
converter
.
createModel
(
new
ConverterParams
().
filename
(
"testFiles/sbgnmlParserTestFiles/sbgnmlFiles/target_port_invalid.sbgn"
));
assertEquals
(
1
,
model
.
getReactions
().
size
());
Reaction
r
=
model
.
getReactions
().
iterator
().
next
();
assertEquals
(
1
,
r
.
getReactants
().
size
());
assertEquals
(
1
,
r
.
getProducts
().
size
());
assertNotNull
(
r
.
getLine
());
}
}
converter-SBGNML/testFiles/sbgnmlParserTestFiles/sbgnmlFiles/target_port_invalid.sbgn
0 → 100644
View file @
9aca65b0
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<sbgn
xmlns=
"http://sbgn.org/libsbgn/0.2"
>
<map
language=
"process description"
>
<extension>
<renderInformation
xmlns=
"http://www.sbml.org/sbml/level3/version1/render/version1"
id=
"renderInformation"
program-name=
"sbgnviz"
program-version=
"5.0.0"
background-color=
"#00000000"
>
<listOfColorDefinitions>
<colorDefinition
id=
"color_1"
value=
"#ffffffff"
/>
<colorDefinition
id=
"color_2"
value=
"#000000"
/>
<colorDefinition
id=
"color_3"
value=
"#ffff99ff"
/>
</listOfColorDefinitions>
<listOfBackgroundImages>
<backgroundImage
id=
"image_1"
value=
"http://newteditor.org/color-scheme-images/pg5_3d.png"
/>
<backgroundImage
id=
"image_2"
value=
"http://newteditor.org/color-scheme-images/bw1_3d.png"
/>
<backgroundImage
id=
"image_3"
value=
"http://newteditor.org/color-scheme-images/pg4_3d.png"
/>
</listOfBackgroundImages>
<listOfStyles>
<style
id=
"nodeFFFFFF1000000112normalnormalHelvetica000image_1cover5050"
id-list=
"n59 n72 n61 n62 n73"
>
<g
font-size=
"12"
font-family=
"Helvetica"
font-weight=
"normal"
font-style=
"normal"
font-color=
"#000"
stroke=
"color_2"
stroke-width=
"1"
fill=
"color_1"
background-image=
"image_1"
background-fit=
"cover"
background-pos-x=
"50%"
background-pos-y=
"50%"
/>
</style>
<style
id=
"nodeFFFFFF1000000114image_2cover5050"
id-list=
"n60"
>
<g
font-size=
"14"
stroke=
"color_2"
stroke-width=
"1"
fill=
"color_1"
background-image=
"image_2"
background-fit=
"cover"
background-pos-x=
"50%"
background-pos-y=
"50%"
/>
</style>
<style
id=
"nodeFFFF991000000112normalnormalHelvetica000image_1cover5050"
id-list=
"n78 n74"
>
<g
font-size=
"12"
font-family=
"Helvetica"
font-weight=
"normal"
font-style=
"normal"
font-color=
"#000"
stroke=
"color_2"
stroke-width=
"1"
fill=
"color_3"
background-image=
"image_1"
background-fit=
"cover"
background-pos-x=
"50%"
background-pos-y=
"50%"
/>
</style>
<style
id=
"nodeFFFFFF1000000112normalnormalHelvetica000image_3cover5050"
id-list=
"n71"
>
<g
font-size=
"12"
font-family=
"Helvetica"
font-weight=
"normal"
font-style=
"normal"
font-color=
"#000"
stroke=
"color_2"
stroke-width=
"1"
fill=
"color_1"
background-image=
"image_3"
background-fit=
"cover"
background-pos-x=
"50%"
background-pos-y=
"50%"
/>
</style>
<style
id=
"edge0000001"
id-list=
"e28 e30 e29 e41 e40"
>
<g
stroke=
"color_2"
stroke-width=
"1"
/>
</style>
</listOfStyles>
</renderInformation>
<mapProperties>
<compoundPadding>
20
</compoundPadding>
<extraCompartmentPadding>
14
</extraCompartmentPadding>
<extraComplexPadding>
10
</extraComplexPadding>
<arrowScale>
1.25
</arrowScale>
<showComplexName>
true
</showComplexName>
<dynamicLabelSize>
regular
</dynamicLabelSize>
<inferNestingOnLoad>
false
</inferNestingOnLoad>
<fitLabelsToNodes>
false
</fitLabelsToNodes>
<fitLabelsToInfoboxes>
false
</fitLabelsToInfoboxes>
<recalculateLayoutOnComplexityManagement>
true
</recalculateLayoutOnComplexityManagement>
<rearrangeOnComplexityManagement>
true
</rearrangeOnComplexityManagement>
<animateOnDrawingChanges>
true
</animateOnDrawingChanges>
<adjustNodeLabelFontSizeAutomatically>
false
</adjustNodeLabelFontSizeAutomatically>
<enablePorts>
false
</enablePorts>
<enableSIFTopologyGrouping>
false
</enableSIFTopologyGrouping>
<allowCompoundNodeResize>
false
</allowCompoundNodeResize>
<mapColorScheme>
opposed_purple_green
</mapColorScheme>
<mapColorSchemeStyle>
3D
</mapColorSchemeStyle>
<mapName>
Pathway #sbgn-network-container-0
</mapName>
<mapDescription/>
<defaultInfoboxHeight>
12
</defaultInfoboxHeight>
<defaultInfoboxWidth>
8
</defaultInfoboxWidth>
<rearrangeAfterExpandCollapse>
true
</rearrangeAfterExpandCollapse>
</mapProperties>
</extension>
<glyph
id=
"n59"
class=
"macromolecule"
>
<label
text=
"C4"
/>
<bbox
x=
"662.16473"
y=
"277.00546"
w=
"80"
h=
"40"
/>
</glyph>
<glyph
id=
"n60"
class=
"process"
>
<bbox
x=
"697.66473"
y=
"390.42825"
w=
"9"
h=
"9"
/>
<port
id=
"n60.1"
x=
"693.16473"
y=
"394.92825"
/>
<port
id=
"n60.2"
x=
"711.16473"
y=
"394.92825"
/>
</glyph>
<glyph
id=
"n72"
class=
"macromolecule"
>
<label
text=
"C1q"
/>
<clone/>
<bbox
x=
"546.1714"
y=
"231.18143"
w=
"80"
h=
"40"
/>
</glyph>
<glyph
id=
"n78"
class=
"macromolecule"
>
<label
text=
"MASP2"
/>
<bbox
x=
"538.3813"
y=
"393.2951"
w=
"80"
h=
"40"
/>
</glyph>
<glyph
id=
"n61"
class=
"macromolecule"
>
<label
text=
"C4a"
/>
<bbox
x=
"662.16473"
y=
"472.85104"
w=
"80"
h=
"40"
/>
</glyph>
<glyph
id=
"n62"
class=
"macromolecule"
>
<label
text=
"C4b"
/>
<bbox
x=
"543.0634"
y=
"472.85104"
w=
"80"
h=
"40"
/>
</glyph>
<glyph
id=
"n71"
class=
"complex"
>
<label
text=
"C1"
/>
<bbox
x=
"529.0982"
y=
"203.92066999999997"
w=
"114.14638"
h=
"171.93767"
/>
</glyph>
<glyph
id=
"n74"
class=
"macromolecule"
>
<label
text=
"C1S"
/>
<bbox
x=
"546.1714"
y=
"311.18143"
w=
"80"
h=
"40"
/>
</glyph>
<glyph
id=
"n73"
class=
"macromolecule"
>
<label
text=
"C1r"
/>
<clone/>
<bbox
x=
"546.1714"
y=
"271.18143"
w=
"80"
h=
"40"
/>
</glyph>
<arc
id=
"e28"
class=
"production"
source=
"n59"
target=
"n60"
>
<start
x=
"702.16473"
y=
"317.50546"
/>
<end
x=
"702.16473"
y=
"382.92825"
/>
</arc>
<arc
id=
"e29"
class=
"production"
source=
"n60.2"
target=
"n61"
>
<start
x=
"702.16473"
y=
"404.42825"
/>
<end
x=
"702.16473"
y=
"469.85104"
/>
</arc>
</map>
</sbgn>
\ No newline at end of file
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