[sympycore] r1203 committed - Support specifying reaction names in a parsed string.

1 view
Skip to first unread message

codesite...@google.com

unread,
Apr 13, 2011, 4:51:53 AM4/13/11
to sympycor...@googlegroups.com
Revision: 1203
Author: pearu.peterson
Date: Wed Apr 13 01:50:45 2011
Log: Support specifying reaction names in a parsed string.
http://code.google.com/p/sympycore/source/detail?r=1203

Modified:
/trunk/sympycore/physics/sysbio/io.py
/trunk/sympycore/physics/sysbio/tests/test_steady_flux_analyzer.py

=======================================
--- /trunk/sympycore/physics/sysbio/io.py Fri Apr 8 01:57:00 2011
+++ /trunk/sympycore/physics/sysbio/io.py Wed Apr 13 01:50:45 2011
@@ -217,7 +217,15 @@
compartments = set()))
species_info = defaultdict(lambda:dict())
for line in text.splitlines():
- if not line.strip () or line.startswith ('#'): continue
+ line = line.strip()
+ if ':' in line:
+ reaction_name, line = line.split (':',1)
+ reaction_name = reaction_name.strip()
+ line = line.strip()
+ else:
+ reaction_name = None
+ if not line or line.startswith ('#'): continue
+
reversible = False
left, right = line.split ('=')
direction = '='
@@ -255,11 +263,17 @@
fname.append (name0)

if direction=='<':
- reaction_name = '_'.join(fname)
- reaction_name2 = '_'.join(rname)
+ if not reaction_name:
+ reaction_name = '_'.join(fname)
+ reaction_name2 = '_'.join(rname)
+ else:
+ reaction_name2 = 'r'+reaction_name
else:
- reaction_name2 = '_'.join(fname)
- reaction_name = '_'.join(rname)
+ if not reaction_name:
+ reaction_name2 = '_'.join(fname)
+ reaction_name = '_'.join(rname)
+ else:
+ reaction_name2 = 'r'+reaction_name

reactions.append (reaction_name)
reaction_index = reactions.index (reaction_name)
=======================================
--- /trunk/sympycore/physics/sysbio/tests/test_steady_flux_analyzer.py Tue
Apr 12 12:03:22 2011
+++ /trunk/sympycore/physics/sysbio/tests/test_steady_flux_analyzer.py Wed
Apr 13 01:50:45 2011
@@ -5,14 +5,14 @@

def test_sauro2004_fig3 ():
network = SteadyFluxAnalyzer('''\
-S1=>S2
-ES=>S1+E
+v1:S1=>S2
+v2:ES=>S1+E
E+S2=>ES
''')
#print network
fluxes, indep_fluxes, kernel = network.get_kernel_GJE ()
variables = fluxes[network.rank:]
- #print network.label_matrix (kernel, ['%s='%f for f in fluxes],
variables)
+ print network.label_matrix (kernel, ['%s='%f for f in fluxes],
variables)

def test_example_yeast():
sbml_file = os.path.join (os.path.dirname
(__file__),'yeast_example.xml')

Reply all
Reply to author
Forward
0 new messages