I'm performing a simulation of protein-protein interactions. I'm using Python to code logic gates as functions to model protein interactions.
My model is basically a series of groups (g0
to g4
) containing logic gates (see image). Initially, I set up a list
containing my groups, and then for each group a dict
that contains proteins (nodes) with their starting values (their so-called seedValues
, which are the starting parameters for the network at t=0
).
My question is this: is there some way of iterating through my groups (and their logic gate functions), that begins at group 0 (g0
in the image) at t
, and that at t=t+1
executes groups g0
and g1
, then executes the three groups g0
, g1
and g2
at t=t+2
, and so on until t=m
, where m
is the number of iterations wanted?
Clarification: Perhaps I am unclear. My problem is this: say that I write a function that steps through my groups, one at a time. It starts at
g0
at timet=0
, and executes, stores and outputs all the gates in that group, plus all the gates "ahead" of itself (g1
tog4
). When this is done, the function ticks time one step forward (t=t+1
) and goes tog1
and exeuctes again, including outputting groupsg2
tog4
. Now is where an error creeps in: for an accurate model, I need to executeg0
at timet=t+1
too, before the program steps tog2
. How can I make my program output such sequential "waves" of execution? I imagine I might need to use recursion, but I don't know how.
See example image of what I mean with "groups" here. Image notes: A and B are switches (the program is supposed to change them, as a way of studying perturbations), C is a constant (never changed). J is the output (mostly for show). D and F are built that way to oscillate, whenever A = 0.
I have searched for this on Stack Exchange and Stack Overflow; while I see many questions that tangent my area of interest (1, 2), I don't see any that I determine specifically solve my problems. Thank you for your time.