From: Andrew F. <af...@ph...> - 2006-06-13 15:05:29
|
Rainer I've talked with people here and this argument is correct but I only vaguely understand the maths - I managed to graduate without covering PDEs :-(=20 I suggest you either: a) figure out with the others if there is away to do the PDE math so that we can support any combination rules and reactions. This would require I imagine some clever symbolic processing. or b) convert CVODE to substance units but then block the combination of rate rules for species in concentration units with rate rules for compartment volumes in fact there may still be problems with (b)... yours Andrew > -----Original Message----- > From: Rainer Machne [mailto:ra...@tb...]=20 > Sent: 13 June 2006 15:46 > To: Andrew Finney > Subject: RE: [SOSlib-devel] variable compartment bug[Scanned] >=20 > Andrew >=20 > > [S(0)] =3D S(0)/C(0) > > > > not > > > > [S(0)] =3D S(0)/C(t) >=20 > Let's say S doesn't change over time for some reason. It=20 > might even have an ODE, e.g. >=20 > dS/dt =3D ( k * S(t) * activeEnzyme(t) ) / C(t) >=20 > but during integration activeEnzyme never appears, i.e. its=20 > concentrations stays 0. Thus dS/dt is always 0. >=20 > Then in SOSlib the initialConcentration would not change and >=20 > [S(t)] =3D [S(0)] =3D S(0) / C(0) >=20 > while it actually should be >=20 > [S(t)] =3D S(0) / C(t) >=20 > This is not represented in SOSlib. Stefand and Luki pointed=20 > out that the problem might be even more fundamental and that=20 > we cannot represent variable compartments at all. >=20 > if S is a function of time and of volume C, S(t,C(t)), then >=20 > dS/dt =3D dS/dt + dS/dC * dC/dt >=20 > where the d on the right hand side represent the partial=20 > differential (as in PDEs). >=20 > Maybe on Friday, when Stefan is here, we can formulate the=20 > problem in more general terms. >=20 > Rainer >=20 >=20 > On Tue, 13 Jun 2006, Andrew Finney wrote: >=20 > > Rainer > > > > You wrote: > > > >> What cvode does is to add the concentration increase ds to the=20 > >> initial > >> concentration: > >> > >> s(t) =3D s(0) + ds > >> > >> if the volume is doubled during that time e.g. by a rate rule, ds=20 > >> should correctly include the changing volume because its=20 > part of the=20 > >> ODE. > >> > >> However, s(0)=3D1 has never been corrected for the changing volume! > >> > >> If the ODE ds/dt was 0 during this time, e.g. because of a missing=20 > >> activator of the reaction, s(t) would still change to 0.5, because=20 > >> the volume has doubled. > >> > >> This is not reflected in SOSlib! > > > > Either I'm missing something big here or... > > > > An initial concentration is an >initial< concentration > > > > at any time concentration > > > > [S] =3D S/C > > > > [S(t)] =3D S(t)/C(t) > > > > therefore > > > > [S(0)] =3D S(0)/C(0) > > > > not > > > > [S(0)] =3D S(0)/C(t) > > > > How can S(0) ever vary as the volume varies over time? > > S(0) is a value at only one point in time. > > > > yours Andrew > > > >> -----Original Message----- > >> From: Rainer Machne [mailto:ra...@tb...] > >> Sent: 13 June 2006 15:09 > >> To: Andrew Finney > >> Cc: SOSlib Development > >> Subject: RE: [SOSlib-devel] variable compartment bug[Scanned] > >> > >> Andrew > >> > >> > >> I have added a corrected and more clear version of the=20 > example file. > >> > >> > >>> All you need to do is ensure that the initialAmount values > >> are used to > >>> calculate the initialConcentration values again by=20 > dividing by the=20 > >>> volume. Have we implemented that? > >> > >> Yes, the internal SBML ode model only contains=20 > initialConcentrations;=20 > >> initialAmounts from the input model have all been converted by=20 > >> dividing by compartment size. > >> > >> > >>> if S1 is in a compartment with volume C then > >>> > >>> d[S1]/dt =3D (f1() + f2() + ... fn()) / C > >>> > >>> f1..fn are the reaction rates which are expressions that=20 > have units=20 > >>> substance/time > >>> > >>> f1...fn are functions of the concentrations of the species=20 > >>> [S1]..[Sn] > >>> > >>> I thought that's what we'd implemented. > >> > >> Yes, that is what we have. > >> > >> > >>> Why do you need two sets of values? > >> > >> Ok, I'll try to explain in more detail. > >> > >> I change the notation to > >> S ... amount of molecule S > >> s ... concentration, [S] =3D S/v > >> v ... volume > >> > >> > >> Imagine we start with initialConcentration s(0) =3D 1, and = integrate=20 > >> from 0 to time 1. > >> > >> What cvode does is to add the concentration increase ds to the=20 > >> initial > >> concentration: > >> > >> s(t) =3D s(0) + ds > >> > >> if the volume is doubled during that time e.g. by a rate rule, ds=20 > >> should correctly include the changing volume because its=20 > part of the=20 > >> ODE. > >> > >> However, s(0)=3D1 has never been corrected for the changing volume! > >> > >> If the ODE ds/dt was 0 during this time, e.g. because of a missing=20 > >> activator of the reaction, s(t) would still change to 0.5, because=20 > >> the volume has doubled. > >> > >> This is not reflected in SOSlib! > >> > >> To the example XML: > >> > >>> Note the initial volume of the compartment is not specified > >> in the xml. > >> > >> Sorry, I tried the model with old version which still had the=20 > >> `missing parameter bug' from last week. > >> See the attached corrected file. > >> > >> The compartment volume increases to 11 because of its rate rule=20 > >> d(volume)/dt =3D + 0.1 > >> > >> Substance s1 starts with concentration 1 and is totally=20 > consumed by=20 > >> the irreversible reaction > >> > >> S1 -> S2; kineticLaw =3D k+S1 > >> > >> which moves all molecules to S2. > >> > >> Substance S2 would have a final concentration of 1, if the=20 > >> compartment still had volume 1, but not for a final volume of 11. > >> > >> The final concentration should be 1/11. > >> > >> The totalConcentration in the example file should also decrease to=20 > >> 1/11. > >> > >> > >> SOSlib and the ODE division by volume only corrects the change of=20 > >> concentration but not the initial concentration, or=20 > generally spoken,=20 > >> the concentration of the last time step, which also has decreased. > >> > >> The only solution i can think of, is to define ODEs in=20 > substance/time=20 > >> and do the division independently of the ODE system. > >> > >> Rainer > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> On Tue, 13 Jun 2006, Andrew Finney wrote: > >> > >>> Rainer > >>> > >>> Slow down!! > >>> > >>> I don't actually understand the argument: > >>> why can't you have the ODEs as ODEs of concentrations: > >>> > >>> if S1 is in a compartment with volume C then > >>> > >>> d[S1]/dt =3D (f1() + f2() + ... fn()) / C > >>> > >>> f1..fn are the reaction rates which are expressions that=20 > have units=20 > >>> substance/time > >>> > >>> f1...fn are functions of the concentrations of the species=20 > >>> [S1]..[Sn] > >>> > >>> I thought that's what we'd implemented. > >>> > >>> Why do you need two sets of values? > >>> > >>> I would strongly urge we go for the approach is having one set of=20 > >>> values and carefully converting the units as is > >> appropriate. > >>> > >>> fundamentally what's the problem? > >>> > >>> In the SBML you sent the only fly in the ointment is that the=20 > >>> initial value for the species is expressed in substance units via=20 > >>> the initialAmount > >> attribute rather than > >>> the initialConcentration > >>> attribute which is in concentration units. > >>> > >>> All you need to do is ensure that the initialAmount=20 > values are used=20 > >>> to calculate the initialConcentration > >> values again by > >>> dividing by the volume. Have > >>> we implemented that? > >>> > >>> Note the initial volume of the compartment is not specified > >> in the xml. > >>> > >>> yours Andrew > >>> > >>>> -----Original Message----- > >>>> From: sbm...@li... > >>>> [mailto:sbm...@li...]=20 > On Behalf=20 > >>>> Of Rainer Machne > >>>> Sent: 13 June 2006 11:42 > >>>> To: SOSlib Development > >>>> Subject: [SOSlib-devel] variable compartment bug[Scanned] > >>>> > >>>> Folks > >>>> > >>>> Lukas has identified another serious bug! > >>>> > >>>> SOSlib doesn't support variable compartments. > >>>> > >>>> We initialize sundials with ODEs for concentrations d[A]/dt, and=20 > >>>> sundials calculates [A] + (d[A]/dt)*h, where h is a=20 > small time step=20 > >>>> and [A] is the initial condition or the current value. > >>>> > >>>> If we have a variable, e.g time-dependent compartment,=20 > then d[A]/dt=20 > >>>> will change with changing compartment because the=20 > compartment size=20 > >>>> is part of the right hand side. > >>>> > >>>> However, not only d[A]/dt is dependent on the volume,=20 > but also [A],=20 > >>>> i.e. > >>>> the current value in data->value! > >>>> > >>>> The attached example file exemplifies this. > >>>> > >>>> So we actually should use an ODE system in amount/time=20 > instead of=20 > >>>> concentration/time, and have a second data->value array for=20 > >>>> concentrations to be used in formula evaluation. > >>>> > >>>> Didn't we discuss this once? I remember that I had started to do=20 > >>>> this (ODEs in amount/time), but then it got more=20 > complicated then I=20 > >>>> thought and something else came up. > >>>> > >>>> Can you think of any problems we will run into? Andrew,=20 > how about=20 > >>>> the compiling version? > >>>> > >>>> Rainer > >>>> > >>> > >> > > >=20 |