Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
c1b0296b
Commit
c1b0296b
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
handling of the situation when layout ids are not unique for reactions
parent
7da306af
No related branches found
No related tags found
1 merge request
!186
Resolve "upload of sbml"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/SbmlReactionParser.java
+11
-11
11 additions, 11 deletions
...sb/mapviewer/converter/model/sbml/SbmlReactionParser.java
with
11 additions
and
11 deletions
converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/SbmlReactionParser.java
+
11
−
11
View file @
c1b0296b
...
...
@@ -72,26 +72,27 @@ public class SbmlReactionParser {
return
sbmlModel
.
getListOfReactions
();
}
protected
void
mergeLayout
(
Collection
<
Reaction
>
element
s
,
Layout
sbmlLayout
,
Model
sbmlModel
)
protected
void
mergeLayout
(
Collection
<
Reaction
>
reaction
s
,
Layout
sbmlLayout
,
Model
sbmlModel
)
throws
InvalidInputDataExecption
{
Set
<
Reaction
>
used
=
new
HashSet
<>();
Map
<
String
,
Reaction
>
element
ById
=
new
HashMap
<>();
for
(
Reaction
species
:
element
s
)
{
if
(
element
ById
.
get
(
species
.
getIdReaction
())
!=
null
)
{
throw
new
InvalidInputDataExecption
(
"Duplicated reaction id: "
+
species
.
getIdReaction
());
Map
<
String
,
Reaction
>
reaction
ById
=
new
HashMap
<>();
for
(
Reaction
reaction
:
reaction
s
)
{
if
(
reaction
ById
.
get
(
reaction
.
getIdReaction
())
!=
null
)
{
throw
new
InvalidInputDataExecption
(
"Duplicated reaction id: "
+
reaction
.
getIdReaction
());
}
element
ById
.
put
(
species
.
getIdReaction
(),
species
);
reaction
ById
.
put
(
reaction
.
getIdReaction
(),
reaction
);
}
for
(
ReactionGlyph
glyph
:
sbmlLayout
.
getListOfReactionGlyphs
())
{
Reaction
source
=
element
ById
.
get
(
glyph
.
getReaction
());
Reaction
source
=
reaction
ById
.
get
(
glyph
.
getReaction
());
if
(
source
==
null
)
{
throw
new
InvalidInputDataExecption
(
"Layout contains invalid Species id: "
+
glyph
.
getReaction
());
}
used
.
add
(
source
);
try
{
Reaction
reactionWithLayout
=
source
.
copy
();
reactionWithLayout
.
setIdReaction
(
glyph
.
getId
());
// getId doesn't have to be unique, therefore we concatenate with reaction
reactionWithLayout
.
setIdReaction
(
glyph
.
getId
()
+
"_"
+
glyph
.
getReaction
());
for
(
SpeciesReferenceGlyph
speciesRefernceGlyph
:
glyph
.
getListOfSpeciesReferenceGlyphs
())
{
SpeciesGlyph
speciesGlyph
=
layout
.
getSpeciesGlyph
(
speciesRefernceGlyph
.
getSpeciesGlyph
());
ReactionNode
minervaNode
=
null
;
...
...
@@ -206,16 +207,15 @@ public class SbmlReactionParser {
operator
.
setLine
(
line
);
reactionWithLayout
.
addNode
(
operator
);
}
minervaModel
.
addReaction
(
new
StateTransitionReaction
(
reactionWithLayout
));
}
catch
(
InvalidArgumentException
e
)
{
throw
new
InvalidInputDataExecption
(
e
);
}
}
Set
<
Reaction
>
elementsToRemove
=
new
HashSet
<>();
for
(
Reaction
reaction
:
element
s
)
{
for
(
Reaction
reaction
:
reaction
s
)
{
if
(!
used
.
contains
(
reaction
))
{
logger
.
warn
(
"Layout doesn't contain information about
Element
: "
+
reaction
.
getIdReaction
());
logger
.
warn
(
"Layout doesn't contain information about
Reaction
: "
+
reaction
.
getIdReaction
());
}
else
{
elementsToRemove
.
add
(
reaction
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment