Skip to content

Commit

Permalink
Special Char changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hrani committed Aug 4, 2023
1 parent 7b699e3 commit 6b21f95
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions python/moose/SBML/readSBML.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
Last-Updated: Tue Apr 5 17:10:00 2022(+0530)
By:HarshaRani
**********************************************************************/
2023
Aug3: SBMLread will not accept & and < special character in the name
Moose will not accept '/' (bcos path kinetics/pool etc),#,&,[,],?,/,<
explicitly I was converting space to _space_ which is removed
2022:
Apr 05: - edge case NN_mapk15.g, extra Neutral path '/kinetics' exist which
was not created in xml file which was causing ex12.0* example break
Expand Down Expand Up @@ -523,7 +527,7 @@ def getCmptAnnotation(obj):

def getObjAnnotation(obj, modelAnnotationInfo):
name = obj.getId()
name = name.replace(" ", "_space_")
#name = name.replace(" ", "_space_")
# modelAnnotaInfo= {}
annotateMap = {}
if (obj.getAnnotation() is not None):
Expand Down Expand Up @@ -568,7 +572,7 @@ def getObjAnnotation(obj, modelAnnotationInfo):
def getEnzAnnotation(obj, modelAnnotaInfo, rev,
globparameterIdValue, specInfoMap,funcDef):
name = obj.getId()
name = name.replace(" ", "_space_")
#name = name.replace(" ", "_space_")
# modelAnnotaInfo= {}
annotateMap = {}
if (obj.getAnnotation() is not None):
Expand Down Expand Up @@ -708,7 +712,7 @@ def createReaction(model, specInfoMap, modelAnnotaInfo, globparameterIdValue,fun
# group = groups[0]
if (reac.isSetName()):
rName = reac.getName()
rName = rName.replace(" ", "_space_")
#rName = rName.replace(" ", "_space_")
if not(rName):
rName = rId
rev = reac.getReversible()
Expand Down Expand Up @@ -1264,7 +1268,7 @@ def createSpecies(basePath, model, comptSbmlidMooseIdMap,
# group = groups[0]
if spe.isSetName():
sName = spe.getName()
sName = sName.replace(" ", "_space_")
#sName = sName.replace(" ", "_space_")

if spe.isSetCompartment():
comptId = spe.getCompartment()
Expand Down Expand Up @@ -1471,7 +1475,7 @@ def createCompartment(basePath, model, comptSbmlidMooseIdMap):

if (compt.isSetName()):
name = compt.getName()
name = name.replace(" ", "_space")
#name = name.replace(" ", "_space")

if (compt.isSetOutside()):
outside = compt.getOutside()
Expand Down Expand Up @@ -1613,9 +1617,12 @@ def idBeginWith(name):


def convertSpecialChar(str1):
d = {"&": "_and", "<": "_lessthan_", ">": "_greaterthan_", "BEL": "&#176", "-": "_minus_", "'": "_prime_",
"+": "_plus_", "*": "_star_", "/": "_slash_", "(": "_bo_", ")": "_bc_",
"[": "_sbo_", "]": "_sbc_", " ": "_"
# d = {"&": "_and", "<": "_lessthan_", ">": "_greaterthan_", "BEL": "&#176", "-": "_minus_", "'": "_prime_",
# "+": "_plus_", "*": "_star_", "/": "_slash_", "(": "_bo_", ")": "_bc_",
# "[": "_sbo_", "]": "_sbc_", " ": "_"
# }
d = {"BEL": "&#176" , "'": "_prime_", "/": "_slash_" ,"[": "_sbo_", "]": "_sbc_",
"#" :"_hash_" , "\"":"_quote_" , "?":"_question_" ,"\\":"_slash","&":"_and_","<":"_greater_"
}
for i, j in list(d.items()):
str1 = str1.replace(i, j)
Expand Down

0 comments on commit 6b21f95

Please sign in to comment.