










dg.py:
-------
1.) Loads the grammar
2.) Defines a strategy for expanding the chemical space:
    add ribuloseP and water, then apply all rules to create all
    molecules with <= 8 carbon atoms and all reactions between
    them
3.) Computes the derivation graph
 
dgStrict.py:
-------------
same thing as above, but a stricter rule of how to expand the chemical space:

strat = (addUniverse(water) >> addSubset(ribuloseP)
	>> aldoKetoF >> transKeto
	>> [
		transAldo >> transKeto,
		aldoKetoB >> aldolase >> phosphohydro
	])

Add water and ribuloseP, then apply aldoKetoF, then transKeto. After 
that apply the sequence of "transAldo -> transKeto" and the sequence
of "aldoKetoB -> aldolase -> phosphohydro" in parallel.

dgRepeat.py:
------------
same as dg.py, but expects a variable "steps" to be defined. This line:

dg.build().execute(
	addSubset(ribuloseP, water)
	>> repeat[steps](inputRules)
)

allows to expand the chemical space with all rules loaded "steps"
times.  "steps" will be defined on the command line (see below).


pathway.py
-----------
For finding a pathway in the chemical space we have to define a pathway
(or a specific "autocatalytic" pathway). This pathway (variable flow 
below) will have 2 sources: ribuloseP, water. After that we define
how many of these molecules are provided. The "addSinks" defines the 
sink (the solver will try to maximize the outflow for this compound).
We allow anything else also to be a sink by

   for v in dg.vertices: flow.addSink(v.graph)

"flow.findSolutions()" will try to find an optimal solution (the objective
function tries to maximize the outflow and as a lower priority
objective criteria to minimize the number of (hyper)edges used.
"flow.solutions.list()" prints information for the solutions on 
the terminal.

flow = hyperflow.Model(dg)
flow.addSource(ribuloseP)
flow.addSource(water)
flow.addConstraint(inFlow[ribuloseP] == 6)
flow.addConstraint(inFlow[water] == 1)
flow.addSink(fructoseP)
flow.addConstraint(outFlow[fructoseP] >= 1)
flow.objectiveFunction = -outFlow[fructoseP]
for v in dg.vertices: flow.addSink(v.graph)
flow.findSolutions(
	#verbosity=2
)
flow.solutions.list()



printStuff.py
--------------
This will define how the report will look like.

postSection("Loaded Graphs") 
                        : will create a section in the pdf.

In the current Python interface this is written as

post.summarySection("Loaded Graphs")

for a in inputGraphs: a.print()   :   will print all the input graphs as structure diagrams
		            	      (if they are molecules), and as normal "graphs"

for a in inputRules: a.print()	  :   will print all the rules (as graphs
      	 	     		      and also in a more "chemical" way.

dg.print();			  :   print the chemical space in a hypergraph
				      and in a non-hypergraph way

for v in dg.vertices: v.graph.print()
				  :   print _all_ the vertices - be carefull!

flowPrinter.printUnfiltered = False
			: With setting this variable to "true" the solution
			  will be highlighted and embedded in the derivation
			  graph. If the derivation graph is large, this will
			  make no sense.

flow.solutions.print()
	                : This prints _all_ solutions found.


realisability.py
----------------
For each flow solution, this tries to find and print a realisation DAG.
If no DAG is found directly, it tries to identify catalysts and prints
the corresponding realisation information.


Command line examples to make the test run:
-------------------------------------------
1.) Strict expansion, then define the optimization problem and find the 
    pathway, then handle the printing:

    mod  -f dgStrict.py -f pathway.py -f printStuff.py

    To additionally print realisability information for the flow
    solutions, run:

    mod  -f dgStrict.py -f pathway.py -f printStuff.py -f realisability.py

2.) Apply all rules twice, dont do any optimization, just print things.
    The file "printStuff.py" contains the line

    flow.solutions.print()

    but dgRepeat.py does not define a variable "flow". For this
    example, either comment out that line in printStuff.py, or use
    the provided file printStuffNoFlow.py.

    mod -e 'steps=2;' -f dgRepeat.py -f printStuffNoFlow.py

3.) Expand the DG iteratively, until convergence (as described above,
    however convergence won't be achieved here...),
    solve the query, and print it. This will take ages, and you also
    don't want to print all the products.

    mod  -f dgNotGood.py -f pathway.py -f printStuff.py
