From 356f43ce72d8076fe1977b02b810bb75af92cf85 Mon Sep 17 00:00:00 2001 From: HarshaRani Date: Tue, 4 Dec 2018 15:59:06 +0530 Subject: [PATCH] reading and writing diff and motor constant for pool --- python/moose/SBML/readSBML.py | 12 +++++- python/moose/SBML/writeSBML.py | 67 +++++++++++++++++----------------- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/python/moose/SBML/readSBML.py b/python/moose/SBML/readSBML.py index f59c8f91ad..137e5179d3 100644 --- a/python/moose/SBML/readSBML.py +++ b/python/moose/SBML/readSBML.py @@ -13,10 +13,11 @@ ** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS Created : Thu May 13 10:19:00 2016(+0530) Version -Last-Updated: Fri Nov 30 17:30:00 2018(+0530) +Last-Updated: Tue Dec 3 17:30:00 2018(+0530) By:HarshaRani **********************************************************************/ 2018 +Dec 3: - reading motor and diffconstant from pool Nov 30: - groups and subgroups are read from xml to moose Nov 19: - reading and creating CylMesh and EndoMesh if specified in the Annotation field in compartment definition, also checking if EndoMesh missing/wrong surround compartment @@ -481,6 +482,10 @@ def getObjAnnotation(obj, modelAnnotationInfo): annotateMap[nodeName] = nodeValue if nodeName == "Compartment": annotateMap[nodeName] = nodeValue + if nodeName == "diffConstant": + annotateMap[nodeName] = nodeValue + if nodeName == "motorConstant": + annotateMap[nodeName] = nodeValue return annotateMap @@ -1211,7 +1216,10 @@ def createSpecies(basePath, model, comptSbmlidMooseIdMap, poolInfo.color = v elif k == 'Color': poolInfo.textColor = v - + elif k == 'diffConstant': + poolId.diffConst = float(v) + elif k == 'motorConstant': + poolId.motorConst = float(v) specInfoMap[sId] = { "Mpath": poolId, "const": constant, diff --git a/python/moose/SBML/writeSBML.py b/python/moose/SBML/writeSBML.py index 9d180a547d..8c83e4d8d6 100644 --- a/python/moose/SBML/writeSBML.py +++ b/python/moose/SBML/writeSBML.py @@ -13,11 +13,12 @@ ** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS Created : Friday May 27 12:19:00 2016(+0530) Version -Last-Updated: Fri 30 Nov 15:15:10 2018(+0530) +Last-Updated: Tue 3 Dec 15:15:10 2018(+0530) By: HarshaRani **********************************************************************/ /**************************** 2018 +Dec 03: add diff and motor constants to pool Nov 30: group id is changed from name to moose_id and group.name is added along with annotation for group listing Nov 22: searched for _xfer_ instead of xfer Nov 12: xfer cross compartment molecules are not written to SBML instead written the original molecule also for connecting Reaction and Enzyme @@ -978,39 +979,39 @@ def writeSpecies(modelpath, cremodel_, sbmlDoc, sceneitems,speGroup): element = moose.element(spe) ele = getGroupinfo(element) - if element.className == "Neutral" or Anno.color or Anno.textColor or sceneitems or Anno.x or Anno.y: - speciannoexist = True - if speciannoexist: - speciAnno = "\n" - if ele.className == "Neutral": - #speciAnno = speciAnno + "" + ele.name + "\n" - if ele not in speGroup: - speGroup[ele]=[spename] - else: - speGroup[ele].append(spename) - - - if sceneitems: - #Saved from GUI, then scene co-ordinates are passed - speciAnno = speciAnno + "" + \ - str(sceneitems[spe]['x']) + "\n" + \ - "" + \ - str(sceneitems[spe]['y'])+ "\n" + + speciAnno = "\n" + if ele.className == "Neutral": + #speciAnno = speciAnno + "" + ele.name + "\n" + if ele not in speGroup: + speGroup[ele]=[spename] else: - #Saved from cmdline,genesis coordinates are kept as its - # SBML, cspace, python, then auto-coordinates are done - #and coordinates are updated in moose Annotation field - speciAnno = speciAnno + "" + \ - str(Anno.x) + "\n" + \ - "" + \ - str(Anno.y)+ "\n" - if Anno.color: - speciAnno = speciAnno + "" + Anno.color + "\n" - if Anno.textColor: - speciAnno = speciAnno + "" + \ - Anno.textColor + "\n" - speciAnno = speciAnno + "" - s1.setAnnotation(speciAnno) + speGroup[ele].append(spename) + + + if sceneitems: + #Saved from GUI, then scene co-ordinates are passed + speciAnno = speciAnno + "" + \ + str(sceneitems[spe]['x']) + "\n" + \ + "" + \ + str(sceneitems[spe]['y'])+ "\n" + else: + #Saved from cmdline,genesis coordinates are kept as its + # SBML, cspace, python, then auto-coordinates are done + #and coordinates are updated in moose Annotation field + speciAnno = speciAnno + "" + \ + str(Anno.x) + "\n" + \ + "" + \ + str(Anno.y)+ "\n" + if Anno.color: + speciAnno = speciAnno + "" + Anno.color + "\n" + if Anno.textColor: + speciAnno = speciAnno + "" + \ + Anno.textColor + "\n" + speciAnno = speciAnno + "" + str(spe.diffConst) + "\n" + speciAnno = speciAnno + "" + str(spe.motorConst)+ "\n" + speciAnno = speciAnno + "" + s1.setAnnotation(speciAnno) return True