df = TS.merge(id_mapper, on=["uniprot"])
#%%
model = cu.model.copy()
revert_to_reversible(model)
def one2one_mapping():
    l = []
    for b in cu.model.genes:
        l+=(list(product([b.id], list(b.reactions))))
    df = pd.DataFrame(l)
    df.columns = ['bnumber', 'reaction']
    df.loc[:, '# genes in reaction'] = [len(r.genes) for r in df['reaction']]
    return df

b2r = one2one_mapping()
df = df.merge(b2r, on="bnumber", how='outer')
df = df.merge(copies_fL, on="bnumber", how='outer')
df['reaction'] = df['reaction'].map(str, )
kmax = cu.kmax
kmax.name='kmax'
kcat = cu.load_kcats_umolmgmin()
kcat.name='kcat'
specific_activity = cu.SA.join(kmax)
specific_activity = specific_activity.join(kcat)
specific_activity = specific_activity[['glucose', 'kmax', 'kcat']].dropna(how='all')
specific_activity.columns = ['kapp_glucose', 'kmax', 'kcat']
specific_activity.loc[:, 'kcat/kmax'] = specific_activity['kcat'] / specific_activity['kmax']
df = df.merge(specific_activity, left_on='reaction', right_index=True, how='outer')

df.to_csv("../cache/thermal_stability_metadata.csv")