|
King-Alman
rate equation generator
The King-Altamn rate equation
generator, despite its apparently obscure and
technical immediate application, is one of the
most sophisticated examples of pure programming
I have ever produced. Much of the fron end is
extremely simple, and it is only the heart of
the engine, which is used to calculate the elements
of each term in the denominator of the rate equation,
which is of any real interest to any non-biochemists.
I will attempt an explanation of the complexity
of the problem with which I was faced, and how
I eventually solved it. Essentially, this situation
was this: a number of terms, each constructed
from one element from each 'level' have to be
collected. Each 'level' can contain up to 10 elements,
and there can be up to ten levels. starting at
the first level, the program must make its way
to the last, collecting elements on its way. If
it chooses always to always go down the left-most
branch, then one valid term will be generated.
If it chooses to go down the left-most branch
for all but the last, where it travles down the
second-left-most branch, another combination is
generated. What we have, essentially then, is
a branching tree problem: at each fork, where
the program has two or more choices on its next
path, effectively what is required is for the
procedure that makes the decisions, and simultaneously
collects the elements, to run copies of itself
for every branch in the level below it. These,
in turn, will be completely capable of handling
the branches below them. And so on, until the
maximum, tenth, level. The classical approach
I would make to problems of this sort would be
one of specific coding; introducing a FOR
loop control variable for each stage of the procedure,
and controlling each individually. Although this
would allow for greatly simplified coding, the
code structure is manifestly inelegant and overcomplicated,
and it lacks the wholeness that truly defines
pure code at its best. It also becomes increasingly
complex if the code ever had to be extended for
more than 10 levels, and soon becomes unmanagable,
if only in the volume of code, for many more than
three times this number. It also is rather tedious
to write, and being prepared for a challenge,
I accepted a different route. Here, a small procedure
adds the element it finds to the growing string
of the term its compiling, and then makes exact
copies of itself for every branch below the current
level. I implemented this is Delphi through a
procedure that, when ready to spawn new versions
of itself, simply called itself with an indication
of which level to start on, and passing on the
term it carries to all its progeny. Ultimately,
and with a little experimentation, this approach
(to my surprise) seemed to work, and (to bring
this rapidly to conclusion) can generate rate
equations from the simple rmodel reversible michaelis-menton
equation to the complex ones of inhibiton or multiple
substrates, or beyond. For those interested in
how to program a mechanism into the generor, the
method is to identify all different enzyme forms
in your mechanism; ie. free enzyme, enzyme bound
to substrate etc; and plug them in the top list,
remembering to ignore isomerisation. If the enzyme
form can be converted to another with a pseudo-first
order rate constant, then find the origin form
on the left and the destination on top, and put
the constant name in there. The program employs
reserved 'words', such as 'a' and 'p' for substrate
and product, that you can use if making use of
the automatic factorisation. Note this generator
only produces the denominator-the numerators are
often trivially derived using the method of Wong
and Haines. The rate generator is available for
download with full source for Delphi 4 below.
Download
the Rate Generator (225 Kb, zipped) | Back
to News
|