Added Json Schemas
This commit is contained in:
@@ -19,14 +19,14 @@ namespace BaseCellSimulation.Enzyms.Cytosol
|
||||
|
||||
public override void ApplyChanges(CellRessources res, double dt)
|
||||
{
|
||||
double used = Math.Min(rate * dt, res.Res.Carbon.FBP);
|
||||
res.Res.Carbon.FBP -= used;
|
||||
res.Res.Carbon.GAP += 2 * used;
|
||||
double used = Math.Min(rate * dt, res.Res.Carbon.F1_6BP);
|
||||
res.Res.Carbon.F1_6BP -= used;
|
||||
res.Res.Carbon.GA3P += 2 * used;
|
||||
}
|
||||
|
||||
public override void ComputeRate(Resources res)
|
||||
{
|
||||
Michaelis_Menten(res.Carbon.FBP);
|
||||
Michaelis_Menten(res.Carbon.F1_6BP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace BaseCellSimulation.Enzyms.Cytosol
|
||||
|
||||
public override void ApplyChanges(CellRessources res, double dt)
|
||||
{
|
||||
double used = Math.Min(rate * dt, Math.Min(res.Res.Carbon.GAP, res.Res.Energy.NAD));
|
||||
res.Res.Carbon.GAP -= used;
|
||||
double used = Math.Min(rate * dt, Math.Min(res.Res.Carbon.GA3P, res.Res.Energy.NAD));
|
||||
res.Res.Carbon.GA3P -= used;
|
||||
res.Res.Carbon.PBG13 += used;
|
||||
res.TransferNADH(used, false);
|
||||
res.Res.Ions.Protons += 1.0 * used;
|
||||
@@ -34,7 +34,7 @@ namespace BaseCellSimulation.Enzyms.Cytosol
|
||||
|
||||
public override void ComputeRate(Resources res)
|
||||
{
|
||||
rate = Vmax * (res.Carbon.GAP / (Km + res.Carbon.GAP)) * (res.Energy.NAD / (Km_NAD + res.Energy.NAD));
|
||||
rate = Vmax * (res.Carbon.GA3P / (Km + res.Carbon.GA3P)) * (res.Energy.NAD / (Km_NAD + res.Energy.NAD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BaseCellSimulation.Enzyms.Cytosol.Hexokinasen
|
||||
{
|
||||
public class HK1 : Hexokinasis
|
||||
{
|
||||
public HK1() : base()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BaseCellSimulation.Enzyms.Cytosol.Hexokinasen
|
||||
{
|
||||
internal class HK2
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BaseCellSimulation.Enzyms.Cytosol.Hexokinasen
|
||||
{
|
||||
internal class HK3
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BaseCellSimulation.Enzyms.Cytosol.Hexokinasen
|
||||
{
|
||||
internal class HK4_GK
|
||||
{
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -4,14 +4,16 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BaseCellSimulation.Enzyms.Cytosol
|
||||
namespace BaseCellSimulation.Enzyms.Cytosol.Hexokinasen
|
||||
{
|
||||
public class Hexokinasis : InternalEnzym
|
||||
public abstract class Hexokinasis : InternalEnzym
|
||||
{
|
||||
public Hexokinasis() {
|
||||
Km = 0.05;
|
||||
Vmax = 5;
|
||||
|
||||
Type = EnzymType.MichelisMenten;
|
||||
|
||||
KmRange = new(0.01, 0.1);
|
||||
VmaxRange = new(0.5, 20);
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace BaseCellSimulation.Enzyms.Cytosol
|
||||
{
|
||||
double used = Math.Min(rate * dt, Math.Min(res.Res.Energy.ATP, res.Res.Carbon.F6P));
|
||||
res.Res.Carbon.F6P -= used;
|
||||
res.Res.Carbon.FBP += used;
|
||||
res.Res.Carbon.F1_6BP += used;
|
||||
res.ConsumeATP(used);
|
||||
res.Res.Ions.Protons += used;
|
||||
}
|
||||
|
||||
@@ -3,37 +3,173 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BaseCellSimulation.Enzyms
|
||||
{
|
||||
public abstract class Enzym
|
||||
public enum EnzymType
|
||||
{
|
||||
/// <summary>
|
||||
/// mM/S
|
||||
/// </summary>
|
||||
public double Vmax { get; set; }
|
||||
Hill,
|
||||
MichelisMenten,
|
||||
Linear
|
||||
}
|
||||
|
||||
public struct Substrate
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// mM
|
||||
/// </summary>
|
||||
public double Km { get; set; }
|
||||
[JsonPropertyName("Km")]
|
||||
public ValueRange Km { get; set; }
|
||||
|
||||
public ValueRange VmaxRange { get; protected set; }
|
||||
[JsonPropertyName("Hill")]
|
||||
public ValueRange n_Hill { get; set; }
|
||||
}
|
||||
|
||||
public ValueRange KmRange { get; protected set; }
|
||||
public struct Product
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public double Amount { get; set; }
|
||||
}
|
||||
|
||||
public class Enzym
|
||||
{
|
||||
[JsonPropertyName("Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// mM/S
|
||||
/// </summary>
|
||||
[JsonPropertyName("Vmax")]
|
||||
public ValueRange Vmax { get; set; }
|
||||
|
||||
[JsonPropertyName("Type")]
|
||||
public EnzymType Type { get; set; }
|
||||
|
||||
[JsonPropertyName("ConsumATPtoADP")]
|
||||
public double ConsumATPtoADP { get; set; }
|
||||
[JsonPropertyName("ProduceATPfromADP")]
|
||||
public double ProduceATPfromADP { get; set; }
|
||||
[JsonPropertyName("ConsumATPtoAMP")]
|
||||
public double ConsumATPtoAMP { get; set; }
|
||||
[JsonPropertyName("ProduceATPfromAMP")]
|
||||
public double ProduceATPfromAMP { get; set; }
|
||||
[JsonPropertyName("ConsumeNADtoNADH")]
|
||||
public double ConsumeNADtoNADH { get; set; }
|
||||
[JsonPropertyName("ProduceNADfromNADH")]
|
||||
public double ProduceNADfromNADH { get; set; }
|
||||
[JsonPropertyName("ConsumeGDPtoGTP")]
|
||||
public double ConsumeGDPtoGTP { get; set; }
|
||||
[JsonPropertyName("ProduceGDPfromGTP")]
|
||||
public double ProduceGDPfromGTP { get; set; }
|
||||
|
||||
[JsonPropertyName("Substrates")]
|
||||
public List<Substrate> Substrates { get; set; } = new List<Substrate>();
|
||||
|
||||
[JsonPropertyName("Products")]
|
||||
public List<Product> Products { get; set; } = new List<Product>();
|
||||
|
||||
protected double rate;
|
||||
|
||||
protected void Michaelis_Menten(double ressource)
|
||||
|
||||
protected double Michaelis_Menten(CellRessources res)
|
||||
{
|
||||
rate = Michaelis_Menten(ressource, Vmax, Km);
|
||||
double retVar = Vmax.Value;
|
||||
foreach (Substrate substrate in Substrates)
|
||||
{
|
||||
if (!res.Resources.TryGetValue(substrate.Name, out double ResAmount))
|
||||
return 0.0;
|
||||
if (ResAmount <= 0.0)
|
||||
return 0.0;
|
||||
|
||||
retVar *= ResAmount / (substrate.Km.Value + ResAmount);
|
||||
}
|
||||
|
||||
return retVar;
|
||||
}
|
||||
|
||||
protected double Michaelis_Menten(double consumable,double vmax, double km)
|
||||
protected double HillEquation(CellRessources res)
|
||||
{
|
||||
return (vmax * consumable) / (km + consumable);
|
||||
double retVar = Vmax.Value;
|
||||
foreach (Substrate substrate in Substrates)
|
||||
{
|
||||
if (!res.Resources.TryGetValue(substrate.Name, out double ResAmount))
|
||||
return 0.0;
|
||||
if (ResAmount <= 0.0)
|
||||
return 0.0;
|
||||
|
||||
|
||||
retVar *= Math.Pow(ResAmount, substrate.n_Hill.Value) / (Math.Pow(substrate.Km.Value, substrate.n_Hill.Value) + Math.Pow(ResAmount, substrate.n_Hill.Value));
|
||||
}
|
||||
|
||||
return retVar;
|
||||
}
|
||||
|
||||
public abstract void ApplyChanges(CellRessources res, double dt);
|
||||
public void ApplyChanges(CellRessources res, double dt)
|
||||
{
|
||||
double delta = rate * dt;
|
||||
foreach (Substrate substrate in Substrates)
|
||||
{
|
||||
if (res.Resources.TryGetValue(substrate.Name, out double oldVal))
|
||||
{
|
||||
delta = Math.Min(delta, oldVal / substrate.Amount);
|
||||
}
|
||||
}
|
||||
foreach (Substrate substrate in Substrates)
|
||||
{
|
||||
if (res.Resources.TryGetValue(substrate.Name, out double oldVal))
|
||||
{
|
||||
res.Resources[substrate.Name] = oldVal - substrate.Amount * delta;
|
||||
}
|
||||
}
|
||||
foreach (Product product in Products)
|
||||
{
|
||||
if (res.Resources.ContainsKey(product.Name))
|
||||
{
|
||||
res.Resources[product.Name] += product.Amount * delta;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.Resources[product.Name] = product.Amount * delta;
|
||||
}
|
||||
}
|
||||
|
||||
if(ConsumATPtoADP > 0.0)
|
||||
res.ConsumeATP(ConsumATPtoADP * delta, false);
|
||||
if(ProduceATPfromADP > 0.0)
|
||||
res.RegenerateATP(ProduceATPfromADP * delta, false);
|
||||
if(ConsumATPtoAMP > 0.0)
|
||||
res.ConsumeATP(ConsumATPtoAMP * delta, true);
|
||||
if(ProduceATPfromAMP > 0.0)
|
||||
res.RegenerateATP(ProduceATPfromAMP * delta, true);
|
||||
if(ConsumeNADtoNADH > 0.0)
|
||||
res.TransferNADH(ConsumeNADtoNADH * delta, true);
|
||||
if(ProduceNADfromNADH > 0.0)
|
||||
res.TransferNADH(ProduceNADfromNADH * delta, false);
|
||||
if(ConsumeGDPtoGTP > 0.0)
|
||||
res.TransferGTP(ConsumeGDPtoGTP * delta, true);
|
||||
if(ProduceGDPfromGTP > 0.0)
|
||||
res.TransferGTP(ProduceGDPfromGTP * delta, false);
|
||||
}
|
||||
|
||||
public void ComputeRate(CellRessources res)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case EnzymType.Hill:
|
||||
rate = HillEquation(res);
|
||||
break;
|
||||
case EnzymType.MichelisMenten:
|
||||
rate = Michaelis_Menten(res);
|
||||
break;
|
||||
case EnzymType.Linear:
|
||||
rate = Vmax.Value * res.Resources[Substrates[0].Name];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class InternalEnzym : Enzym
|
||||
|
||||
Reference in New Issue
Block a user