def test_sauro2004_fig3 (): network = SteadyFluxAnalyzer('''\ 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.source_data
def test_sauro2004_fig3(): network = SteadyFluxAnalyzer('''\ 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.source_data
def test_wiki_SteadyFluxAnalyzer(): from sympycore.physics.sysbio import SteadyFluxAnalyzer print example_network = ''' A => B B => C B <=> D C => D C => E D => E A <= C => D => E => ''' print example_network ex = SteadyFluxAnalyzer (example_network, split_bidirectional_fluxes = True) print ex print 'reactions:' print ex.reactions print 'fluxes:' print ex.species ex.compute_kernel_GJE () fluxes, indep_fluxes, kernel = ex.get_kernel_GJE () print 'fluxes:' print fluxes print 'rank:' print ex.rank print 'kernel:' print kernel print ex.label_matrix (kernel, fluxes, indep_fluxes) dependent_candidates=[r for r in ex.reactions if r.count ('_')>1] #dependent_candidates = ['R_A_B', 'R_B_C', 'R_B_D','R_C_E', 'R_A'] print 'dependent_candidates:' print dependent_candidates ex.compute_kernel_GJE(dependent_candidates=dependent_candidates) fluxes, indep_fluxes, kernel = ex.get_kernel_GJE() print 'fluxes:' print fluxes print 'indep_fluxes:' print ex.label_matrix (kernel, fluxes, indep_fluxes) dep_fluxes = fluxes[:ex.rank] indep_symbols = map(Symbol,indep_fluxes) for i in range(ex.rank): print dep_fluxes[i],'=',[indep_symbols] * kernel[i].T fluxes, indep_fluxes, kernel = ex.get_kernel_GJE(ex.reactions) print 'ex.stoichiometry * kernel:' print ex.stoichiometry * kernel print ex.label_matrix (kernel, fluxes, indep_fluxes) ex.compute_kernel_SVD() fluxes, kernel = ex.get_kernel_SVD() alpha = ['a%s'%i for i in range(kernel.shape[1])] print fluxes print kernel.round(decimals=3) print ex.label_matrix (Matrix(kernel.round(decimals=3)), fluxes, alpha) import numpy print numpy.dot(kernel.T, kernel).round(decimals=3) print 'statistics:' ex.show_statistics () return print 'large system:' ex = SteadyFluxAnalyzer ('http://www.biomedcentral.com/content/supplementary/1752-0509-4-160-s2.xml', add_boundary_fluxes = True) ex.compute_kernel_GJE() ex.compute_kernel_SVD() ex.show_statistics () print ex.get_relation_SVD_error ()
def test_wiki_SteadyFluxAnalyzer(): from sympycore.physics.sysbio import SteadyFluxAnalyzer print example_network = ''' A => B B => C B <=> D C => D C => E D => E A <= C => D => E => ''' print example_network ex = SteadyFluxAnalyzer(example_network, split_bidirectional_fluxes=True) print ex print 'reactions:' print ex.reactions print 'fluxes:' print ex.species ex.compute_kernel_GJE() fluxes, indep_fluxes, kernel = ex.get_kernel_GJE() print 'fluxes:' print fluxes print 'rank:' print ex.rank print 'kernel:' print kernel print ex.label_matrix(kernel, fluxes, indep_fluxes) dependent_candidates = [r for r in ex.reactions if r.count('_') > 1] #dependent_candidates = ['R_A_B', 'R_B_C', 'R_B_D','R_C_E', 'R_A'] print 'dependent_candidates:' print dependent_candidates ex.compute_kernel_GJE(dependent_candidates=dependent_candidates) fluxes, indep_fluxes, kernel = ex.get_kernel_GJE() print 'fluxes:' print fluxes print 'indep_fluxes:' print ex.label_matrix(kernel, fluxes, indep_fluxes) dep_fluxes = fluxes[:ex.rank] indep_symbols = map(Symbol, indep_fluxes) for i in range(ex.rank): print dep_fluxes[i], '=', [indep_symbols] * kernel[i].T fluxes, indep_fluxes, kernel = ex.get_kernel_GJE(ex.reactions) print 'ex.stoichiometry * kernel:' print ex.stoichiometry * kernel print ex.label_matrix(kernel, fluxes, indep_fluxes) ex.compute_kernel_SVD() fluxes, kernel = ex.get_kernel_SVD() alpha = ['a%s' % i for i in range(kernel.shape[1])] print fluxes print kernel.round(decimals=3) print ex.label_matrix(Matrix(kernel.round(decimals=3)), fluxes, alpha) import numpy print numpy.dot(kernel.T, kernel).round(decimals=3) print 'statistics:' ex.show_statistics() return print 'large system:' ex = SteadyFluxAnalyzer( 'http://www.biomedcentral.com/content/supplementary/1752-0509-4-160-s2.xml', add_boundary_fluxes=True) ex.compute_kernel_GJE() ex.compute_kernel_SVD() ex.show_statistics() print ex.get_relation_SVD_error()