InitalCommit

This commit is contained in:
WyanMueller
2025-11-16 10:30:26 +01:00
parent 8b0b73bba8
commit d2e409d10f
73 changed files with 3209 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class AHCY : InternalEnzym
{
public AHCY()
{
Km = 0.02;
Vmax = 0.3;
}
public override void ApplyChanges(CellRessources res, double dt)
{
double dSAH = Math.Min(rate * dt, res.Res.Protein.SAH);
res.Res.Protein.SAH -= dSAH;
res.Res.Protein.Homocystein += dSAH;
res.Res.Protein.Adenosin += dSAH;
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Protein.SAH);
}
}
}
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class AdenylateKinase : InternalEnzym
{
public AdenylateKinase()
{
Km = 0.1;
Vmax = 5;
Keq = 1.1;
KmRange = new(0.01, 0.5);
VmaxRange = new(0.5, 15);
KeqRange = new(0.9, 1.2);
}
public double Keq { get; set; }
public ValueRange KeqRange;
public override void ApplyChanges(CellRessources res, double dt)
{
double d = rate * dt;
// Begrenzen, damit keine negativen Konzentrationen entstehen
if (d > 0.0)
{
// Vorwärtsrichtung: 2 ADP -> ATP + AMP
double limit = Math.Min(res.Res.Energy.ADP / 2.0, d);
res.Res.Energy.ADP -= 2.0 * limit;
res.Res.Energy.ATP += limit;
res.Res.Energy.AMP += limit;
}
else if (d < 0.0)
{
// Rückwärtsrichtung: ATP + AMP -> 2 ADP
double limit = Math.Min(Math.Min(res.Res.Energy.ATP, res.Res.Energy.AMP), -d);
res.Res.Energy.ADP += 2.0 * limit;
res.Res.Energy.ATP -= limit;
res.Res.Energy.AMP -= limit;
}
}
public override void ComputeRate(Resources res)
{
double numerator = res.Energy.ADP * res.Energy.ADP - res.Energy.ATP * res.Energy.AMP / Keq;
double denominator = Km * Km + res.Energy.ADP * res.Energy.ADP;
rate = Vmax * (numerator / denominator); // Nettoreaktionsrate in mM/s
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Aldolase : InternalEnzym
{
public Aldolase()
{
Km = 0.1;
Vmax = 10;
KmRange = new(0.01, 0.3);
VmaxRange = new(2, 20);
}
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;
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Carbon.FBP);
}
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Enolase : InternalEnzym
{
public Enolase()
{
Km = 0.1;
Vmax = 10;
KmRange = new(0.01, 0.3);
VmaxRange = new(2, 25);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, res.Res.Carbon.PG2);
res.Res.Carbon.PG2 -= used;
res.Res.Carbon.PEP += used;
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Carbon.PG2);
}
}
}
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class GAPDH : InternalEnzym
{
public GAPDH()
{
Km = 0.1;
Km_NAD = 0.075;
Vmax = 10;
KmRange = new(0.01, 0.5);
VmaxRange = new(2, 25);
Km_NAD_Range = new(0.01, 0.2);
}
public double Km_NAD { get; set; }
public ValueRange Km_NAD_Range { get; private set; }
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;
res.Res.Carbon.PBG13 += used;
res.TransferNADH(used, false);
res.Res.Ions.Protons += 1.0 * used;
}
public override void ComputeRate(Resources res)
{
rate = Vmax * (res.Carbon.GAP / (Km + res.Carbon.GAP)) * (res.Energy.NAD / (Km_NAD + res.Energy.NAD));
}
}
}
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Hexokinasis : InternalEnzym
{
public Hexokinasis() {
Km = 0.05;
Vmax = 5;
KmRange = new(0.01, 0.1);
VmaxRange = new(0.5, 20);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, Math.Min(res.Res.Carbon.Glucose, res.Res.Energy.ATP));
res.Res.Carbon.Glucose -= used;
res.Res.Carbon.G6P += used;
res.ConsumeATP(used);
res.Res.Ions.Protons += used;
}
//todo noch machen dass atpberücksichtigt wird
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Carbon.Glucose);
}
}
}
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Lactat_Dehydrogenase : InternalEnzym
{
public Lactat_Dehydrogenase()
{
Km = 0.5;
Vmax = 10;
KmRange = new(0.05,2);
VmaxRange = new(2, 25);
Km_NADH = 0.05;
Km_NADH_Range = new(0.005, 0.2);
}
public double Km_NADH { get; set; }
public ValueRange Km_NADH_Range { get; set; }
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, Math.Min(res.Res.Carbon.Pyruvate, res.Res.Energy.NADH));
//LDH Lactat production and NAD+ regeneration
res.Res.Carbon.Pyruvate -= used;
res.Res.Carbon.Lactate += used;
res.TransferNADH(used,true);
//Consume Protons
res.Res.Ions.Protons -= 1.0 * used;
}
public override void ComputeRate(Resources res)
{
double oxscaled = res.Oxygen * 1000;
double o2Factor = Math.Max(0.0, 1.0 - oxscaled / (oxscaled + 10.0));
rate = Vmax * o2Factor
* (res.Carbon.Pyruvate / (Km + res.Carbon.Pyruvate))
* (res.Energy.NADH / (Km_NADH + res.Energy.NADH));
}
}
}
@@ -0,0 +1,38 @@
using BaseCellSimulation.Enzyms.Membrane;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.WebRequestMethods;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Methionin_Adenosyltransferase : InternalEnzym
{
public double Km_ATP { get; set; }
public Methionin_Adenosyltransferase()
{
Km = 0.05;
Vmax = 0.5;
Km_ATP = 0.2;
}
public override void ApplyChanges(CellRessources res, double dt)
{
double dSAM = Math.Min(rate * dt,res.Res.Energy.ATP);
res.Res.Protein.MET -= dSAM;
res.Res.Protein.SAM += dSAM;
res.Res.Energy.ATP -= dSAM;
res.Res.Phosphate.PPi += dSAM;
res.Res.Phosphate.Pi += dSAM;
}
public override void ComputeRate(Resources res)
{
rate = Vmax * (res.Protein.MET / (Km + res.Protein.MET)) * (res.Energy.ATP / (Km_ATP + res.Energy.ATP));
}
}
}
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Methioninsynthase : InternalEnzym
{
public Methioninsynthase()
{
Km = 0.015;
Vmax = 0.2;
}
public override void ApplyChanges(CellRessources res, double dt)
{
// Berechne tatsächlich mögliche Umwandlung
double dHcy = Math.Min(rate * dt, res.Res.Protein.Homocystein);
dHcy = Math.Min(dHcy, res.Res.Folate.MethylTHF);
dHcy = Math.Min(dHcy, res.Res.Cofactor.B12); // Co-Faktor limitierend
if (dHcy <= 0)
return;
// Verbrauch von Substraten
res.Res.Protein.Homocystein -= dHcy;
res.Res.Folate.MethylTHF -= dHcy;
// Cofaktor-B12 wird nicht dauerhaft verbraucht (Katalytisch)
// kann aber langsam inaktiviert werden, falls du das modellieren willst
// Bildung von Produkten
res.Res.Protein.MET += dHcy;
res.Res.Folate.THF += dHcy;
}
public override void ComputeRate(Resources res)
{
// Aktivitätsfaktor abhängig vom verfügbaren B12
double cofactorEffect = Math.Clamp(res.Cofactor.B12 / 0.01, 0.0, 1.0);
// Michaelis-Menten über Homocystein
Michaelis_Menten(res.Protein.Homocystein);
rate *= cofactorEffect;
}
}
}
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class NucleosideDiphosphateKinase : InternalEnzym
{
private const double k_eq = 0.25; // 0.25 / s → recht schnell, da NDK sehr aktiv ist
public NucleosideDiphosphateKinase()
{
Km = 0.05; // unspezifisch, da das Enzym viele Nukleotide akzeptiert
Vmax = 1.0; // fiktiver Maximalumsatz (mmol/L·s)
}
public override void ApplyChanges(CellRessources res, double dt)
{
var energy = res.Res.Energy;
// --- Austausch zwischen ATP und GTP ---
double delta = (energy.ATP - energy.GTP) * k_eq * dt;
if (Math.Abs(delta) < 1e-9)
return;
// Begrenzung: kein negativer Pool
if (delta > 0)
{
delta = Math.Min(delta, energy.ATP);
}
else
{
delta = Math.Max(delta, -energy.GTP);
}
// Umsetzung: ATP -> GTP oder umgekehrt
energy.ATP -= delta;
energy.GTP += delta;
}
public override void ComputeRate(Resources res)
{
double diff = Math.Abs(res.Energy.ATP - res.Energy.GTP);
Michaelis_Menten(diff);
}
}
}
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.WebRequestMethods;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class PhosphoFructokinase : InternalEnzym
{
public PhosphoFructokinase()
{
Km = 0.2;
Vmax = 7;
KmRange = new(0.05, 0.5);
VmaxRange = new(1, 25);
}
public double Ki_ATP_PFK { get; set; }
public double Ka_AMP_PFK { get; set; }
public double h_AMP { get; set; }
public double h_ATP { get; set; }
public override void ApplyChanges(CellRessources res, double dt)
{
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.ConsumeATP(used);
res.Res.Ions.Protons += used;
}
public override void ComputeRate(Resources res)
{
double inhibition = 1.0 / (1.0 + Math.Pow(res.Energy.ATP / Ki_ATP_PFK, h_ATP)); // Hemmung durch ATP
double activation = 1.0 + Math.Pow(res.Energy.AMP / Ka_AMP_PFK, h_AMP); // Aktivierung durch AMP
rate = Michaelis_Menten(res.Carbon.F6P, Vmax * inhibition * activation, Km);
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Phosphoglucose_Isomerase : InternalEnzym
{
public Phosphoglucose_Isomerase()
{
Km = 0.1;
Vmax = 10;
KmRange = new(0.05, 0.2);
VmaxRange = new(0.5, 30);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, res.Res.Carbon.G6P);
res.Res.Carbon.G6P -= used;
res.Res.Carbon.F6P += used;
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Carbon.G6P);
}
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Phosphoglycerat_Kinase : InternalEnzym
{
public Phosphoglycerat_Kinase()
{
Vmax = 10;
Km = 0.1;
KmRange = new(0.01, 0.3);
VmaxRange = new(2, 30);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, res.Res.Carbon.PBG13);
res.Res.Carbon.PBG13 -= used;
res.Res.Carbon.PG3 += used;
res.RegenerateATP(used);
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Carbon.PBG13);
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Phosphoglycerat_Mutase : InternalEnzym
{
public Phosphoglycerat_Mutase()
{
Km = 0.1;
Vmax = 10;
VmaxRange = new(2, 30);
KmRange = new(0.01, 0.3);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, res.Res.Carbon.PG3);
res.Res.Carbon.PG3 -= used;
res.Res.Carbon.PG2 += used;
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Carbon.PG3);
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Pyrophosphatase : InternalEnzym
{
public Pyrophosphatase()
{
Vmax = 2.0;
Km = 0.01;
VmaxRange = new(1, 10);
KmRange = new(0.001, 0.05);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double dPPi = Math.Max(rate, res.Res.Phosphate.PPi);
res.HydrolyzePPi(dPPi);
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Phosphate.PPi);
}
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol
{
public class Pyruvat_Kinase : InternalEnzym
{
public Pyruvat_Kinase()
{
Km = 0.1;
Vmax = 10;
KmRange = new(0.01, 0.3);
VmaxRange = new(2, 25);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, res.Res.Carbon.PEP);
res.Res.Carbon.PEP -= used;
res.Res.Carbon.Pyruvate += used;
res.RegenerateATP(used);
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Carbon.PEP);
}
}
}
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol.Ribosomen
{
public class AminoacylTRNASynthetase : InternalEnzym
{
public AminoacylTRNASynthetase()
{
Km = 0.1;
Vmax = 1.5;
}
public override void ApplyChanges(CellRessources res, double dt)
{
double dAAtRNA = Math.Min(rate * dt, Math.Min(res.Res.Protein.AminoAcids, res.Res.Protein.tRNA));
dAAtRNA = Math.Min(dAAtRNA, res.Res.Energy.ATP);
res.Res.Protein.AminoAcids -= dAAtRNA;
res.Res.Protein.tRNA -= dAAtRNA;
res.Res.Protein.Aminoacyl_tRNA += dAAtRNA;
res.ConsumeATP(dAAtRNA);
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Protein.tRNA);
}
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol.Ribosomen
{
public class PeptidylTransferase : InternalEnzym
{
public PeptidylTransferase()
{
Km = 0.05;
Vmax = 5.0;
}
public override void ApplyChanges(CellRessources res, double dt)
{
double dPeptide = Math.Min(rate * dt, Math.Min(res.Res.Protein.Aminoacyl_tRNA, res.Res.Energy.GTP));
res.Res.Protein.Aminoacyl_tRNA -= dPeptide;
res.Res.Protein.FunctionalProteins += dPeptide;
res.Res.Energy.GTP -= dPeptide;
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Protein.Aminoacyl_tRNA);
}
}
}
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol.Ribosomen
{
public class Ribosome : InternalEnzym
{
private TranslationFactor initiation;
private TranslationFactor elongation;
private TranslationFactor termination;
private const double ProteinPermRNA = 20.0;
int ribosomenState = 0;
public Ribosome()
{
Km = 0.5; // fiktiv (abhängig von mRNA)
Vmax = 10.0; // z. B. 10 Aminosäuren pro Sekunde
initiation = new TranslationFactor(TranslationFactor.FactorType.Initiation);
elongation = new TranslationFactor(TranslationFactor.FactorType.Elongation);
termination = new TranslationFactor(TranslationFactor.FactorType.Termination);
}
private double availableAA = 0;
private double dProtein = 0;
public override void ApplyChanges(CellRessources res, double dt)
{
int safety = 0;
while (safety++ < 10)
{
switch (ribosomenState)
{
case 0:
availableAA = res.Res.Protein.AminoAcids;
dProtein = rate * dt;
// Translation start -> Initiationsfaktoren verbrauchen GTP
initiation.ApplyChanges(res, dt * 0.5);
if (initiation.TranslationSpeed > 0)
{
dProtein = Math.Min(initiation.TranslationSpeed, dProtein);
dProtein = Math.Min(dProtein, Math.Min(res.Res.Protein.mRNA, availableAA));
res.Res.Protein.AminoAcids -= dProtein;
res.Res.Protein.FunctionalProteins += dProtein;
ribosomenState = 1;
}
else return;
break;
case 1:
elongation.ApplyChanges(res, dt * dProtein * 0.1);
if (elongation.TranslationSpeed > 0)
{
dProtein = Math.Min(elongation.TranslationSpeed, dProtein);
// mRNA-Abnutzung: jede mRNA kann nur begrenzt oft benutzt werden
double used_mRNA = dProtein / ProteinPermRNA;
res.Res.Protein.mRNA -= used_mRNA;
// Abbauprodukte: ein Teil recycelt, ein Teil wird zu Waste
double degraded = used_mRNA * 0.8;
double lost = used_mRNA * 0.2;
res.Res.Protein.Nucleotides += degraded; // Rückgewinn von Basen
res.Res.Protein.Waste += lost; // Restliche RNA-Fragmente als Zellabfall
ribosomenState = 2;
}
else return;
break;
case 2:
termination.ApplyChanges(res, dt * 0.01 * dProtein);
if (termination.TranslationSpeed > 0)
{
res.ConsumeATP(dProtein * 4); // z. B. 4 ATP pro Peptidbindung -> ADP
ribosomenState = 0;
}
else return;
break;
}
}
}
public override void ComputeRate(Resources res)
{
if (ribosomenState == 0) {
if (res.Protein.AminoAcids <= 0.0 || res.Protein.mRNA <= 0.0)
return;
double availablemRNA = res.Protein.mRNA;
Michaelis_Menten(availablemRNA);
initiation.ComputeRate(res);
elongation.ComputeRate(res);
termination.ComputeRate(res);
}
}
}
}
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseCellSimulation.Enzyms.Cytosol.Ribosomen
{
/*
* Faktor Aufgabe Energieverbrauch
* IF (Initiation Factors) Ribosom startet Translation 1 GTP
* EF-Tu, EF-G (Elongation) tRNA Positionierung, Translokation 1–2 GTP pro Zyklus
* RF (Release Factors) Beendet Translation an Stoppcodon 1 GTP
*/
internal class TranslationFactor : InternalEnzym
{
public enum FactorType { Initiation, Elongation, Termination }
public FactorType Type { get; }
public double TranslationSpeed;
public TranslationFactor(FactorType type)
{
Type = type;
Km = 0.1;
Vmax = 2.0;
}
public override void ComputeRate(Resources res)
{
Michaelis_Menten(res.Energy.GTP);
}
public override void ApplyChanges(CellRessources res, double dt)
{
double used = Math.Min(rate * dt, res.Res.Energy.GTP);
res.Res.Energy.GTP -= used;
res.Res.Energy.GDP += used;
TranslationSpeed = used;
}
}
}