EPFL-LCSB / etfl

ETFL: A formulation for flux balance models accounting for expression, thermodynamics, and resource allocation constraints
Apache License 2.0
16 stars 17 forks source link

Error in tutorial_iJO1366.py #12

Open bigsuicideparty opened 2 years ago

bigsuicideparty commented 2 years ago

Having problems to resolve the following error in the tutorial code:

rib = Ribosome(id='rib', 
               name='Ribosome', 
               kribo=12 * 3600, 
               kdeg=0.001,
               )

Output:

TypeError                                 Traceback (most recent call last)
/Users/bsp/unix/etfl/tutorials/tutorial_iJO1366.ipynb Cell 17' in <cell line: 38>()
     33 rpeptide_genes = pd.read_csv(pjoin(data_dir,'ribosomal_proteins_ecoli.tsv'),
     34                              delimiter='\t',
     35                              header=None)[0]
     36 rpeptide_genes = rpeptide_genes.str.split(':').apply(lambda x:x[1])
---> 38 rib = Ribosome(id='rib', 
     39                name='Ribosome', 
     40               
     41                kribo=12 * 3600, 
     42                kdeg=0.001,
     43                )
     45 rnap = RNAPolymerase(id='rnap',
     46                      name='RNA Polymerase',
     47                      ktrans = 1000*3600,
     48                      composition=composition,
     49                      kdeg = 0.2
     50                      )

File ~/unix/etfl/etfl/core/enzyme.py:123, in Ribosome.__init__(self, id, kribo, kdeg, composition, rrna, *args, **kwargs)
    121 def __init__(self, id=None, kribo=None, kdeg=None, composition=None, rrna=None,
    122              *args, **kwargs):
--> 123     Enzyme.__init__(self, id = id, kdeg=kdeg, kcat = kribo, composition=composition,
    124                     *args, **kwargs)
    126     self.rrna_composition = {k: 1 for k in rrna}

File ~/unix/etfl/etfl/core/enzyme.py:41, in Enzyme.__init__(self, id, kcat, kcat_fwd, kcat_bwd, kdeg, composition, *args, **kwargs)
     39     self.composition = {k:1 for k in composition}
     40 else:
---> 41     raise TypeError('Composition should be of type dict() or iterable')
     43 self.complexation = None

TypeError: Composition should be of type dict() or iterable
bigsuicideparty commented 2 years ago

Related to this. A number of your scripts refer to .json files in the /model directory that don't exist (e.g. ecoli = load_json_model('models/RelaxedModel iJO1366_T1E1N1_350_enz_256_bins__20180830_121200.json') in iJO1366_plot_growth_regions.py). Is that intended?