def test_random_sparse_gene_strategy(self): expected = [({'gene_1', 'gene_2'}, {'gene_3', 'gene_4'}), ({'gene_1', 'gene_3'}, {'gene_2', 'gene_4'})] strategy = randomsparse.GeneDeletionStrategy(self._mm, self._assoc) essential, deleted = randomsparse.random_sparse(strategy, self._prob, self._obj_reaction, flux_threshold=100) self.assertTrue((essential, deleted) in expected)
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._assoc = {'rxn_2': boolean.Expression('gene_1 or gene_2')} self._strategy = randomsparse.GeneDeletionStrategy( self._mm, self._assoc)