matthiasbock / BooleSim

Systems biology tool: Boolean network simulator
http://matthiasbock.github.io/BooleSim
11 stars 6 forks source link

Rule - Network view - translation #13

Open TillS opened 11 years ago

TillS commented 11 years ago

If "!" in front of parentheses in the imported file or in the rules tab, it is not translated as an inhibition in the network view

chaitan3 commented 11 years ago

Consider the rule " !( !node1 && node2)", what should be the arrow type for node1 ? Also should the arrow be the same if && is replaced by || ?

The syntax parser is pretty simple currently. It has been made using regex. To accommodate features like above a proper parser is needed which constructs a tree representation of the rule.

TillS commented 11 years ago

We should argue following the two deMorgan laws for Boolean algebra:

(De Morgan 1) (¬x)∧(¬y) = ¬(x∨y) (De Morgan 2) (¬x)∨(¬y) = ¬(x∧y)

Thus, for && and || it works in the same way for the arrow type alone. Your example !( !node1 && node2 ) should translate in a positive arrow head for node 1 and a negative for node 2. Same if it was || instead of &&. If someone could implement that, that would be awesome! Cheers

TillS commented 11 years ago

As Matthias and I understand, the syntax parser will be a lot of work. However, in my opinion, if we really want to design a functional tool that can translate the rules, this kind of parser is definitely necessary. The only other option to think about would be to translate all the rules into the simplified rules first using the Boolean algebra, i.e. commutativity, associativity, deMorgan etc. and then apply the regex parser that you already have and that can handle the simplified representation of the rules. What is your opinion on this subject, Chaitanya? Cheers

chaitan3 commented 11 years ago

Constructing a better parser is indeed a lot of work. It will require constructing ASTs for every rule, similar to the approach that Till has suggested. If a good js library that implements such functionality is found, it would greatly simplify the solution.