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
76d6bcf1
Commit
76d6bcf1
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
compartments have parent compartments assigned
parent
a3512012
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!44
Resolve "semantic zoom"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java
+35
-20
35 additions, 20 deletions
...csb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java
with
35 additions
and
20 deletions
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java
+
35
−
20
View file @
76d6bcf1
...
...
@@ -62,6 +62,7 @@ import lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction;
import
lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction
;
import
lcsb.mapviewer.model.map.species.Complex
;
import
lcsb.mapviewer.model.map.species.Degraded
;
import
lcsb.mapviewer.model.map.species.Element
;
import
lcsb.mapviewer.model.map.species.Gene
;
import
lcsb.mapviewer.model.map.species.GenericProtein
;
import
lcsb.mapviewer.model.map.species.Phenotype
;
...
...
@@ -622,49 +623,58 @@ public class SbgnmlXmlParser {
}
}
parse
Alia
s
(
g
,
newSpecies
,
model
);
parse
Specie
s
(
g
,
newSpecies
,
model
);
}
/**
* Method used to create a new alias from SBGN-ML glyph.
*
* @param g
* @param g
lyph
* SBGN-ML glyph representing the alias
* @param
newS
pecies
* @param
s
pecies
* species of the alias
* @param model
* model to be updated
*/
private
void
parse
Alia
s
(
Glyph
g
,
Species
newS
pecies
,
Model
model
)
{
newS
pecies
.
setHeight
(
new
Double
(
g
.
getBbox
().
getH
()));
newS
pecies
.
setWidth
(
new
Double
(
g
.
getBbox
().
getW
()));
newS
pecies
.
setX
(
new
Double
(
g
.
getBbox
().
getX
()));
newS
pecies
.
setY
(
new
Double
(
g
.
getBbox
().
getY
()));
private
void
parse
Specie
s
(
Glyph
g
lyph
,
Species
s
pecies
,
Model
model
)
{
s
pecies
.
setHeight
(
new
Double
(
g
lyph
.
getBbox
().
getH
()));
s
pecies
.
setWidth
(
new
Double
(
g
lyph
.
getBbox
().
getW
()));
s
pecies
.
setX
(
new
Double
(
g
lyph
.
getBbox
().
getX
()));
s
pecies
.
setY
(
new
Double
(
g
lyph
.
getBbox
().
getY
()));
Compartment
parentCompartment
=
null
;
if
(
g
.
getCompartmentRef
()
!=
null
)
{
Glyph
compartmentGlyph
=
(
Glyph
)
g
.
getCompartmentRef
();
if
(
g
lyph
.
getCompartmentRef
()
!=
null
)
{
Glyph
compartmentGlyph
=
(
Glyph
)
g
lyph
.
getCompartmentRef
();
parentCompartment
=
model
.
getElementByElementId
(
compartmentGlyph
.
getId
());
}
else
if
(
newSpecies
.
getComplex
()
==
null
)
{
// If the alias is in any compartment, assign it to that compartment
parentCompartment
=
findParentCompartment
(
newSpecies
,
model
);
}
else
if
(
species
.
getComplex
()
==
null
)
{
parentCompartment
=
findParentCompartment
(
species
,
model
);
}
if
(
parentCompartment
!=
null
)
{
newS
pecies
.
setCompartment
(
parentCompartment
);
parentCompartment
.
addElement
(
newS
pecies
);
if
(
parentCompartment
!=
null
)
{
s
pecies
.
setCompartment
(
parentCompartment
);
parentCompartment
.
addElement
(
s
pecies
);
}
// Parse units of information
for
(
Glyph
child
:
g
.
getGlyph
())
{
for
(
Glyph
child
:
g
lyph
.
getGlyph
())
{
if
(
GlyphClazz
.
fromClazz
(
child
.
getClazz
()).
equals
(
GlyphClazz
.
UNIT_OF_INFORMATION
))
{
parseUnitOfInformation
(
child
,
newS
pecies
);
parseUnitOfInformation
(
child
,
s
pecies
);
}
}
model
.
addElement
(
newS
pecies
);
model
.
addElement
(
s
pecies
);
}
private
Compartment
findParentCompartment
(
Species
child
,
Model
model
)
{
/**
* Finds a compartment where element should be located (base on the
* coordinates).
*
* @param child
* {@link Element} for which we want to find compartment
* @param model
* {@link Model} where we look for a compartment
* @return parent {@link Compartment}
*/
private
Compartment
findParentCompartment
(
Element
child
,
Model
model
)
{
Compartment
nullParent
=
new
Compartment
(
"null"
);
nullParent
.
setWidth
(
Double
.
MAX_VALUE
);
nullParent
.
setHeight
(
Double
.
MAX_VALUE
);
...
...
@@ -1514,6 +1524,11 @@ public class SbgnmlXmlParser {
compartment
.
setNamePoint
(
compartment
.
getX
()
+
compartment
.
getThickness
()
+
CONTAINER_NAME_MARGIN
,
compartment
.
getY
()
+
compartment
.
getThickness
()
+
CONTAINER_NAME_MARGIN
);
}
Compartment
parent
=
findParentCompartment
(
compartment
,
model
);
if
(
parent
!=
null
)
{
compartment
.
setCompartment
(
parent
);
parent
.
addElement
(
compartment
);
}
model
.
addElement
(
compartment
);
}
...
...
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