def test_fba_return_dims(): ensemble = construct_textbook_ensemble() fba_fluxes = optimize_ensemble(ensemble) rows = fba_fluxes.shape[0] columns = fba_fluxes.shape[1] assert rows == len(ensemble.members) assert columns == len(ensemble.base_model.reactions)
def test_fba_random_sample(): # test return of FBA on randomly sampled ensemble members ensemble = construct_mixed_ensemble() nmodels = 2 fba_fluxes = optimize_ensemble(ensemble, num_models=nmodels) rows = fba_fluxes.shape[0] columns = fba_fluxes.shape[1] assert rows == nmodels assert columns == len(ensemble.base_model.reactions)
def test_fba_single_return(): # test return of flux values for a single reaction ensemble = construct_textbook_ensemble() fba_fluxes = optimize_ensemble( ensemble, return_flux=ensemble.base_model.reactions[2].id) rows = fba_fluxes.shape[0] columns = fba_fluxes.shape[1] assert rows == len(ensemble.members) assert columns == 1
def test_fba_specific_models(): # test return of FBA on specific ensemble members ensemble = construct_mixed_ensemble() model1 = ensemble.members[0] model2 = ensemble.members[1] model_list = [model1, model2] fba_fluxes = optimize_ensemble(ensemble, specific_models=model_list) rows = fba_fluxes.shape[0] columns = fba_fluxes.shape[1] rownames = fba_fluxes.index assert rows == len(model_list) assert columns == len(ensemble.base_model.reactions) assert rownames.contains(model1) assert rownames.contains(model2)