# Replicate an agent including internal state

13 views

### n4323

May 7, 2019, 4:21:06 AM5/7/19
to kappa-users
Hi,

I have a signature  E(n{A B C}, d{f b}, l[r.E], r[l.E]) . This can generate long polymers in principle but my rules can only decrease the number of monomers from an initial state which is a chain with three monomers:

E(n{A}, d{f}, l[.], r[1]), E(n{B}, d{f}, l[1], r[2]), E(n{C}, d{f}, l[2], r[.])

One rule I would like to implement is duplication of a chain, including the internal state. As one agent has 3 x 2 = 6 internal states, a chain of two has already 36 of them. I don't want to (and can't, for longer chains) write the duplication out explicitly for each internal state combination!

Is there a way to write something like

E(r[1]), E(l[1]), ., . -> E(r[1]), E(l[1]), E(r[2]), E(l[2])

such that the new copy has the exact same internal state as the old, instead of a default ?

One way to achieve this would be to introduce pattern variables, where the internal state on the LHS can be captured and inserted on the RHS, analogous to regular expressions.

Thanks!

### Ricardo Honorato Z

May 8, 2019, 11:46:33 PM5/8/19
to n4323, kappa-users
Hi,

You could copy the internal state of the chain using a copy agent C(o[n.E], c[n.E]) and some Kappa rules.

# begin copy of chain
E(l, n{A}, d{f}) -> E(l, n{A}[1], d{f}), C(o[1], c[2]), E(n{A}[2], d{f})
E(l, n{A}, d{b}) -> E(l, n{A}[1], d{b}), C(o[1], c[2]), E(n{A}[2], d{b})
E(l, n{B}, d{f}) -> E(l, n{B}[1], d{f}), C(o[1], c[2]), E(n{B}[2], d{f})
E(l, n{B}, d{b}) -> E(l, n{B}[1], d{b}), C(o[1], c[2]), E(n{B}[2], d{b})
E(l, n{C}, d{f}) -> E(l, n{C}[1], d{f}), C(o[1], c[2]), E(n{C}[2], d{f})
E(l, n{C}, d{b}) -> E(l, n{C}[1], d{b}), C(o[1], c[2]), E(n{C}[2], d{b})
# copy next monomer
E(r[1], n[2]), E(l[1], n{A}, d{f}), C(o[2], c[3]), E(r, n[3]) -> E(r[1], n), E(l[1], n{A}[2], d{f}), C(o[2], c[5]), E(r[4], n), E(l[4], n{A}[5], d{f})
E(r[1], n[2]), E(l[1], n{A}, d{b}), C(o[2], c[3]), E(r, n[3]) -> E(r[1], n), E(l[1], n{A}[2], d{b}), C(o[2], c[5]), E(r[4], n), E(l[4], n{A}[5], d{b})
E(r[1], n[2]), E(l[1], n{B}, d{f}), C(o[2], c[3]), E(r, n[3]) -> E(r[1], n), E(l[1], n{B}[2], d{f}), C(o[2], c[5]), E(r[4], n), E(l[4], n{B}[5], d{f})
E(r[1], n[2]), E(l[1], n{B}, d{b}), C(o[2], c[3]), E(r, n[3]) -> E(r[1], n), E(l[1], n{B}[2], d{b}), C(o[2], c[5]), E(r[4], n), E(l[4], n{B}[5], d{b})
E(r[1], n[2]), E(l[1], n{C}, d{f}), C(o[2], c[3]), E(r, n[3]) -> E(r[1], n), E(l[1], n{C}[2], d{f}), C(o[2], c[5]), E(r[4], n), E(l[4], n{C}[5], d{f})
E(r[1], n[2]), E(l[1], n{C}, d{b}), C(o[2], c[3]), E(r, n[3]) -> E(r[1], n), E(l[1], n{C}[2], d{b}), C(o[2], c[5]), E(r[4], n), E(l[4], n{C}[5], d{b})
# finish copying
E(r, n[1]), E(n[2]), C(o[1], c[2]) -> E(r, n), E(n)

I recommend you draw them to see more easily what these rules are doing. With these rules you can copy chains of any length.

One way to achieve this would be to introduce pattern variables, where the internal state on the LHS can be captured and inserted on the RHS, analogous to regular expressions.

I believe that's usually called coloured Kappa and as far as I remember it hasn't been implemented yet.

Cheers!