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
424fcc68
Commit
424fcc68
authored
Jul 13, 2020
by
Piotr Gawron
Browse files
recognition of reduced notation is done over proper java interface
parent
94a0142c
Pipeline
#29727
passed with stage
in 11 minutes and 27 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
424fcc68
...
...
@@ -25,6 +25,8 @@ minerva (15.1.0) unstable; urgency=medium
index
*
Small
improvement
:
pathways
with
glyphs
and
z
index
below
0
are
not
clickable
(#
1314
)
*
Small
improvement
:
Modifier
Reaction
from
CellDesigner
are
exported
properly
to
SBGN
-
ML
PD
(#
1320
)
*
Bug
fix
:
export
to
image
from
selected
polygon
contained
all
elements
inside
rectangle
bounded
by
the
polygon
coordinates
(#
1096
)
*
Bug
fix
:
continuous
refreshing
list
of
project
when
uploading
/
removing
...
...
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java
View file @
424fcc68
...
...
@@ -139,18 +139,21 @@ public class SbgnmlXmlExporter {
for
(
Reaction
reaction
:
model
.
getReactions
())
{
try
{
map
.
getGlyph
().
add
(
getProcessGlyphFromReaction
(
reaction
));
}
catch
(
InvalidArgumentException
ex
)
{
// Reduced notation
try
{
map
.
getArc
().
add
(
getArcFromReducedReaction
(
reaction
));
}
catch
(
InvalidArgumentException
e
)
{
logger
.
warn
(
new
LogMarker
(
ProjectLogEntryType
.
EXPORT_ISSUE
,
reaction
),
"Invalid arc type."
+
" Reduced notation reaction found of type that is not compliant with SBGN-ML format."
);
Glyph
glyph
=
getProcessGlyphFromReaction
(
reaction
);
if
(
glyph
!=
null
)
{
map
.
getGlyph
().
add
(
glyph
);
map
.
getArc
().
addAll
(
getArcsFromReaction
(
reaction
,
map
.
getGlyph
()));
}
else
{
Arc
arc
=
getArcFromReducedReaction
(
reaction
);
if
(
arc
!=
null
)
{
map
.
getArc
().
add
(
arc
);
}
}
continue
;
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
logger
.
warn
(
new
LogMarker
(
ProjectLogEntryType
.
EXPORT_ISSUE
,
reaction
),
"Unexpected problem with exporting reaction."
);
}
map
.
getArc
().
addAll
(
getArcsFromReaction
(
reaction
,
map
.
getGlyph
()));
}
try
{
RenderUtil
.
setRenderInformation
(
map
,
renderInformation
);
...
...
@@ -599,7 +602,11 @@ public class SbgnmlXmlExporter {
private
Glyph
getProcessGlyphFromReaction
(
Reaction
reaction
)
{
Glyph
processGlyph
=
new
Glyph
();
processGlyph
.
setId
(
reaction
.
getIdReaction
());
processGlyph
.
setClazz
(
getGlyphClazzFromReaction
(
reaction
).
getClazz
());
GlyphClazz
clazz
=
getGlyphClazzFromReaction
(
reaction
);
if
(
clazz
==
null
)
{
return
null
;
}
processGlyph
.
setClazz
(
clazz
.
getClazz
());
Bbox
bbox
=
new
Bbox
();
PolylineData
line
=
reaction
.
getLine
();
...
...
@@ -708,12 +715,6 @@ public class SbgnmlXmlExporter {
* @return {@link GlyphClazz} appropriate to given reaction
*/
private
GlyphClazz
getGlyphClazzFromReaction
(
Reaction
reaction
)
{
if
(
reaction
instanceof
StateTransitionReaction
||
reaction
instanceof
TransportReaction
||
reaction
instanceof
TranslationReaction
||
reaction
instanceof
TranscriptionReaction
)
{
return
GlyphClazz
.
PROCESS
;
}
if
(
reaction
instanceof
HeterodimerAssociationReaction
)
{
return
GlyphClazz
.
ASSOCIATION
;
}
...
...
@@ -726,7 +727,10 @@ public class SbgnmlXmlExporter {
if
(
reaction
instanceof
UnknownTransitionReaction
)
{
return
GlyphClazz
.
UNCERTAIN_PROCESS
;
}
throw
new
InvalidArgumentException
();
if
(
reaction
instanceof
ReducedNotation
)
{
return
null
;
}
return
GlyphClazz
.
PROCESS
;
}
/**
...
...
@@ -738,7 +742,9 @@ public class SbgnmlXmlExporter {
*/
private
Arc
getArcFromReducedReaction
(
Reaction
reaction
)
{
if
((
reaction
.
getReactants
().
size
()
!=
1
)
||
(
reaction
.
getProducts
().
size
()
!=
1
))
{
throw
new
InvalidArgumentException
();
logger
.
warn
(
new
LogMarker
(
ProjectLogEntryType
.
PARSING_ISSUE
,
reaction
),
"Reduced notation does not allow to have multiple reactants/products. Reaction skipped"
);
return
null
;
}
Arc
arc
=
new
Arc
();
arc
.
setId
(
reaction
.
getIdReaction
());
...
...
@@ -752,7 +758,9 @@ public class SbgnmlXmlExporter {
}
else
if
(
reaction
instanceof
ReducedPhysicalStimulationReaction
)
{
arc
.
setClazz
(
ArcClazz
.
STIMULATION
.
getClazz
());
}
else
{
throw
new
InvalidArgumentException
();
logger
.
warn
(
new
LogMarker
(
ProjectLogEntryType
.
EXPORT_ISSUE
,
reaction
),
"Invalid arc type."
+
" Reduced notation reaction found of type that is not compliant with SBGN-ML format."
);
return
null
;
}
if
(
reaction
.
getProducts
().
get
(
0
).
getElement
()
instanceof
Phenotype
)
{
...
...
@@ -941,7 +949,8 @@ public class SbgnmlXmlExporter {
}
}
}
else
if
(
node
instanceof
NodeOperator
)
{
if
((
node
instanceof
DissociationOperator
)
||
(
node
instanceof
AssociationOperator
))
{
if
((
node
instanceof
DissociationOperator
)
||
(
node
instanceof
AssociationOperator
)
||
(
node
instanceof
TruncationOperator
))
{
throw
new
InvalidArgumentException
();
}
arc
.
setSource
(
sourceTargetMap
.
get
(
operatorIds
.
get
(
node
).
concat
(
".2"
)));
...
...
model/src/main/java/lcsb/mapviewer/model/map/reaction/type/ReducedNotation.java
View file @
424fcc68
...
...
@@ -4,7 +4,7 @@ package lcsb.mapviewer.model.map.reaction.type;
*
* Interface used for marking {@link lcsb.mapviewer.model.map.reaction.Reaction
* Reaction} extensions that implements reduced notation in CellDesigner. These
* classes should have more than one reactant and product and cannot have any
* classes should have
no
more than one reactant and product and cannot have any
* modifiers.
*
* @author Piotr Gawron
...
...
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