file_exchange¶
- bnet2primes(bnet: str, fname_primes: Optional[str] = None) dict ¶
Generates and returns the prime implicants of a Boolean network in boolnet format. The primes are saved as a json file if fname_primes is given. The argument bnet may be either the name of a bnet file or a string containing the file contents. Use the function read_primes to open a previously saved json file.
- arguments:
bnet: name of bnet file or string contents of file
fname_primes: None or name of json file to save primes
- returns:
primes: prime implicants
example:
>>> primes = bnet2primes("mapk.bnet", "mapk.primes" ) >>> primes = bnet2primes("mapk.bnet") >>> primes = bnet2primes("Erk, !Mek \n Raf, Ras & Mek") >>> primes = bnet2primes("Erk, !Mek \n Raf, Ras & Mek", "mapk.primes")
- primes2bnet(primes: dict, fname_bnet: Optional[str] = None, minimize: bool = False, header: bool = False) str ¶
Saves primes as a bnet file, including the header “targets, factors” for compatibility with BoolNet. Without minimization, the resuting formulas are disjunctions of all prime implicants and may therefore be very long. If Minimize=True then a Python version of the Quine-McCluskey algorithm, namely Prekas2012 which is implemented in QuineMcCluskey.primes2mindnf, will be used to minimize the number of clauses for each update function.
- arguments:
primes: prime implicants
fname_bnet: name of bnet file or None for the string of the file contents
minimize: minimize the Boolean expressions
header: whether to include the “targets, factors” header
- returns:
text_bnet: str contents of bnet file
example:
>>> primes2bnet(primes, "mapk.bnet") >>> primes2bnet(primes, "mapk.bnet", True) >>> expr = primes2bnet(primes) >>> expr = primes2bnet(primes, True)
- primes2bns(primes: dict, fname_bns: Optional[str] = None) str ¶
Saves Primes as a bns file for the computation of all attractors of the synchronous transition system. BNS_ is based on Dubrova2011. It is available at http://people.kth.se/~dubrova/bns.html.
- arguments:
primes: prime implicants
fname_bns: name of bns file or None to return file as string
example:
>>> primes2bns(primes, "mapk.bns")
- primes2eqn(primes: dict, fname_eqn: Optional[str] = None) str ¶
Generates a eqn file as specified in the manual for the model checking software Antelope_ from primes. Antelope_ was introduced in Arellano2011.
- arguments:
primes: prime implicants
fname_eqn: name of eqn file
example:
>>> primes2eqn(primes, "mapk.eqn")
- primes2genysis(primes: dict, fname_genysis: str)¶
Generates a GenYsis_ file from primes for the computation of all attractors of the synchronous or asynchronous transition system. GenYsis_ was introduced in Garg2008. It is available at http://www.vital-it.ch/software/genYsis.
- arguments:
primes: prime implicants
fname_genysis: name of GenYsis_ file
example:
>>> primes2genysis(primes, "mapk.genysis")
- read_primes(fname_json: str) dict ¶
Reads the prime implicants of a Boolean network that were previously stored as a json file.
- arguments:
fname_json: name of json file
- returns:
primes: prime implicants
example:
>>> primes = read_primes("mapk.primes")
- write_primes(primes: dict, fname_json: str)¶
Saves primes as a json file.
- arguments:
primes: prime implicants
fname_json: name of json file
example:
>>> write_primes(primes, "mapk.primes")