sybila / eBCSgen

eBCSgen - BioChemical Space Language support tool.
https://ebcsgen.readthedocs.io/
MIT License
2 stars 4 forks source link

replication rules #106

Closed mopichalova closed 6 months ago

mopichalova commented 7 months ago

replication rules - this feature is quite hardcoded, the first question is whether we want to support it at all, then how to do it in a robust way

mopichalova commented 7 months ago

Questions about how do the replication rules work and should work @xtrojak

I am thinking of using =*> or =>> as an arrow for replication rules. If I create a new way to define replication rule, would this mean that if someone defines what is considered replication now with regular arrow, the “pair mapping” will not be evaluated as replication? So in practice that would mean that this part of the code would be removed:

elif lhs.counter < rhs.counter:
  for i in range(lhs.counter, rhs.counter):
    replication = False
    if lhs.counter == 1 and rhs.counter > 1:
        if lhs.seq[pairs[-1][0]] == rhs.seq[pairs[-1][1] - lhs.counter]:
            if rhs.seq[pairs[-1][1] - lhs.counter] == rhs.seq[i]:
                pairs += [(pairs[-1][0], i + lhs.counter)]
                replication = True
    if not replication:
        pairs += [(None, i + lhs.counter)]

Should this be considered replication: X()::rep + Y()::cell => X()::rep + X()::rep + Y()::cell or only when left side counter is set to one, e.g. X()::rep => X()::rep + X()::rep?

And would multiple replication like this: X()::rep => X()::rep + X()::rep + X()::rep be allowed or considered multiplication?

xtrojak commented 6 months ago

Questions about how do the replication rules work and should work @xtrojak

I am thinking of using =*> or =>> as an arrow for replication rules. If I create a new way to define replication rule, would this mean that if someone defines what is considered replication now with regular arrow, the “pair mapping” will not be evaluated as replication? So in practice that would mean that this part of the code would be removed:

Sure, use any special arrow you find suitable. I personally like =*>.

elif lhs.counter < rhs.counter:
  for i in range(lhs.counter, rhs.counter):
    replication = False
    if lhs.counter == 1 and rhs.counter > 1:
        if lhs.seq[pairs[-1][0]] == rhs.seq[pairs[-1][1] - lhs.counter]:
            if rhs.seq[pairs[-1][1] - lhs.counter] == rhs.seq[i]:
                pairs += [(pairs[-1][0], i + lhs.counter)]
                replication = True
    if not replication:
        pairs += [(None, i + lhs.counter)]

Yes, this code will be then removed. Or more precisely, a form of this will be moved somewhere where the introduced special arrow is handled.

Should this be considered replication: X()::rep + Y()::cell => X()::rep + X()::rep + Y()::cell or only when left side counter is set to one, e.g. X()::rep => X()::rep + X()::rep?

We could consider that, but I think goes too far. As replication, I would consider only X()::rep =*> X()::rep + X()::rep.

And would multiple replication like this: X()::rep => X()::rep + X()::rep + X()::rep be allowed or considered multiplication?

Yes, I think we can implement this, I don't see a problem in that. Biological meaning is questionable, but let's not go into this discussion. It makes sense mathematically though.