|
60 | 60 | #Todo : To be written |
61 | 61 | # --StimulusTable |
62 | 62 |
|
63 | | -def mooseWriteKkit( modelpath, filename, sceneitems={}): |
| 63 | +def mooseWriteKkit( modelpath, filename, sceneitems={},deletedanglingObj=True): |
64 | 64 | global foundmatplotlib_ |
65 | 65 | if not foundmatplotlib_: |
66 | 66 | print('No maplotlib found.' |
@@ -114,10 +114,10 @@ def mooseWriteKkit( modelpath, filename, sceneitems={}): |
114 | 114 | error = writePool(modelpath,f,gtId_vol,sceneitems) |
115 | 115 | errors = errors+error |
116 | 116 |
|
117 | | - reacList,error= writeReac(modelpath,f,sceneitems) |
| 117 | + reacList,error= writeReac(modelpath,f,sceneitems,deletedanglingObj) |
118 | 118 | errors = errors+error |
119 | 119 |
|
120 | | - enzList,error = writeEnz(modelpath,f,sceneitems) |
| 120 | + enzList,error = writeEnz(modelpath,f,sceneitems,deletedanglingObj) |
121 | 121 | errors = errors+error |
122 | 122 |
|
123 | 123 | chanList, error = writeConcChan(modelpath,f,sceneitems) |
@@ -287,9 +287,18 @@ def writeConcChan(modelpath,f,sceneitems): |
287 | 287 | " " + str(int(x)) + " " + str(int(y)) + " "+str(int(0))+"\n") |
288 | 288 |
|
289 | 289 | return concChanList,error |
290 | | -def writeEnz( modelpath,f,sceneitems): |
| 290 | +def writeEnz( modelpath,f,sceneitems,deletedanglingObj): |
291 | 291 | error = "" |
292 | 292 | enzList = moose.wildcardFind(modelpath+'/##[0][ISA=EnzBase]') |
| 293 | + enzListnew = [] |
| 294 | + if deletedanglingObj == True: |
| 295 | + for enz in enzList: |
| 296 | + if (enz.numSubstrates != 0 and enz.numProducts != 0): |
| 297 | + enzListnew.append(enz) |
| 298 | + else: |
| 299 | + |
| 300 | + error = error+"\n"+enz.className+ " - "+enz.parent.parent.name +" - "+enz.name+" doesn't have substrate or product" |
| 301 | + enzList = enzListnew |
293 | 302 | for enz in enzList: |
294 | 303 | if findCompartment(enz) == moose.element('/'): |
295 | 304 | error = error + " \n "+enz.path+ " doesn't have compartment ignored to write to genesis" |
@@ -392,9 +401,17 @@ def storeReacMsg(reacList,f): |
392 | 401 | s = s + "addmsg /kinetics/" + reacPath + " /kinetics/" + trimPath( prd ) + " REAC B A\n"; |
393 | 402 | f.write( s) |
394 | 403 |
|
395 | | -def writeReac(modelpath,f,sceneitems): |
| 404 | +def writeReac(modelpath,f,sceneitems,deletedanglingObj): |
396 | 405 | error = "" |
397 | 406 | reacList = moose.wildcardFind(modelpath+'/##[0][ISA=Reac]') |
| 407 | + reacListnew = [] |
| 408 | + if deletedanglingObj == True: |
| 409 | + for reac in reacList: |
| 410 | + if (reac.numProducts != 0 and reac.numSubstrates != 0): |
| 411 | + reacListnew.append(reac) |
| 412 | + else: |
| 413 | + error = error+"\n"+reac.className+" - "+reac.parent.name+ " - "+reac.name+" doesn't have substrate or product" |
| 414 | + reacList = reacListnew |
398 | 415 | for reac in reacList: |
399 | 416 | if findCompartment(reac) == moose.element('/'): |
400 | 417 | error = error + " \n "+reac.path+ " doesn't have compartment ignored to write to genesis" |
|
0 commit comments