test/acceptance/simulation_test.rb in y_petri-2.3.3 vs test/acceptance/simulation_test.rb in y_petri-2.3.4

- old
+ new

@@ -2,11 +2,11 @@ # encoding: utf-8 require 'minitest/autorun' require_relative '../../lib/y_petri' # tested component itself # require 'y_petri' -# require 'sy' +require 'sy' describe "Simplified dTTP pathway used for demo with Dr. Chang" do before do @m = YPetri::Agent.new Cytoplasm_volume_in_litres = 5.0e-11 @@ -40,78 +40,84 @@ TMPK_a = 0.83 @m.clamp AMP: 8695.0, ADP: 6521.0, ATP: 3152.0 @m.clamp Deoxycytidine: 0.5, DeoxyCTP: 1.0, DeoxyGMP: 1.0 @m.clamp Thymidine: 0.5 @m.clamp UMP_UDP_pool: 2737.0 + # Functions Vmax_per_minute_per_enzyme_molecule = - lambda { |enzyme_specific_activity_in_micromol_per_minute_per_mg, - enzyme_molecular_mass_in_kDa| - enzyme_specific_activity_in_micromol_per_minute_per_mg * - enzyme_molecular_mass_in_kDa } + -> specific_activity_µmol_per_min_per_mg, mol_mass_in_kDa { + specific_activity_µmol_per_min_per_mg * mol_mass_in_kDa + } + Vmax_per_minute = - lambda { |specific_activity, kDa, enzyme_molecules_per_cell| - Vmax_per_minute_per_enzyme_molecule.( specific_activity, kDa ) * - enzyme_molecules_per_cell } + -> specific_activity, kDa, enzyme_molecules_per_cell { + Vmax_per_minute_per_enzyme_molecule.( specific_activity, kDa ) * + enzyme_molecules_per_cell + } + Vmax_per_second = - lambda { |specific_activity, kDa, enzyme_molecules_per_cell| - Vmax_per_minute.( specific_activity, - kDa, - enzyme_molecules_per_cell ) / 60 } + -> specific_activity, kDa, enzyme_molecules_per_cell { + Vmax_per_minute.( specific_activity, kDa, enzyme_molecules_per_cell ) / 60 + } + Km_reduced = - lambda { |km, ki_hash={}| - ki_hash.map { |concentration, ci_Ki| - concentration / ci_Ki - }.reduce( 1, :+ ) * km } + -> km, ki_hash=Hash.new { + ki_hash.map { |conc, ci_Ki| conc / ci_Ki }.reduce( 1, :+ ) * km + } + Occupancy = - lambda { |concentration, reactant_Km, compet_inh_w_Ki_hash={}| - concentration / ( concentration + - Km_reduced.( reactant_Km, - compet_inh_w_Ki_hash ) ) } + -> conc, reactant_Km, compet_inh_w_Ki_hash=Hash.new { + conc / ( conc + Km_reduced.( reactant_Km, compet_inh_w_Ki_hash ) ) + } + MM_with_inh_micromolars_per_second = - lambda { |reactant_concentration, - enzyme_specific_activity, - enzyme_mass_in_kDa, - enzyme_molecules_per_cell, - reactant_Km, - competitive_inh_w_Ki_hash={}| - Vmax_per_second.( enzyme_specific_activity, - enzyme_mass_in_kDa, - enzyme_molecules_per_cell ) * - Occupancy.( reactant_concentration, + -> reactant_conc, enz_spec_activity, enz_mass_in_kDa, + enz_molecules_per_cell, reactant_Km, compet_inh_w_Ki_hash=Hash.new { + Vmax_per_second.( enz_spec_activity, + enz_mass_in_kDa, + enz_molecules_per_cell ) * + Occupancy.( reactant_conc, reactant_Km, - competitive_inh_w_Ki_hash ) } + compet_inh_w_Ki_hash ) + } + MMi = MM_with_inh_micromolars_per_second TK1_Thymidine_Km = 5.0 TYMS_DeoxyUMP_Km = 2.0 RNR_UDP_Km = 1.0 - DNA_creation_speed = 3_000_000_000 / ( 12 * 3600 ) + DNA_creation_speed = 3_000_000_000 / ( 12 * 3600 ) / Pieces_per_micromolar TMPK_DeoxyTMP_Km = 12.0 # transitions @m.Transition name: :TK1_Thymidine_DeoxyTMP, - domain: [ Thymidine, TK1, DeoxyTDP_DeoxyTTP_pool, DeoxyCTP, Deoxycytidine, AMP, ADP, ATP ], + domain: [ Thymidine, TK1, DeoxyTDP_DeoxyTTP_pool, + DeoxyCTP, Deoxycytidine, AMP, ADP, ATP ], stoichiometry: { Thymidine: -1, DeoxyTMP: 1 }, rate: proc { |rc, e, pool1, ci2, ci3, master1, master2, master3| ci1 = pool1 * master3 / ( master2 + master3 ) MMi.( rc, TK1_a, TK1_kDa, e, TK1_Thymidine_Km, ci1 => 13.5, ci2 => 0.8, ci3 => 40.0 ) } + @m.Transition name: :TYMS_DeoxyUMP_DeoxyTMP, domain: [ DeoxyUMP_DeoxyUDP_pool, TYMS, AMP, ADP, ATP ], stoichiometry: { DeoxyUMP_DeoxyUDP_pool: -1, DeoxyTMP: 1 }, rate: proc { |pool, e, master1, master2, master3| rc = pool * master2 / ( master1 + master2 ) MMi.( rc, TYMS_a, TYMS_kDa, e, TYMS_DeoxyUMP_Km ) } + @m.Transition name: :RNR_UDP_DeoxyUDP, domain: [ UMP_UDP_pool, RNR, DeoxyUMP_DeoxyUDP_pool, AMP, ADP, ATP ], stoichiometry: { UMP_UDP_pool: -1, DeoxyUMP_DeoxyUDP_pool: 1 }, rate: proc { |pool, e, master1, master2, master3| rc = pool * master2 / ( master1 + master2 ) MMi.( rc, RNR_a, RNR_kDa, e, RNR_UDP_Km ) } + @m.Transition name: :DNA_polymerase_consumption_of_DeoxyTTP, stoichiometry: { DeoxyTDP_DeoxyTTP_pool: -1 }, rate: proc { DNA_creation_speed / 4 } + @m.Transition name: :TMPK_DeoxyTMP_DeoxyTDP, domain: [ DeoxyTMP, TMPK, ADP, DeoxyTDP_DeoxyTTP_pool, DeoxyGMP, AMP, ATP ], stoichiometry: { DeoxyTMP: -1, TMPK: 0, DeoxyTDP_DeoxyTTP_pool: 1 }, @@ -119,9 +125,10 @@ master2 = ci1 ci2 = pool * master2 / ( master2 + master3 ) ci3 = pool * master3 / ( master2 + master3 ) MMi.( rc, TMPK_a, TMPK_kDa, e, TMPK_DeoxyTMP_Km, ci1 => 250.0, ci2 => 30.0, ci3 => 750, ci4 => 117 ) } + end it "should work" do @m.run! @m.plot_state