Skip to content

Commit 3aa66d4

Browse files
authored
Merge pull request #338 from hrani/master
reading and writing diff and motor constant for pool
2 parents d6e5711 + 356f43c commit 3aa66d4

File tree

2 files changed

+44
-35
lines changed

2 files changed

+44
-35
lines changed

python/moose/SBML/readSBML.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS
1414
Created : Thu May 13 10:19:00 2016(+0530)
1515
Version
16-
Last-Updated: Fri Nov 30 17:30:00 2018(+0530)
16+
Last-Updated: Tue Dec 3 17:30:00 2018(+0530)
1717
By:HarshaRani
1818
**********************************************************************/
1919
2018
20+
Dec 3: - reading motor and diffconstant from pool
2021
Nov 30: - groups and subgroups are read from xml to moose
2122
Nov 19: - reading and creating CylMesh and EndoMesh if specified in the Annotation field in compartment
2223
definition, also checking if EndoMesh missing/wrong surround compartment
@@ -481,6 +482,10 @@ def getObjAnnotation(obj, modelAnnotationInfo):
481482
annotateMap[nodeName] = nodeValue
482483
if nodeName == "Compartment":
483484
annotateMap[nodeName] = nodeValue
485+
if nodeName == "diffConstant":
486+
annotateMap[nodeName] = nodeValue
487+
if nodeName == "motorConstant":
488+
annotateMap[nodeName] = nodeValue
484489
return annotateMap
485490

486491

@@ -1211,7 +1216,10 @@ def createSpecies(basePath, model, comptSbmlidMooseIdMap,
12111216
poolInfo.color = v
12121217
elif k == 'Color':
12131218
poolInfo.textColor = v
1214-
1219+
elif k == 'diffConstant':
1220+
poolId.diffConst = float(v)
1221+
elif k == 'motorConstant':
1222+
poolId.motorConst = float(v)
12151223
specInfoMap[sId] = {
12161224
"Mpath": poolId,
12171225
"const": constant,

python/moose/SBML/writeSBML.py

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
** copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS
1414
Created : Friday May 27 12:19:00 2016(+0530)
1515
Version
16-
Last-Updated: Fri 30 Nov 15:15:10 2018(+0530)
16+
Last-Updated: Tue 3 Dec 15:15:10 2018(+0530)
1717
By: HarshaRani
1818
**********************************************************************/
1919
/****************************
2020
2018
21+
Dec 03: add diff and motor constants to pool
2122
Nov 30: group id is changed from name to moose_id and group.name is added along with annotation for group listing
2223
Nov 22: searched for _xfer_ instead of xfer
2324
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):
978979

979980
element = moose.element(spe)
980981
ele = getGroupinfo(element)
981-
if element.className == "Neutral" or Anno.color or Anno.textColor or sceneitems or Anno.x or Anno.y:
982-
speciannoexist = True
983-
if speciannoexist:
984-
speciAnno = "<moose:ModelAnnotation>\n"
985-
if ele.className == "Neutral":
986-
#speciAnno = speciAnno + "<moose:Group>" + ele.name + "</moose:Group>\n"
987-
if ele not in speGroup:
988-
speGroup[ele]=[spename]
989-
else:
990-
speGroup[ele].append(spename)
991-
992-
993-
if sceneitems:
994-
#Saved from GUI, then scene co-ordinates are passed
995-
speciAnno = speciAnno + "<moose:xCord>" + \
996-
str(sceneitems[spe]['x']) + "</moose:xCord>\n" + \
997-
"<moose:yCord>" + \
998-
str(sceneitems[spe]['y'])+ "</moose:yCord>\n"
982+
983+
speciAnno = "<moose:ModelAnnotation>\n"
984+
if ele.className == "Neutral":
985+
#speciAnno = speciAnno + "<moose:Group>" + ele.name + "</moose:Group>\n"
986+
if ele not in speGroup:
987+
speGroup[ele]=[spename]
999988
else:
1000-
#Saved from cmdline,genesis coordinates are kept as its
1001-
# SBML, cspace, python, then auto-coordinates are done
1002-
#and coordinates are updated in moose Annotation field
1003-
speciAnno = speciAnno + "<moose:xCord>" + \
1004-
str(Anno.x) + "</moose:xCord>\n" + \
1005-
"<moose:yCord>" + \
1006-
str(Anno.y)+ "</moose:yCord>\n"
1007-
if Anno.color:
1008-
speciAnno = speciAnno + "<moose:bgColor>" + Anno.color + "</moose:bgColor>\n"
1009-
if Anno.textColor:
1010-
speciAnno = speciAnno + "<moose:textColor>" + \
1011-
Anno.textColor + "</moose:textColor>\n"
1012-
speciAnno = speciAnno + "</moose:ModelAnnotation>"
1013-
s1.setAnnotation(speciAnno)
989+
speGroup[ele].append(spename)
990+
991+
992+
if sceneitems:
993+
#Saved from GUI, then scene co-ordinates are passed
994+
speciAnno = speciAnno + "<moose:xCord>" + \
995+
str(sceneitems[spe]['x']) + "</moose:xCord>\n" + \
996+
"<moose:yCord>" + \
997+
str(sceneitems[spe]['y'])+ "</moose:yCord>\n"
998+
else:
999+
#Saved from cmdline,genesis coordinates are kept as its
1000+
# SBML, cspace, python, then auto-coordinates are done
1001+
#and coordinates are updated in moose Annotation field
1002+
speciAnno = speciAnno + "<moose:xCord>" + \
1003+
str(Anno.x) + "</moose:xCord>\n" + \
1004+
"<moose:yCord>" + \
1005+
str(Anno.y)+ "</moose:yCord>\n"
1006+
if Anno.color:
1007+
speciAnno = speciAnno + "<moose:bgColor>" + Anno.color + "</moose:bgColor>\n"
1008+
if Anno.textColor:
1009+
speciAnno = speciAnno + "<moose:textColor>" + \
1010+
Anno.textColor + "</moose:textColor>\n"
1011+
speciAnno = speciAnno + "<moose:diffConstant>" + str(spe.diffConst) + "</moose:diffConstant>\n"
1012+
speciAnno = speciAnno + "<moose:motorConstant>" + str(spe.motorConst)+ "</moose:motorConstant>\n"
1013+
speciAnno = speciAnno + "</moose:ModelAnnotation>"
1014+
s1.setAnnotation(speciAnno)
10141015
return True
10151016

10161017

0 commit comments

Comments
 (0)