Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
feb9892f
Commit
feb9892f
authored
Nov 05, 2019
by
Piotr Gawron
Browse files
import of structural state added
parent
7a5f3553
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
feb9892f
minerva
(
15.0.0
~
alpha
.1
)
stable
;
urgency
=
medium
minerva
(
15.0.0
~
alpha
.1
)
stable
;
urgency
=
medium
*
Small
improvement
:
sort
order
of
tables
in
admin
panel
is
preserved
among
*
Small
improvement
:
sort
order
of
tables
in
admin
panel
is
preserved
among
sessions
(#
836
)
sessions
(#
836
)
*
Bug
fix
:
structural
states
of
proteins
are
imported
properly
from
SBGNML
PD
(#
995
)
minerva
(
15.0.0
~
alpha
.0
)
stable
;
urgency
=
medium
minerva
(
15.0.0
~
alpha
.0
)
stable
;
urgency
=
medium
*
Improvement
:
logs
provided
for
validation
data
model
are
structurized
(#
325
)
*
Improvement
:
logs
provided
for
validation
data
model
are
structurized
(#
325
)
...
...
converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java
View file @
feb9892f
...
@@ -585,10 +585,20 @@ public class SbgnmlXmlParser {
...
@@ -585,10 +585,20 @@ public class SbgnmlXmlParser {
for
(
Glyph
child
:
children
)
{
for
(
Glyph
child
:
children
)
{
if
(
GlyphClazz
.
fromClazz
(
child
.
getClazz
()).
equals
(
GlyphClazz
.
STATE_VARIABLE
))
{
if
(
GlyphClazz
.
fromClazz
(
child
.
getClazz
()).
equals
(
GlyphClazz
.
STATE_VARIABLE
))
{
if
(
child
.
getState
()
==
null
||
child
.
getState
().
getVariable
()
!=
null
)
{
if
(
child
.
getState
()
==
null
||
child
.
getState
().
getVariable
()
!=
null
)
{
try
{
Residue
residue
=
stateVariableToResidue
(
child
);
parseStateVariable
(
child
,
newSpecies
);
if
(
residue
!=
null
)
{
}
catch
(
Exception
ex
)
{
if
(
newSpecies
instanceof
Protein
)
{
logger
.
warn
(
ex
.
getMessage
());
((
Protein
)
newSpecies
).
addResidue
(
residue
);
}
else
{
logger
.
warn
(
"Only macromolecule elements can have state variables."
);
}
}
else
{
StructuralState
state
=
stateVariableToStructuralState
(
child
);
if
(
newSpecies
instanceof
Protein
)
{
((
Protein
)
newSpecies
).
setStructuralState
(
state
);
}
else
{
logger
.
warn
(
"Only macromolecule elements can have state."
);
}
}
}
}
else
{
}
else
{
if
(
newSpecies
instanceof
Protein
)
{
if
(
newSpecies
instanceof
Protein
)
{
...
@@ -610,6 +620,20 @@ public class SbgnmlXmlParser {
...
@@ -610,6 +620,20 @@ public class SbgnmlXmlParser {
}
}
private
StructuralState
stateVariableToStructuralState
(
Glyph
glyph
)
{
StructuralState
state
=
new
StructuralState
();
state
.
setFontSize
(
10
);
state
.
setPosition
(
new
Point2D
.
Double
(
glyph
.
getBbox
().
getX
(),
glyph
.
getBbox
().
getY
()));
state
.
setHeight
((
double
)
glyph
.
getBbox
().
getH
());
state
.
setWidth
((
double
)
glyph
.
getBbox
().
getW
());
if
(
glyph
.
getState
()
!=
null
)
{
state
.
setValue
(
glyph
.
getState
().
getValue
());
}
return
state
;
}
private
StructuralState
createStructuralState
(
Glyph
glyph
)
{
private
StructuralState
createStructuralState
(
Glyph
glyph
)
{
StructuralState
structuralState
=
new
StructuralState
();
StructuralState
structuralState
=
new
StructuralState
();
...
@@ -775,20 +799,19 @@ public class SbgnmlXmlParser {
...
@@ -775,20 +799,19 @@ public class SbgnmlXmlParser {
*
*
* @param unitOfInformationGlyph
* @param unitOfInformationGlyph
* unit of information glyph from sbgn-ml file
* unit of information glyph from sbgn-ml file
* @param species
* species that the unit of information considers
* @throws Exception
* @throws Exception
* Exception is thrown if state variable is parsed for species other
* Exception is thrown if state variable is parsed for species other
* than Protein
* than Protein
*/
*/
private
void
parseStateVariable
(
Glyph
unitOfInformationGlyph
,
Species
species
)
{
private
Residue
stateVariableToResidue
(
Glyph
unitOfInformationGlyph
)
{
if
(!(
species
instanceof
Protein
))
{
if
(
unitOfInformationGlyph
.
getState
()
!=
null
&&
(
unitOfInformationGlyph
.
getState
().
getVariable
()
==
null
throw
new
InvalidArgumentException
(
"Only macromolecule elements can have state variables."
);
||
unitOfInformationGlyph
.
getState
().
getVariable
().
trim
().
isEmpty
()))
{
return
null
;
}
}
Protein
protein
=
(
Protein
)
species
;
Residue
mr
=
new
Residue
();
Residue
mr
=
new
Residue
();
mr
.
setSpecies
(
protein
);
mr
.
setIdModificationResidue
(
unitOfInformationGlyph
.
getId
());
mr
.
setIdModificationResidue
(
unitOfInformationGlyph
.
getId
());
if
(
unitOfInformationGlyph
.
getState
()
!=
null
)
{
if
(
unitOfInformationGlyph
.
getState
()
!=
null
)
{
// If State variable consists of value and variable
// If State variable consists of value and variable
...
@@ -806,7 +829,7 @@ public class SbgnmlXmlParser {
...
@@ -806,7 +829,7 @@ public class SbgnmlXmlParser {
mr
.
setPosition
(
new
Point2D
.
Double
(
x
,
y
));
mr
.
setPosition
(
new
Point2D
.
Double
(
x
,
y
));
protein
.
addResidue
(
mr
)
;
return
mr
;
}
}
/**
/**
...
...
converter-SBGNML/src/test/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParserTest2.java
View file @
feb9892f
...
@@ -14,8 +14,7 @@ import lcsb.mapviewer.converter.ConverterParams;
...
@@ -14,8 +14,7 @@ import lcsb.mapviewer.converter.ConverterParams;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.reaction.*
;
import
lcsb.mapviewer.model.map.reaction.*
;
import
lcsb.mapviewer.model.map.species.Complex
;
import
lcsb.mapviewer.model.map.species.*
;
import
lcsb.mapviewer.model.map.species.GenericProtein
;
import
lcsb.mapviewer.model.map.species.field.Residue
;
import
lcsb.mapviewer.model.map.species.field.Residue
;
public
class
SbgnmlXmlParserTest2
extends
SbgnmlTestFunctions
{
public
class
SbgnmlXmlParserTest2
extends
SbgnmlTestFunctions
{
...
@@ -105,4 +104,15 @@ public class SbgnmlXmlParserTest2 extends SbgnmlTestFunctions {
...
@@ -105,4 +104,15 @@ public class SbgnmlXmlParserTest2 extends SbgnmlTestFunctions {
assertEquals
(
p2
.
getLine
().
getBeginPoint
(),
outputOperator
.
getLine
().
getBeginPoint
());
assertEquals
(
p2
.
getLine
().
getBeginPoint
(),
outputOperator
.
getLine
().
getBeginPoint
());
}
}
@Test
public
void
testProteinState
()
throws
Exception
{
Converter
converter
=
new
SbgnmlXmlConverter
();
Model
model
=
converter
.
createModel
(
new
ConverterParams
().
filename
(
"testFiles/sbgnmlCellDesignerInompatible/stateVariable.sbgn"
));
Protein
protein
=
model
.
getElementByElementId
(
"glyph_n20"
);
assertEquals
(
"inactive"
,
protein
.
getStructuralState
().
getValue
());
assertEquals
(
0
,
protein
.
getModificationResidues
().
size
());
}
}
}
converter-SBGNML/testFiles/sbgnmlCellDesignerInompatible/stateVariable.sbgn
0 → 100644
View file @
feb9892f
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sbgn
xmlns=
"http://sbgn.org/libsbgn/0.2"
>
<map
language=
"process description"
>
<glyph
class=
"macromolecule"
id=
"glyph_n20"
>
<label
text=
"PKA"
/>
<bbox
w=
"80.0"
h=
"40.0"
x=
"662.7319"
y=
"21.57837"
/>
<glyph
class=
"state variable"
id=
"glyph_n20_4"
>
<state
value=
"inactive"
variable=
""
/>
<bbox
w=
"50.0"
h=
"18.0"
x=
"677.7319"
y=
"51.86792"
/>
</glyph>
</glyph>
</map>
</sbgn>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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