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
4a474119
Commit
4a474119
authored
Apr 25, 2019
by
Piotr Gawron
Browse files
export of reaction where product has no valid line doesn't crash
parent
6d3f3f23
Changes
3
Hide whitespace changes
Inline
Side-by-side
converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/reaction/SbmlReactionExporter.java
View file @
4a474119
...
...
@@ -48,6 +48,7 @@ import lcsb.mapviewer.model.map.reaction.Reactant;
import
lcsb.mapviewer.model.map.reaction.Reaction
;
import
lcsb.mapviewer.model.map.reaction.ReactionNode
;
import
lcsb.mapviewer.model.map.species.Element
;
import
lcsb.mapviewer.modelutils.map.ElementUtils
;
public
class
SbmlReactionExporter
extends
SbmlBioEntityExporter
<
Reaction
,
org
.
sbml
.
jsbml
.
Reaction
>
{
/**
...
...
@@ -217,8 +218,12 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
assignStyleToGlyph
(
reactantGlyph
,
style
);
}
Point
p
=
reactantGlyph
.
getCurve
().
getCurveSegment
(
0
).
getStart
();
reactantEndPoint
=
new
Point2D
.
Double
(
p
.
getX
(),
p
.
getY
());
if
(
reactantGlyph
.
getCurve
().
getCurveSegmentCount
()
>
0
)
{
Point
p
=
reactantGlyph
.
getCurve
().
getCurveSegment
(
0
).
getStart
();
reactantEndPoint
=
new
Point2D
.
Double
(
p
.
getX
(),
p
.
getY
());
}
else
{
reactantEndPoint
=
new
Point2D
.
Double
(
reactant
.
getElement
().
getCenterX
(),
reactant
.
getElement
().
getCenterY
());
}
}
if
(
reactionGlyph
.
getCurve
().
getCurveSegmentCount
()
>
0
)
{
Point
p
=
reactionGlyph
.
getCurve
().
getCurveSegment
(
reactionGlyph
.
getCurve
().
getCurveSegmentCount
()
-
1
).
getEnd
();
...
...
@@ -254,8 +259,12 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
assignStyleToGlyph
(
productGlyph
,
style
);
}
Point
p
=
productGlyph
.
getCurve
().
getCurveSegment
(
0
).
getStart
();
productStartPoint
=
new
Point2D
.
Double
(
p
.
getX
(),
p
.
getY
());
if
(
productGlyph
.
getCurve
().
getCurveSegmentCount
()
>
0
)
{
Point
p
=
productGlyph
.
getCurve
().
getCurveSegment
(
0
).
getStart
();
productStartPoint
=
new
Point2D
.
Double
(
p
.
getX
(),
p
.
getY
());
}
else
{
productStartPoint
=
new
Point2D
.
Double
(
product
.
getElement
().
getCenterX
(),
product
.
getElement
().
getCenterY
());
}
}
if
(
segmentCount
<
reactionGlyph
.
getCurve
().
getCurveSegmentCount
())
{
...
...
@@ -360,6 +369,9 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
curve
.
addCurveSegment
(
segment
);
}
}
if
(
curve
.
getCurveSegmentCount
()
==
0
)
{
logger
.
warn
(
new
ElementUtils
().
getElementTag
(
node
)
+
" Problematic line"
);
}
return
curve
;
}
...
...
converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/SbmlExporterTest.java
View file @
4a474119
...
...
@@ -672,6 +672,21 @@ public class SbmlExporterTest extends SbmlTestFunctions {
ListComparator
<
Line2D
>
comparator
=
new
ListComparator
<>(
new
LineComparator
(
Configuration
.
EPSILON
));
assertEquals
(
0
,
comparator
.
compare
(
lines1
,
lines2
));
}
@Test
public
void
testExportIronMetabolismReaction
()
throws
Exception
{
try
{
Model
originalModel
=
new
CellDesignerXmlParser
()
.
createModel
(
new
ConverterParams
().
filename
(
"testFiles/cell_designer_problems/iron_metabolism_reaction.xml"
));
exporter
.
setProvideDefaults
(
false
);
String
xml
=
exporter
.
toXml
(
originalModel
);
assertNotNull
(
xml
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
}
converter-sbml/testFiles/cell_designer_problems/iron_metabolism_reaction.xml
0 → 100644
View file @
4a474119
<?xml version="1.0" encoding="UTF-8"?>
<sbml
xmlns=
"http://www.sbml.org/sbml/level2/version4"
xmlns:celldesigner=
"http://www.sbml.org/2001/ns/celldesigner"
level=
"2"
version=
"4"
>
<model
metaid=
"Dopamine_Neurotransmitter_Release_Cycle"
id=
"A_comprehensive_Parkinsons_disease_map"
>
<annotation>
<celldesigner:extension>
<celldesigner:modelVersion>
4.0
</celldesigner:modelVersion>
<celldesigner:modelDisplay
sizeX=
"9000"
sizeY=
"5500"
/>
<celldesigner:listOfCompartmentAliases/>
<celldesigner:listOfComplexSpeciesAliases>
<celldesigner:complexSpeciesAlias
id=
"csa106"
species=
"irme_458"
>
<celldesigner:activity>
inactive
</celldesigner:activity>
<celldesigner:bounds
x=
"2247.5"
y=
"2007.0"
w=
"103.0"
h=
"171.0"
/>
<celldesigner:font
size=
"12"
/>
<celldesigner:view
state=
"usual"
/>
<celldesigner:backupSize
w=
"0.0"
h=
"0.0"
/>
<celldesigner:backupView
state=
"none"
/>
<celldesigner:usualView>
<celldesigner:boxSize
width=
"103.0"
height=
"171.0"
/>
<celldesigner:singleLine
width=
"2.0"
/>
<celldesigner:paint
color=
"fff7f7f7"
scheme=
"Color"
/>
</celldesigner:usualView>
<celldesigner:briefView>
<celldesigner:innerPosition
x=
"0.0"
y=
"0.0"
/>
<celldesigner:boxSize
width=
"80.0"
height=
"60.0"
/>
<celldesigner:singleLine
width=
"2.0"
/>
<celldesigner:paint
color=
"fff7f7f7"
scheme=
"Color"
/>
</celldesigner:briefView>
<celldesigner:info
state=
"empty"
angle=
"-1.5707963267948966"
/>
</celldesigner:complexSpeciesAlias>
</celldesigner:listOfComplexSpeciesAliases>
<celldesigner:listOfSpeciesAliases>
<celldesigner:speciesAlias
id=
"sa10326"
species=
"irme_72"
>
<celldesigner:activity>
inactive
</celldesigner:activity>
<celldesigner:bounds
x=
"2378.000000000001"
y=
"2072.166666666668"
w=
"40.0"
h=
"40.0"
/>
<celldesigner:font
size=
"12"
/>
<celldesigner:view
state=
"usual"
/>
<celldesigner:usualView>
<celldesigner:boxSize
width=
"40.0"
height=
"40.0"
/>
<celldesigner:singleLine
width=
"1.0"
/>
<celldesigner:paint
color=
"ff9999ff"
scheme=
"Color"
/>
</celldesigner:usualView>
<celldesigner:briefView>
<celldesigner:innerPosition
x=
"7906.815893308081"
y=
"5845.130208333333"
/>
<celldesigner:boxSize
width=
"40.0"
height=
"40.0"
/>
<celldesigner:singleLine
width=
"1.0"
/>
<celldesigner:paint
color=
"ff9999ff"
scheme=
"Color"
/>
</celldesigner:briefView>
<celldesigner:info
state=
"empty"
angle=
"-1.5707963267948966"
/>
</celldesigner:speciesAlias>
</celldesigner:listOfSpeciesAliases>
<celldesigner:listOfGroups/>
<celldesigner:listOfProteins/>
<celldesigner:listOfGenes/>
<celldesigner:listOfRNAs/>
<celldesigner:listOfAntisenseRNAs/>
<celldesigner:listOfLayers/>
<celldesigner:listOfBlockDiagrams/>
</celldesigner:extension>
</annotation>
<listOfUnitDefinitions>
<unitDefinition
metaid=
"substance"
id=
"substance"
name=
"substance"
>
<listOfUnits>
<unit
metaid=
"CDMT00539"
kind=
"mole"
/>
</listOfUnits>
</unitDefinition>
<unitDefinition
metaid=
"volume"
id=
"volume"
name=
"volume"
>
<listOfUnits>
<unit
metaid=
"CDMT00540"
kind=
"litre"
/>
</listOfUnits>
</unitDefinition>
<unitDefinition
metaid=
"area"
id=
"area"
name=
"area"
>
<listOfUnits>
<unit
metaid=
"CDMT00541"
kind=
"metre"
exponent=
"2"
/>
</listOfUnits>
</unitDefinition>
<unitDefinition
metaid=
"length"
id=
"length"
name=
"length"
>
<listOfUnits>
<unit
metaid=
"CDMT00542"
kind=
"metre"
/>
</listOfUnits>
</unitDefinition>
<unitDefinition
metaid=
"time"
id=
"time"
name=
"time"
>
<listOfUnits>
<unit
metaid=
"CDMT00543"
kind=
"second"
/>
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>
<listOfCompartments>
<compartment
metaid=
"default"
id=
"default"
size=
"1"
units=
"volume"
/>
<compartment
metaid=
"5"
id=
"5"
name=
"Mitochondrial_space_ROS_space_Metabolism"
size=
"1"
units=
"volume"
outside=
"default"
/>
</listOfCompartments>
<listOfSpecies>
<species
metaid=
"irme_458"
id=
"irme_458"
name=
"labile iron pool"
compartment=
"default"
initialAmount=
"0"
>
<annotation>
<celldesigner:extension>
<celldesigner:positionToCompartment>
inside
</celldesigner:positionToCompartment>
<celldesigner:speciesIdentity>
<celldesigner:class>
COMPLEX
</celldesigner:class>
<celldesigner:hypothetical>
true
</celldesigner:hypothetical>
<celldesigner:name>
labile iron pool
</celldesigner:name>
</celldesigner:speciesIdentity>
</celldesigner:extension>
<rdf:RDF
xmlns:rdf=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc=
"http://purl.org/dc/elements/1.1/"
xmlns:dcterms=
"http://purl.org/dc/terms/"
xmlns:vCard=
"http://www.w3.org/2001/vcard-rdf/3.0#"
xmlns:bqbiol=
"http://biomodels.net/biology-qualifiers/"
xmlns:bqmodel=
"http://biomodels.net/model-qualifiers/"
>
<rdf:Description
rdf:about=
"#irme_458"
>
<bqbiol:isDescribedBy>
<rdf:Bag>
<rdf:li
rdf:resource=
"urn:miriam:pubmed:27293957"
/>
</rdf:Bag>
</bqbiol:isDescribedBy>
</rdf:Description>
</rdf:RDF>
</annotation>
</species>
<species
metaid=
"irme_72"
id=
"irme_72"
name=
"Fe2_plus_"
compartment=
"default"
initialAmount=
"0"
>
<annotation>
<celldesigner:extension>
<celldesigner:positionToCompartment>
inside
</celldesigner:positionToCompartment>
<celldesigner:speciesIdentity>
<celldesigner:class>
ION
</celldesigner:class>
<celldesigner:name>
Fe2_plus_
</celldesigner:name>
</celldesigner:speciesIdentity>
</celldesigner:extension>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
<reaction
metaid=
"re4888"
id=
"re4888"
reversible=
"false"
>
<annotation>
<celldesigner:extension>
<celldesigner:reactionType>
POSITIVE_INFLUENCE
</celldesigner:reactionType>
<celldesigner:baseReactants>
<celldesigner:baseReactant
species=
"irme_458"
alias=
"csa106"
>
<celldesigner:linkAnchor
position=
"E"
/>
</celldesigner:baseReactant>
</celldesigner:baseReactants>
<celldesigner:baseProducts>
<celldesigner:baseProduct
species=
"irme_72"
alias=
"sa10326"
>
<celldesigner:linkAnchor
position=
"W"
/>
</celldesigner:baseProduct>
</celldesigner:baseProducts>
<celldesigner:connectScheme
connectPolicy=
"square"
>
<celldesigner:listOfLineDirection>
<celldesigner:lineDirection
index=
"0"
value=
"horizontal"
/>
<celldesigner:lineDirection
index=
"1"
value=
"vertical"
/>
<celldesigner:lineDirection
index=
"2"
value=
"horizontal"
/>
</celldesigner:listOfLineDirection>
</celldesigner:connectScheme>
<celldesigner:editPoints>
0.8391667847539281,0.009990080770847953 0.8393084880263331,-0.0019129941901638858
</celldesigner:editPoints>
<celldesigner:line
width=
"1.0"
color=
"ff000000"
/>
</celldesigner:extension>
<rdf:RDF
xmlns:rdf=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc=
"http://purl.org/dc/elements/1.1/"
xmlns:dcterms=
"http://purl.org/dc/terms/"
xmlns:vCard=
"http://www.w3.org/2001/vcard-rdf/3.0#"
xmlns:bqbiol=
"http://biomodels.net/biology-qualifiers/"
xmlns:bqmodel=
"http://biomodels.net/model-qualifiers/"
>
<rdf:Description
rdf:about=
"#re4888"
>
<bqbiol:isDescribedBy>
<rdf:Bag>
<rdf:li
rdf:resource=
"urn:miriam:pubmed:25231526"
/>
</rdf:Bag>
</bqbiol:isDescribedBy>
<bqbiol:isDescribedBy>
<rdf:Bag>
<rdf:li
rdf:resource=
"urn:miriam:pubmed:26106291"
/>
</rdf:Bag>
</bqbiol:isDescribedBy>
</rdf:Description>
</rdf:RDF>
</annotation>
<listOfReactants>
<speciesReference
metaid=
"CDMT00414"
species=
"irme_458"
>
<annotation>
<celldesigner:extension>
<celldesigner:alias>
csa106
</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfReactants>
<listOfProducts>
<speciesReference
metaid=
"CDMT00415"
species=
"irme_72"
>
<annotation>
<celldesigner:extension>
<celldesigner:alias>
sa10326
</celldesigner:alias>
</celldesigner:extension>
</annotation>
</speciesReference>
</listOfProducts>
</reaction>
</listOfReactions>
</model>
</sbml>
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