Skip to content

Commit

Permalink
reading and writing diff and motor constant for pool
Browse files Browse the repository at this point in the history
  • Loading branch information
hrani committed Dec 4, 2018
1 parent fac76ad commit 356f43c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 35 deletions.
12 changes: 10 additions & 2 deletions python/moose/SBML/readSBML.py
Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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,
Expand Down
67 changes: 34 additions & 33 deletions python/moose/SBML/writeSBML.py
Expand Up @@ -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
Expand Down Expand Up @@ -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 = "<moose:ModelAnnotation>\n"
if ele.className == "Neutral":
#speciAnno = speciAnno + "<moose:Group>" + ele.name + "</moose:Group>\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 + "<moose:xCord>" + \
str(sceneitems[spe]['x']) + "</moose:xCord>\n" + \
"<moose:yCord>" + \
str(sceneitems[spe]['y'])+ "</moose:yCord>\n"

speciAnno = "<moose:ModelAnnotation>\n"
if ele.className == "Neutral":
#speciAnno = speciAnno + "<moose:Group>" + ele.name + "</moose:Group>\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 + "<moose:xCord>" + \
str(Anno.x) + "</moose:xCord>\n" + \
"<moose:yCord>" + \
str(Anno.y)+ "</moose:yCord>\n"
if Anno.color:
speciAnno = speciAnno + "<moose:bgColor>" + Anno.color + "</moose:bgColor>\n"
if Anno.textColor:
speciAnno = speciAnno + "<moose:textColor>" + \
Anno.textColor + "</moose:textColor>\n"
speciAnno = speciAnno + "</moose:ModelAnnotation>"
s1.setAnnotation(speciAnno)
speGroup[ele].append(spename)


if sceneitems:
#Saved from GUI, then scene co-ordinates are passed
speciAnno = speciAnno + "<moose:xCord>" + \
str(sceneitems[spe]['x']) + "</moose:xCord>\n" + \
"<moose:yCord>" + \
str(sceneitems[spe]['y'])+ "</moose:yCord>\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 + "<moose:xCord>" + \
str(Anno.x) + "</moose:xCord>\n" + \
"<moose:yCord>" + \
str(Anno.y)+ "</moose:yCord>\n"
if Anno.color:
speciAnno = speciAnno + "<moose:bgColor>" + Anno.color + "</moose:bgColor>\n"
if Anno.textColor:
speciAnno = speciAnno + "<moose:textColor>" + \
Anno.textColor + "</moose:textColor>\n"
speciAnno = speciAnno + "<moose:diffConstant>" + str(spe.diffConst) + "</moose:diffConstant>\n"
speciAnno = speciAnno + "<moose:motorConstant>" + str(spe.motorConst)+ "</moose:motorConstant>\n"
speciAnno = speciAnno + "</moose:ModelAnnotation>"
s1.setAnnotation(speciAnno)
return True


Expand Down

0 comments on commit 356f43c

Please sign in to comment.