<jupyter_start><jupyter_text>Dependencies:<jupyter_code>import os
import torch #pip install torch
import numpy as np #pip install numpy
import pandas as pd 
import pickle
import xgboost as xgb #pip install xgboost
import tensorflow as tf #pip install tensorflow
from tensorflow.keras import layers
from rdkit import Chem #conda install -c rdkit rdkit
from rdkit.Chem import Crippen 
from rdkit.Chem import Descriptors
import shutil
import warnings
import esm #pip install fair-esm
from KM_prediction import *
import os
from os.path import join 
#import torch
CURRENT_DIR = os.getcwd()<jupyter_output><empty_output><jupyter_text>Before using KM prediction, we have to download the ESM-1b model: Example for calculating KM prediction:<jupyter_code>from KM_prediction import *

df = KM_predicton(substrate_list = ["C00053",
                               "C00047",
                               "C00001",
                               "D11111",
                               "D55555",
                               "Clc(c(Cl)c(Cl)c1C(=O)O)c(Cl)c1Cl",
                              "InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3",
                               "bullshit"], 
             enzyme_list = ["MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDIAYLRSLGYNIVATPRGYVLAGG",
                            "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDI",
                           "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDI"*2000,
                            "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDI",
                            "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDI",
                            "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDI",
                            "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDI",
                            "MKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDI"])


from tkinter import *
from pandas import read_pickle
from pandas import to_pickle
import tkinter.font as tkFont
from KM_prediction import *

import time

def evaluate(event):
    df = KM_predicton(substrate_list = [entry2.get()], 
             enzyme_list = [entry1.get()])
    res.configure(text = "KM: " + str(df["KM [mM]"][0]) , font = fontStyle)
    
w = Tk()
fontStyle = tkFont.Font(family="Lucida Grande", size=15)
Label(w, text="Amino acid sequence:", width= 30, height = 4, font=fontStyle).pack()
entry1 = Entry(w, font = fontStyle)
entry1.bind("<Return>", evaluate)
entry1.pack()

fontStyle = tkFont.Font(family="Lucida Grande", size=15)
Label(w, text="InChI string:", width= 30, height = 4, font=fontStyle).pack()
entry2 = Entry(w, font = fontStyle)
entry2.bind("<Return>", evaluate)
entry2.pack()

res = Label(w)
res.pack()
w.mainloop()
datasets_dir = "C:\\Users\\alexk\\projects\\kcat_prediction_V3\\data\\"
df = pd.read_pickle(join(datasets_dir,"brenda_data" , "brenda_df_kcat_curated_brenda.pkl"))
df.loc[df["correct reaction ID"] == 1878]
metabolites_KM = pd.read_pickle(join(datasets_dir,"metabolite_data", "metabolites_KM_with_rep_curated.pkl"))
reaction_df = pd.read_pickle(join(datasets_dir, "reaction_data", "reaction_df_brenda_with_fingerprints_V2.pkl"))
mets = list(reaction_df["substrates_list"].loc[reaction_df["reaction ID"] == 1878])[0]

KM_predicton(substrate_list = ["C00006", "C00001", "C00092"], 
             enzyme_list = [df["Sequence"][0], df["Sequence"][0], df["Sequence"][0]])
metabolites_KM.loc[metabolites_KM["metabolite"].isin(mets)]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11281296023564065, 'fraction_numerical': 0.026804123711340205, 'mean_word_length': 3.342710997442455, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '177207', 'license': 'MIT', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1220, 'n_words': 220, 'path': 'code/.ipynb_checkpoints/GUI KM prediction-checkpoint.ipynb', 'repo_name': 'AlexanderKroll/KM_prediction_function', 'size': '3395'}