from pytfa.redgem.redgem import RedGEM

from pytfa.io import import_matlab_model
from pytfa.io.base import load_thermoDB
from pytfa.thermo.tmodel import ThermoModel
from pytfa.io import  read_compartment_data, apply_compartment_data, read_lexicon, annotate_from_lexicon



path_to_model = 'models/small_ecoli.mat'
thermoDB = "data/thermo_data.thermodb"
carbon_uptake = 60000
growth = 0.5

model = import_matlab_model(path_to_model)
thermo_data = load_thermoDB(thermoDB)
lexicon = read_lexicon('models/iJO1366/lexicon.csv')
compartment_data = read_compartment_data('models/iJO1366/compartment_data.json')

tfa_model = ThermoModel(thermo_data, model)
annotate_from_lexicon(tfa_model, lexicon)
apply_compartment_data(tfa_model, compartment_data)

tfa_model.name = 'Lumped Model'

path_to_params = 'tests/redgem_params.yml'

redgem = RedGEM(tfa_model, path_to_params, False)
redgem.run()

from pytfa.redgem.redgem import RedGEM

from pytfa.io import import_matlab_model
from pytfa.io.base import load_thermoDB
from pytfa.thermo.tmodel import ThermoModel
from pytfa.io import  read_compartment_data, apply_compartment_data, read_lexicon, annotate_from_lexicon


path_to_model = 'models/small_ecoli.mat'
thermoDB = "data/thermo_data.thermodb"
path_to_lexicon = 'models/iJO1366/lexicon.csv'
path_to_compartment_data = 'models/iJO1366/compartment_data.json'

model = import_matlab_model(path_to_model)
thermo_data = load_thermoDB(thermoDB)
lexicon = read_lexicon(path_to_lexicon)
compartment_data = read_compartment_data(path_to_compartment_data)

tfa_model = ThermoModel(thermo_data, model)
annotate_from_lexicon(tfa_model, lexicon)
apply_compartment_data(tfa_model, compartment_data)

tfa_model.name = 'Lumped Model'

path_to_params = 'tests/redgem_params.yml'

redgem = RedGEM(tfa_model, path_to_params, False)
redgem.run()

Remove unused parameters in test script
FIX: Remove unused parameters in test script

  from pytfa.redgem.redgem import RedGEM
  
  from pytfa.io import import_matlab_model
  from pytfa.io.base import load_thermoDB
  from pytfa.thermo.tmodel import ThermoModel
  from pytfa.io import  read_compartment_data, apply_compartment_data, read_lexicon, annotate_from_lexicon
  
  
- 
  path_to_model = 'models/small_ecoli.mat'
  thermoDB = "data/thermo_data.thermodb"
- carbon_uptake = 60000
- growth = 0.5
+ path_to_lexicon = 'models/iJO1366/lexicon.csv'
+ path_to_compartment_data = 'models/iJO1366/compartment_data.json'
  
  model = import_matlab_model(path_to_model)
  thermo_data = load_thermoDB(thermoDB)
- lexicon = read_lexicon('models/iJO1366/lexicon.csv')
+ lexicon = read_lexicon(path_to_lexicon)
- compartment_data = read_compartment_data('models/iJO1366/compartment_data.json')
+ compartment_data = read_compartment_data(path_to_compartment_data)
  
  tfa_model = ThermoModel(thermo_data, model)
  annotate_from_lexicon(tfa_model, lexicon)
  apply_compartment_data(tfa_model, compartment_data)
  
  tfa_model.name = 'Lumped Model'
  
  path_to_params = 'tests/redgem_params.yml'
  
  redgem = RedGEM(tfa_model, path_to_params, False)
  redgem.run()
  
Remove unused parameters in test script
## Code Before:
from pytfa.redgem.redgem import RedGEM

from pytfa.io import import_matlab_model
from pytfa.io.base import load_thermoDB
from pytfa.thermo.tmodel import ThermoModel
from pytfa.io import  read_compartment_data, apply_compartment_data, read_lexicon, annotate_from_lexicon



path_to_model = 'models/small_ecoli.mat'
thermoDB = "data/thermo_data.thermodb"
carbon_uptake = 60000
growth = 0.5

model = import_matlab_model(path_to_model)
thermo_data = load_thermoDB(thermoDB)
lexicon = read_lexicon('models/iJO1366/lexicon.csv')
compartment_data = read_compartment_data('models/iJO1366/compartment_data.json')

tfa_model = ThermoModel(thermo_data, model)
annotate_from_lexicon(tfa_model, lexicon)
apply_compartment_data(tfa_model, compartment_data)

tfa_model.name = 'Lumped Model'

path_to_params = 'tests/redgem_params.yml'

redgem = RedGEM(tfa_model, path_to_params, False)
redgem.run()

## Instruction:
Remove unused parameters in test script
## Code After:
from pytfa.redgem.redgem import RedGEM

from pytfa.io import import_matlab_model
from pytfa.io.base import load_thermoDB
from pytfa.thermo.tmodel import ThermoModel
from pytfa.io import  read_compartment_data, apply_compartment_data, read_lexicon, annotate_from_lexicon


path_to_model = 'models/small_ecoli.mat'
thermoDB = "data/thermo_data.thermodb"
path_to_lexicon = 'models/iJO1366/lexicon.csv'
path_to_compartment_data = 'models/iJO1366/compartment_data.json'

model = import_matlab_model(path_to_model)
thermo_data = load_thermoDB(thermoDB)
lexicon = read_lexicon(path_to_lexicon)
compartment_data = read_compartment_data(path_to_compartment_data)

tfa_model = ThermoModel(thermo_data, model)
annotate_from_lexicon(tfa_model, lexicon)
apply_compartment_data(tfa_model, compartment_data)

tfa_model.name = 'Lumped Model'

path_to_params = 'tests/redgem_params.yml'

redgem = RedGEM(tfa_model, path_to_params, False)
redgem.run()
