Commit af397630 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

import of SBML crashed when there was no multi list of species types

parent 0cdb1cfc
......@@ -12,6 +12,8 @@ minerva (15.1.0) unstable; urgency=medium
inside rectangle bounded by the polygon coordinates (#1096)
* Bug fix: continuous refreshing list of project when uploading/removing
project did not allow to change other project details (#996)
* Bug fix: when multi extension did not contain species type list import of
SBML crashed
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 18 Jun 2020 16:00:00 +0200
......
......@@ -298,19 +298,31 @@ public class SbmlSpeciesParser extends SbmlElementParser<org.sbml.jsbml.Species>
private String extractSBOTermFromSpecies(org.sbml.jsbml.Species species) {
String sboTerm = species.getSBOTermID();
MultiSpeciesPlugin multiExtension = (MultiSpeciesPlugin) species.getExtension("multi");
MultiSpeciesType speciesType = getMultiSpeciesType(multiExtension);
if (speciesType != null) {
String sboTerm2 = speciesType.getSBOTermID();
if (sboTerm != null && !sboTerm.isEmpty() && !sboTerm2.equals(sboTerm)) {
logger.warn("Different SBO terms defining species and speciesType: " + species.getId() + ". " + sboTerm + ";"
+ sboTerm2);
} else {
sboTerm = sboTerm2;
}
}
return sboTerm;
}
private MultiSpeciesType getMultiSpeciesType(MultiSpeciesPlugin multiExtension) {
if (multiExtension != null) {
MultiSpeciesType speciesType = getMultiPlugin().getListOfSpeciesTypes().get(multiExtension.getSpeciesType());
if (speciesType != null) {
String sboTerm2 = speciesType.getSBOTermID();
if (sboTerm != null && !sboTerm.isEmpty() && !sboTerm2.equals(sboTerm)) {
logger.warn("Different SBO terms defining species and speciesType: " + species.getId() + ". " + sboTerm + ";"
+ sboTerm2);
} else {
sboTerm = sboTerm2;
MultiModelPlugin modelPlugin = getMultiPlugin();
if (modelPlugin != null) {
ListOf<MultiSpeciesType> listOfSpeciesTypes = modelPlugin.getListOfSpeciesTypes();
if (listOfSpeciesTypes != null) {
return listOfSpeciesTypes.get(multiExtension.getSpeciesType());
}
}
}
return sboTerm;
return null;
}
private void assignModificationResiduesLayout(Element element) {
......
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created by minerva version Unknown on 2020-06-24 at 08:54:37 CEST with JSBML version 1.4. -->
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" multi:required="true" version="2" xmlns:multi="http://www.sbml.org/sbml/level3/version1/multi/version1">
<model id="id1" name="UNKNOWN DISEASE MAP">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#id1">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
<listOfCompartments>
<compartment constant="false" id="default" multi:isType="false" size="1" spatialDimensions="3">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#default">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
</compartment>
</listOfCompartments>
<listOfSpecies>
<species boundaryCondition="false" compartment="default" constant="false" hasOnlySubstanceUnits="false" id="species_0" initialConcentration="0" multi:speciesType="minerva_species_type_GenericProtein" name="SNCA" sboTerm="SBO:0000252">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#species_0">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
</species>
<species boundaryCondition="false" compartment="default" constant="false" hasOnlySubstanceUnits="false" id="species_1" initialConcentration="0" multi:speciesType="minerva_species_type_GenericProtein" name="SNCA 2" sboTerm="SBO:0000252">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#species_0">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
<reaction id="r2" reversible="false" sboTerm="SBO:0000176">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#r2">
<dcterms:modified rdf:parseType="Resource"/>
</rdf:Description>
</rdf:RDF>
</annotation>
<listOfReactants>
<speciesReference constant="false" species="species_0"/>
</listOfReactants>
<listOfProducts>
<speciesReference constant="false" species="species_1"/>
</listOfProducts>
</reaction>
</listOfReactions>
</model>
</sbml>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment