Skip to content

Commit

Permalink
Merge pull request #1369 from virtualcell/sbml-rxn-name-reserved
Browse files Browse the repository at this point in the history
mangle reserved SBML reaction names, e.g. x becomes RESERVED_x
  • Loading branch information
jcschaff authored Oct 22, 2024
2 parents e593d41 + 0dc4451 commit c21f3bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3189,15 +3189,20 @@ private static void addReactions(org.sbml.jsbml.Model sbmlModel, BioModel vcBioM
}
Structure reactionStructure = getReactionStructure(sbmlModel, sbmlReaction, vcBioModel, lambdaFunctions, sbmlSymbolMapping, vcLogger);
final ReactionStep vcReaction;
String reactionStepName = sbmlReaction.getId();
// see if reactionStepName is in the reserved words of Model (e.g. x,y,z,t)
if(vcModel.getReservedSymbolByName(reactionStepName) != null){
reactionStepName = TokenMangler.fixTokenStrict("RESERVED_"+reactionStepName);
}
if(bIsFluxReaction){
if(!(reactionStructure instanceof Membrane)){
throw new SBMLImportException("Flux reaction on " + reactionStructure.getClass().getSimpleName() + ", not a membrane.");
}
vcReaction = new FluxReaction(vcModel, (Membrane) reactionStructure, null, sbmlReaction.getId(), bReversible);
vcReaction = new FluxReaction(vcModel, (Membrane) reactionStructure, null, reactionStepName, bReversible);
sbmlSymbolMapping.putReactionMapping(sbmlReaction, vcReaction);
vcReaction.setModel(vcModel);
} else {
vcReaction = new SimpleReaction(vcModel, reactionStructure, sbmlReaction.getId(), bReversible);
vcReaction = new SimpleReaction(vcModel, reactionStructure, reactionStepName, bReversible);
sbmlSymbolMapping.putReactionMapping(sbmlReaction, vcReaction);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public static Set<Integer> slowModelSet() {

public static Map<Integer, SBMLTestSuiteTest.FAULT> knownFaults() {
HashMap<Integer, SBMLTestSuiteTest.FAULT> faults = new HashMap();
faults.put(15, SBMLTestSuiteTest.FAULT.UNCATEGORIZED); // cause: cannot use reserved symbol 'x' as a Reaction name
faults.put(24, SBMLTestSuiteTest.FAULT.DELAY); // cause: UnsupportedConstruct: unsupported SBML element 'delay' in expression ' <math><apply><times/><ci> compartment_0000004 </ci><ci> rP </ci><apply><power/><apply><csymbol encoding="tex
faults.put(25, SBMLTestSuiteTest.FAULT.DELAY); // cause: UnsupportedConstruct: unsupported SBML element 'delay' in expression ' <math><piecewise><piece><cn> 0 </cn><apply><lt/><apply><minus/><apply><csymbol encoding="text" definitionURL
faults.put(34, SBMLTestSuiteTest.FAULT.DELAY); // cause: UnsupportedConstruct: unsupported SBML element 'delay' in expression ' <math><apply><times/><ci> compartment_0000001 </ci><apply><csymbol encoding="text" definitionURL="http://www
Expand Down

0 comments on commit c21f3bb

Please sign in to comment.