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
071bd368
Commit
071bd368
authored
Mar 30, 2020
by
Piotr Gawron
Browse files
export to cell deisgner should not produce compartment alias id shorter than 2 characters
parent
41725e7d
Pipeline
#23763
failed with stage
in 34 minutes and 43 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
071bd368
...
...
@@ -3,6 +3,8 @@ minerva (14.0.11) stable; urgency=medium
installations
(#
1207
)
*
Bug
fix
:
complex
with
no
border
was
inproperly
imported
from
CellDesigner
(#
1198
)
*
Bug
fix
:
export
to
CellDesigner
deal
with
CellDesigner
issue
that
does
not
allow
complex
species
alias
to
be
shorter
than
2
characters
(#
1204
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
30
Mar
2020
10
:
00
:
00
+
0200
...
...
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerElementCollection.java
View file @
071bd368
...
...
@@ -8,6 +8,7 @@ import org.apache.logging.log4j.Logger;
import
lcsb.mapviewer.common.exception.InvalidArgumentException
;
import
lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerElement
;
import
lcsb.mapviewer.converter.model.celldesigner.structure.fields.CellDesignerModificationResidue
;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.species.*
;
import
lcsb.mapviewer.model.map.species.field.AbstractSiteModification
;
import
lcsb.mapviewer.model.map.species.field.ModificationResidue
;
...
...
@@ -268,4 +269,14 @@ public class CellDesignerElementCollection {
return
getModificationResidueId
(
mr
.
createModificationResidue
(
new
Gene
(
"X"
)),
number
);
}
public
String
getCompartmentAliasId
(
Compartment
ca
)
{
if
(
ca
==
null
)
{
return
null
;
}
if
(
ca
.
getElementId
().
length
()
>=
2
)
{
return
ca
.
getElementId
();
}
return
"ca_prefix_issue_"
+
ca
.
getElementId
();
}
}
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParser.java
View file @
071bd368
...
...
@@ -130,7 +130,7 @@ public class CompartmentAliasXmlParser extends AbstractAliasXmlParser<Compartmen
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
.
append
(
"<celldesigner:compartmentAlias "
);
sb
.
append
(
"id=\""
+
compartment
.
getEle
ment
Id
(
)
+
"\" "
);
sb
.
append
(
"id=\""
+
elements
.
getCompartmentAliasId
(
compart
ment
)
+
"\" "
);
sb
.
append
(
"compartment=\""
+
elements
.
getElementId
(
compartment
)
+
"\">\n"
);
boolean
bounds
=
true
;
...
...
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java
View file @
071bd368
...
...
@@ -139,7 +139,8 @@ public class ComplexAliasXmlParser extends AbstractAliasXmlParser<Complex> {
}
else
if
(
state
.
equalsIgnoreCase
(
"complexparentbrief"
))
{
view
=
briefView
;
}
else
{
throw
new
InvalidXmlSchemaException
(
new
ElementUtils
().
getElementTag
(
result
)+
"Don't know how to process state: "
+
state
);
throw
new
InvalidXmlSchemaException
(
new
ElementUtils
().
getElementTag
(
result
)
+
"Don't know how to process state: "
+
state
);
}
if
(
view
!=
null
)
{
...
...
@@ -195,10 +196,8 @@ public class ComplexAliasXmlParser extends AbstractAliasXmlParser<Complex> {
Complex
complexAlias
=
alias
.
getComplex
();
String
compartmentAliasId
=
null
;
if
(
ca
!=
null
)
{
compartmentAliasId
=
ca
.
getElementId
();
}
String
compartmentAliasId
=
elements
.
getCompartmentAliasId
(
ca
);
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
.
append
(
"<celldesigner:complexSpeciesAlias "
);
sb
.
append
(
"id=\""
+
alias
.
getElementId
()
+
"\" "
);
...
...
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParser.java
View file @
071bd368
...
...
@@ -179,10 +179,8 @@ public class SpeciesAliasXmlParser extends AbstractAliasXmlParser<Species> {
Complex
complex
=
species
.
getComplex
();
String
compartmentAliasId
=
null
;
if
(
ca
!=
null
)
{
compartmentAliasId
=
ca
.
getElementId
();
}
String
compartmentAliasId
=
elements
.
getCompartmentAliasId
(
ca
);
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
.
append
(
"<celldesigner:speciesAlias "
);
sb
.
append
(
"id=\""
+
species
.
getElementId
()
+
"\" "
);
...
...
converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentParserTests.java
View file @
071bd368
package
lcsb.mapviewer.converter.model.celldesigner.compartment
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.*
;
import
lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions
;
import
lcsb.mapviewer.model.map.compartment.Compartment
;
import
lcsb.mapviewer.model.map.compartment.SquareCompartment
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.ModelFullIndexed
;
import
lcsb.mapviewer.model.map.species.Complex
;
import
lcsb.mapviewer.model.map.species.GenericProtein
;
public
class
CompartmentParserTests
extends
CellDesignerTestFunctions
{
Logger
logger
=
LogManager
.
getLogger
(
CompartmentParserTests
.
class
);
...
...
@@ -48,4 +54,42 @@ public class CompartmentParserTests extends CellDesignerTestFunctions {
assertEquals
(
1
,
model
.
getElements
().
size
());
}
@Test
public
void
testToXmlWithCompartmentIdNotRecognizedByCellDesigner
()
throws
Exception
{
Model
model
=
new
ModelFullIndexed
(
null
);
Compartment
compartment
=
new
SquareCompartment
(
"c"
);
compartment
.
setName
(
"xyz"
);
model
.
addElement
(
compartment
);
Model
model2
=
super
.
serializeModel
(
model
);
assertTrue
(
model2
.
getCompartments
().
get
(
0
).
getElementId
().
length
()
>=
2
);
}
@Test
public
void
testToXmlWithCompartmentIdNotRecognizedByCellDesignerAndChildren
()
throws
Exception
{
Model
model
=
new
ModelFullIndexed
(
null
);
Compartment
compartment
=
new
SquareCompartment
(
"c"
);
compartment
.
setName
(
"xyz"
);
model
.
addElement
(
compartment
);
Complex
complex
=
new
Complex
(
"comp"
);
GenericProtein
protein
=
new
GenericProtein
(
"prot1"
);
complex
.
addSpecies
(
protein
);
model
.
addElement
(
complex
);
model
.
addElement
(
protein
);
compartment
.
addElement
(
complex
);
GenericProtein
protein2
=
new
GenericProtein
(
"prot2"
);
compartment
.
addElement
(
protein2
);
model
.
addElement
(
protein2
);
Model
model2
=
super
.
serializeModel
(
model
);
Compartment
compartment2
=
model2
.
getCompartments
().
get
(
0
);
assertEquals
(
compartment2
,
model2
.
getElementByElementId
(
"prot2"
).
getCompartment
());
assertEquals
(
compartment2
,
model2
.
getElementByElementId
(
"comp"
).
getCompartment
());
}
}
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