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
d330f71c
Commit
d330f71c
authored
Dec 02, 2019
by
Piotr Gawron
Browse files
sbml file always contain model identifier
parent
c5bd8ead
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
d330f71c
...
...
@@ -11,6 +11,7 @@ minerva (14.0.5) stable; urgency=medium
*
Bug
fix
:
search
for
NADH
drug
resulted
in
drug
with
empty
name
(#
1018
)
*
Bug
fix
:
export
to
SBML
didn
't handle properly arrows (#1015)
* Bug fix: Font colour of text area was preserved in Empty view (#1014)
* Bug fix: exported sbml file always contain model identifier (#1013)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 02 Dec 2019 16:00:00 +0200
...
...
converter-sbml/src/main/java/lcsb/mapviewer/converter/model/sbml/SbmlExporter.java
View file @
d330f71c
...
...
@@ -79,6 +79,9 @@ public class SbmlExporter {
}
catch
(
IllegalArgumentException
e
)
{
logger
.
warn
(
"Invalid model identifier: \""
+
model
.
getIdModel
()
+
"\". Ignoring."
);
}
if
(
model
.
getIdModel
()
==
null
||
model
.
getIdModel
().
isEmpty
())
{
model
.
setIdModel
(
"unknown"
);
}
result
.
setName
(
model
.
getName
());
try
{
result
.
setNotes
(
NotesUtility
.
prepareEscapedXmlNotes
(
model
.
getNotes
()));
...
...
converter-sbml/src/test/java/lcsb/mapviewer/converter/model/sbml/GenericSbmlToXmlParserTest.java
View file @
d330f71c
...
...
@@ -3,8 +3,8 @@ package lcsb.mapviewer.converter.model.sbml;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
java.io.
File
;
import
java.io.
IOException
;
import
java.io.
*
;
import
java.
n
io.
charset.StandardCharsets
;
import
java.nio.file.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
...
...
@@ -17,7 +17,8 @@ import org.junit.runner.RunWith;
import
org.junit.runners.Parameterized
;
import
org.junit.runners.Parameterized.Parameters
;
import
lcsb.mapviewer.converter.ConverterParams
;
import
lcsb.mapviewer.converter.*
;
import
lcsb.mapviewer.model.map.InconsistentModelException
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.ModelComparator
;
...
...
@@ -50,26 +51,32 @@ public class GenericSbmlToXmlParserTest extends SbmlTestFunctions {
@Test
public
void
toXmlModelTest
()
throws
Exception
{
String
dir
=
Files
.
createTempDirectory
(
"sbgn-temp-images-dir"
).
toFile
().
getAbsolutePath
();
SbmlParser
converter
=
new
SbmlParser
();
converter
.
setProvideDefaults
(
false
);
Model
model
=
converter
.
createModel
(
new
ConverterParams
().
filename
(
filePath
.
toString
()));
model
.
setName
(
null
);
testSbmlSerialization
(
model
);
}
private
void
testSbmlSerialization
(
Model
model
)
throws
InconsistentModelException
,
IOException
,
ConverterException
,
InvalidInputDataExecption
,
FileNotFoundException
{
String
pathWithouExtension
=
dir
+
"/"
+
filePath
.
getFileName
().
toString
().
substring
(
0
,
filePath
.
getFileName
().
toString
().
indexOf
(
".xml"
));
String
xmlFilePath
=
pathWithouExtension
.
concat
(
".xml"
);
converter
.
model2File
(
model
,
xmlFilePath
);
SbmlParser
converter
=
new
SbmlParser
();
converter
.
setProvideDefaults
(
false
);
String
xml
=
converter
.
model2String
(
model
);
InputStream
stream
=
new
ByteArrayInputStream
(
xml
.
getBytes
(
StandardCharsets
.
UTF_8
));
Model
model2
=
converter
.
createModel
(
new
ConverterParams
().
inputStream
(
stream
).
sizeAutoAdjust
(
false
));
Model
model2
=
converter
.
createModel
(
new
ConverterParams
().
filename
(
xmlFilePath
).
sizeAutoAdjust
(
false
)
);
model
.
setName
(
null
);
model2
.
setName
(
null
);
model
.
setIdModel
(
"unk"
);
model2
.
setIdModel
(
"unk"
);
assertNotNull
(
model2
);
ModelComparator
comparator
=
new
ModelComparator
(
1.0
);
assertEquals
(
0
,
comparator
.
compare
(
model
,
model2
));
FileUtils
.
deleteDirectory
(
new
File
(
dir
));
}
}
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