def run(self):
<EOL>def compound_name(id):<EOL><INDENT>if id not in self._model.compounds:<EOL><INDENT>return id<EOL><DEDENT>return self._model.compounds[id].properties.get('<STR_LIT:name>', id)<EOL><DEDENT>epsilon = self._args.epsilon<EOL>if self._args.unrestricted:<EOL><INDENT>for reaction in self._mm.reactions:<EOL><INDENT>if self._mm.is_exchange(reaction):<EOL><INDENT>del self._mm.limits[reaction].bounds<EOL><DEDENT><DEDENT><DEDENT>loop_removal = self._get_loop_removal_option()<EOL>enable_tfba = loop_removal == '<STR_LIT>'<EOL>enable_fastcore = self._args.fastcore<EOL>if enable_tfba and enable_fastcore:<EOL><INDENT>self.argument_error(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>start_time = time.time()<EOL>if enable_fastcore:<EOL><INDENT>solver = self._get_solver()<EOL>try:<EOL><INDENT>inconsistent = set(fastcore.fastcc(<EOL>self._mm, epsilon, solver=solver))<EOL><DEDENT>except fluxanalysis.FluxBalanceError as e:<EOL><INDENT>self.report_flux_balance_error(e)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if enable_tfba:<EOL><INDENT>solver = self._get_solver(integer=True)<EOL><DEDENT>else:<EOL><INDENT>solver = self._get_solver()<EOL><DEDENT>if self._args.reduce_lp:<EOL><INDENT>logger.info('<STR_LIT>')<EOL>try:<EOL><INDENT>inconsistent = set(<EOL>fluxanalysis.consistency_check(<EOL>self._mm, self._mm.reactions, epsilon,<EOL>tfba=enable_tfba, solver=solver))<EOL><DEDENT>except fluxanalysis.FluxBalanceError as e:<EOL><INDENT>self.report_flux_balance_error(e)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>logger.info('<STR_LIT>')<EOL>try:<EOL><INDENT>inconsistent = set(self._run_fva_fluxcheck(<EOL>self._mm, solver, enable_tfba, epsilon))<EOL><DEDENT>except FluxCheckFVATaskError:<EOL><INDENT>self.report_flux_balance_error()<EOL><DEDENT><DEDENT><DEDENT>logger.info('<STR_LIT>'.format(<EOL>time.time() - start_time))<EOL>disabled_exchange = <NUM_LIT:0><EOL>disabled_internal = <NUM_LIT:0><EOL>count_exchange = <NUM_LIT:0><EOL>total_exchange = <NUM_LIT:0><EOL>count_internal = <NUM_LIT:0><EOL>total_internal = <NUM_LIT:0><EOL>for reaction in sorted(self._mm.reactions):<EOL><INDENT>disabled = self._mm.limits[reaction].bounds == (<NUM_LIT:0>, <NUM_LIT:0>)<EOL>if self._mm.is_exchange(reaction):<EOL><INDENT>total_exchange += <NUM_LIT:1><EOL>count_exchange += int(reaction in inconsistent)<EOL>disabled_exchange += int(disabled)<EOL><DEDENT>else:<EOL><INDENT>total_internal += <NUM_LIT:1><EOL>count_internal += int(reaction in inconsistent)<EOL>disabled_internal += int(disabled)<EOL><DEDENT>if reaction in inconsistent:<EOL><INDENT>rx = self._mm.get_reaction(reaction)<EOL>rxt = rx.translated_compounds(compound_name)<EOL>print('<STR_LIT>'.format(reaction, rxt))<EOL><DEDENT><DEDENT>logger.info('<STR_LIT>'<EOL>'<STR_LIT>'.format(<EOL>count_internal, total_internal, disabled_internal))<EOL>logger.info('<STR_LIT>'<EOL>'<STR_LIT>'.format(<EOL>count_exchange, total_exchange, disabled_exchange))<EOL>
Run flux consistency check command