def setUp(self): self._database = DictDatabase() self._database.set_reaction('rxn_1', parse_reaction('|A| <=>')) self._database.set_reaction('rxn_2', parse_reaction('|A| <=> |B|')) self._database.set_reaction('rxn_3', parse_reaction('|C| <=> |B|')) self._database.set_reaction('rxn_4', parse_reaction('|C| <=>')) self._mm = MetabolicModel.load_model(self._database, self._database.reactions) self._strategy = randomsparse.ReactionDeletionStrategy(self._mm)
def test_random_sparse_reaction_strategy(self): expected = [({'rxn_1', 'rxn_6', 'ex_A', 'rxn_2', 'rxn_4'}, {'rxn_3', 'rxn_5'}), ({'rxn_1', 'rxn_6', 'ex_A', 'rxn_3', 'rxn_5'}, {'rxn_2', 'rxn_4'})] strategy = randomsparse.ReactionDeletionStrategy(self._mm) essential, deleted = randomsparse.random_sparse(strategy, self._prob, self._obj_reaction, flux_threshold=100) self.assertTrue((essential, deleted) in expected)