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
4b6b4c90
Commit
4b6b4c90
authored
Mar 30, 2018
by
Piotr Gawron
Browse files
information about reaction line added that connects products and reactants
parent
8df588b4
Pipeline
#4405
passed with stage
in 1 minute and 26 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/reaction/SbmlReactionExporter.java
View file @
4b6b4c90
package
lcsb.mapviewer.converter.model.sbml.reaction
;
import
java.awt.geom.Line2D
;
import
java.awt.geom.Point2D
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -34,6 +35,7 @@ import lcsb.mapviewer.model.map.kinetics.SbmlParameter;
import
lcsb.mapviewer.model.map.modifier.Inhibition
;
import
lcsb.mapviewer.model.map.modifier.Trigger
;
import
lcsb.mapviewer.model.map.reaction.Modifier
;
import
lcsb.mapviewer.model.map.reaction.NodeOperator
;
import
lcsb.mapviewer.model.map.reaction.Product
;
import
lcsb.mapviewer.model.map.reaction.Reactant
;
import
lcsb.mapviewer.model.map.reaction.Reaction
;
...
...
@@ -170,20 +172,57 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
protected
void
assignLayoutToGlyph
(
Reaction
reaction
,
AbstractReferenceGlyph
compartmentGlyph
)
{
ReactionGlyph
reactionGlyph
=
(
ReactionGlyph
)
compartmentGlyph
;
boolean
firstReactant
=
true
;
reactionGlyph
.
setCurve
(
new
Curve
());
Point2D
reactantEndPoint
=
null
;
for
(
Reactant
reactant
:
reaction
.
getReactants
())
{
SpeciesReferenceGlyph
reactantGlyph
=
createNodeGlyph
(
reactionGlyph
,
reactant
);
if
(
firstReactant
)
{
reactantGlyph
.
setRole
(
SpeciesReferenceRole
.
SUBSTRATE
);
for
(
NodeOperator
operator
:
reaction
.
getOperators
())
{
if
(
operator
.
isReactantOperator
())
{
addOperatorLineToGlyph
(
reactionGlyph
,
operator
,
true
);
if
(
reactantEndPoint
==
null
)
{
reactantEndPoint
=
operator
.
getLine
().
getEndPoint
();
}
}
}
if
(
reactantEndPoint
==
null
)
{
reactantEndPoint
=
reactant
.
getLine
().
getEndPoint
();
}
}
else
{
reactantGlyph
.
setRole
(
SpeciesReferenceRole
.
SIDESUBSTRATE
);
}
firstReactant
=
false
;
}
boolean
firstProduct
=
true
;
Point2D
productStartPoint
=
null
;
for
(
Product
product
:
reaction
.
getProducts
())
{
SpeciesReferenceGlyph
productGlyph
=
createNodeGlyph
(
reactionGlyph
,
product
);
if
(
firstProduct
)
{
productGlyph
.
setRole
(
SpeciesReferenceRole
.
PRODUCT
);
for
(
NodeOperator
operator
:
reaction
.
getOperators
())
{
if
(
operator
.
isProductOperator
())
{
if
(
productStartPoint
==
null
)
{
productStartPoint
=
operator
.
getLine
().
getBeginPoint
();
LineSegment
segment
=
new
LineSegment
();
segment
.
setStart
(
new
Point
(
reactantEndPoint
.
getX
(),
reactantEndPoint
.
getY
()));
segment
.
setEnd
(
new
Point
(
productStartPoint
.
getX
(),
productStartPoint
.
getY
()));
reactionGlyph
.
getCurve
().
addCurveSegment
(
segment
);
}
addOperatorLineToGlyph
(
reactionGlyph
,
operator
,
false
);
}
}
if
(
productStartPoint
==
null
)
{
productStartPoint
=
product
.
getLine
().
getBeginPoint
();
LineSegment
segment
=
new
LineSegment
();
segment
.
setStart
(
new
Point
(
reactantEndPoint
.
getX
(),
reactantEndPoint
.
getY
()));
segment
.
setEnd
(
new
Point
(
productStartPoint
.
getX
(),
productStartPoint
.
getY
()));
reactionGlyph
.
getCurve
().
addCurveSegment
(
segment
);
}
}
else
{
productGlyph
.
setRole
(
SpeciesReferenceRole
.
SIDEPRODUCT
);
}
...
...
@@ -201,6 +240,23 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
}
}
private
void
addOperatorLineToGlyph
(
ReactionGlyph
reactantGlyph
,
NodeOperator
operator
,
boolean
reverse
)
{
Curve
curve
=
reactantGlyph
.
getCurve
();
List
<
Line2D
>
lines
=
operator
.
getLine
().
getLines
();
if
(
reverse
)
{
lines
=
operator
.
getLine
().
reverse
().
getLines
();
}
for
(
Line2D
line
:
lines
)
{
if
(
line
.
getP1
().
distance
(
line
.
getP2
())
>
Configuration
.
EPSILON
)
{
LineSegment
segment
=
new
LineSegment
();
segment
.
setStart
(
new
Point
(
line
.
getX1
(),
line
.
getY1
()));
segment
.
setEnd
(
new
Point
(
line
.
getX2
(),
line
.
getY2
()));
curve
.
addCurveSegment
(
segment
);
}
}
}
private
SpeciesReferenceGlyph
createNodeGlyph
(
ReactionGlyph
reactionGlyph
,
ReactionNode
node
)
{
SpeciesReferenceGlyph
reactantGlyph
=
reactionGlyph
.
createSpeciesReferenceGlyph
(
"node_"
+
getNextId
());
reactantGlyph
.
setSpeciesGlyph
(
speciesExporter
.
getSbmlGlyphByElementId
(
node
.
getElement
().
getElementId
()).
getId
());
...
...
@@ -209,11 +265,11 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
return
reactantGlyph
;
}
private
Curve
createCurve
(
ReactionNode
reactant
,
boolean
reverse
)
{
private
Curve
createCurve
(
ReactionNode
node
,
boolean
reverse
)
{
Curve
curve
=
new
Curve
();
List
<
Line2D
>
lines
=
reactant
.
getLine
().
getLines
();
List
<
Line2D
>
lines
=
node
.
getLine
().
getLines
();
if
(
reverse
)
{
lines
=
reactant
.
getLine
().
reverse
().
getLines
();
lines
=
node
.
getLine
().
reverse
().
getLines
();
}
for
(
Line2D
line
:
lines
)
{
if
(
line
.
getP1
().
distance
(
line
.
getP2
())
>
Configuration
.
EPSILON
)
{
...
...
frontend-js/package-lock.json
View file @
4b6b4c90
...
...
@@ -45,30 +45,38 @@
"litemol"
:
"github:dsehnal/LiteMol#a5419c696faa84530dd93acd55b747cf8136902b"
},
"dependencies"
:
{
"ProtVista"
:
{
"version"
:
"git://github.com/davidhoksza/protvista.git#4e4bb737ba1e183291505bd25f8bae2e651ce21e"
,
"dev"
:
true
,
"requires"
:
{
"d3"
:
"3.5.17"
,
"file-saver"
:
"1.3.3"
,
"jquery"
:
"2.2.4"
,
"jszip"
:
"3.1.4"
,
"underscore"
:
"1.8.3"
},
"dependencies"
:
{
"jquery"
:
{
"version"
:
"2.2.4"
,
"resolved"
:
"https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz"
,
"integrity"
:
"sha1-LInWiJterFIqfuoywUUhVZxsvwI="
,
"dev"
:
true
}
}
},
"jquery"
:
{
"version"
:
"3.3.1"
,
"resolved"
:
"https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz"
,
"integrity"
:
"sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
,
"dev"
:
true
}
}
},
"ProtVista"
:
{
"version"
:
"git://github.com/davidhoksza/protvista.git#4e4bb737ba1e183291505bd25f8bae2e651ce21e"
,
"dev"
:
true
,
"requires"
:
{
"d3"
:
"3.5.17"
,
"file-saver"
:
"1.3.3"
,
"jquery"
:
"2.2.4"
,
"jszip"
:
"3.1.4"
,
"underscore"
:
"1.8.3"
},
"dependencies"
:
{
"jquery"
:
{
"version"
:
"2.2.4"
,
"resolved"
:
"https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz"
,
"integrity"
:
"sha1-LInWiJterFIqfuoywUUhVZxsvwI="
,
"dev"
:
true
},
"litemol"
:
{
"version"
:
"github:dsehnal/LiteMol#a5419c696faa84530dd93acd55b747cf8136902b"
,
"dev"
:
true
,
"requires"
:
{
"@types/react"
:
"15.6.14"
,
"@types/react-dom"
:
"15.5.7"
}
}
}
},
...
...
@@ -2050,14 +2058,6 @@
"immediate"
:
"3.0.6"
}
},
"litemol"
:
{
"version"
:
"github:dsehnal/LiteMol#a5419c696faa84530dd93acd55b747cf8136902b"
,
"dev"
:
true
,
"requires"
:
{
"@types/react"
:
"15.6.14"
,
"@types/react-dom"
:
"15.5.7"
}
},
"lodash"
:
{
"version"
:
"4.17.4"
,
"resolved"
:
"https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz"
,
...
...
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