|
16 | 16 | # You should have received a copy of the GNU General Public License |
17 | 17 | # along with meneco. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 | # -*- coding: utf-8 -*- |
19 | | -from pyasp.asp import * |
20 | 19 | import argparse |
| 20 | +import sys |
| 21 | +from pyasp.asp import * |
21 | 22 | from __meneco__ import query, utils, sbml |
22 | 23 |
|
23 | 24 | if __name__ == '__main__': |
|
45 | 46 | targets_sbml = args.targets |
46 | 47 |
|
47 | 48 | print 'Reading draft network from ',draft_sbml,'...', |
| 49 | + sys.stdout.flush() |
48 | 50 | draftnet = sbml.readSBMLnetwork(draft_sbml, 'draft') |
49 | 51 | print 'done.' |
50 | 52 | #draftnet.to_file("draftnet.lp") |
51 | 53 |
|
52 | 54 | print 'Reading seeds from ',seeds_sbml,'...', |
| 55 | + sys.stdout.flush() |
53 | 56 | seeds = sbml.readSBMLseeds(seeds_sbml) |
54 | 57 | print 'done.' |
55 | 58 | #seeds.to_file("seeds.lp") |
56 | 59 |
|
57 | 60 | print 'Reading targets from ',targets_sbml,'...', |
| 61 | + sys.stdout.flush() |
58 | 62 | targets = sbml.readSBMLtargets(targets_sbml) |
59 | 63 | print 'done.' |
60 | 64 | #targets.to_file("targets.lp") |
61 | 65 |
|
62 | 66 | print '\nChecking draftnet for unproducible targets ...', |
| 67 | + sys.stdout.flush() |
63 | 68 | model = query.get_unproducible(draftnet, targets, seeds) |
64 | 69 | print 'done.' |
65 | 70 | print ' ',len(model),'unproducible targets:' |
|
71 | 76 | unproducible_targets = unproducible_targets.union(t) |
72 | 77 |
|
73 | 78 | print '\nReading repair network from ',repair_sbml,'...', |
| 79 | + sys.stdout.flush() |
74 | 80 | repairnet = sbml.readSBMLnetwork(repair_sbml, 'repairnet') |
75 | 81 | print 'done.' |
76 | 82 | #repairnet.to_file("repairnet.lp") |
|
79 | 85 | all_reactions = draftnet |
80 | 86 | all_reactions = all_reactions.union(repairnet) |
81 | 87 | print '\nChecking draftnet + repairnet for unproducible targets ...', |
| 88 | + sys.stdout.flush() |
82 | 89 | model = query.get_unproducible(all_reactions, seeds, targets) |
83 | 90 | print 'done.' |
84 | 91 | print ' still',len(model),'unproducible targets:' |
|
105 | 112 | single_target = TermSet() |
106 | 113 | single_target.add(t) |
107 | 114 | print '\nComputing essential reactions for',t,'...', |
| 115 | + sys.stdout.flush() |
108 | 116 | essentials = query.get_intersection_of_completions(draftnet, repairnet, seeds, single_target) |
109 | 117 | print 'done.' |
110 | 118 | print ' ',len(essentials), 'essential reactions found:' |
|
124 | 132 | #seeds.to_file("seeds.lp") |
125 | 133 |
|
126 | 134 | print '\nComputing one minimal completion to produce all targets ...', |
| 135 | + sys.stdout.flush() |
127 | 136 | models = query.get_minimal_completion_size(draftnet, repairnet, seeds, reconstructable_targets) |
128 | 137 | print 'done.' |
129 | 138 | optimum = models[0].score[0] |
130 | 139 | utils.print_met(models[0].to_list()) |
131 | 140 |
|
132 | 141 |
|
133 | 142 | print '\nComputing common reactions in all completion with size',optimum,'...', |
| 143 | + sys.stdout.flush() |
134 | 144 | model = query.get_intersection_of_optimal_completions(draftnet, repairnet, seeds, reconstructable_targets, optimum) |
135 | 145 | print 'done.' |
136 | 146 | utils.print_met(model.to_list()) |
137 | 147 |
|
138 | 148 | print '\nComputing union of reactions from all completion with size',optimum,'...', |
| 149 | + sys.stdout.flush() |
139 | 150 | model = query.get_union_of_optimal_completions(draftnet, repairnet, seeds, reconstructable_targets, optimum) |
140 | 151 | print 'done.' |
141 | 152 | utils.print_met(model.to_list()) |
142 | 153 |
|
143 | 154 | if args.enumerate : |
144 | 155 | print '\nComputing all completions with size',optimum,'...', |
| 156 | + sys.stdout.flush() |
145 | 157 | models = query.get_optimal_completions(draftnet, repairnet, seeds, reconstructable_targets, optimum) |
146 | 158 | print 'done.' |
147 | 159 | count = 1 |
|
0 commit comments