<jupyter_start><jupyter_text>Michaelis menten analysis<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np<jupyter_output><empty_output><jupyter_text>Load our data<jupyter_code>data = pd.read_csv("data.csv")
data<jupyter_output><empty_output><jupyter_text>Plot the data<jupyter_code>v = data["rate"]
s = data["substrate"]
plt.plot(s, v, '.')
plt.xlabel("substrate")
plt.ylabel("rate")<jupyter_output><empty_output><jupyter_text>Fitting the dataThis is the model we're fitting:$$v = \frac{V_{max} \cdot [S]}{[S] + K_{M}}  $$<jupyter_code>import scipy.optimize
def func(s, Vmax, Km):
    return (Vmax * s) / (s + Km)
def fitter(Vmax, Km):
    fitparams, fiterr = scipy.optimize.curve_fit(func, s, v, p0=[Vmax, Km])

    xmodel = np.linspace(0, .1, 1000)
    ymodel = func(xmodel, *fitparams)


    plt.plot(s, v, '.')
    plt.plot(xmodel, ymodel, 'r')
    plt.xlabel("substrate")
    plt.ylabel("rate")
    plt.show()
    return fitparams<jupyter_output><empty_output><jupyter_text>Fitting widget to make life easy<jupyter_code>import ipywidgets
widget = ipywidgets.interactive(fitter, Vmax=(-10,10), Km=(-10,10))
widget<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1559633027522936, 'fraction_numerical': 0.012510425354462052, 'mean_word_length': 6.017543859649122, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '511612', 'license': 'MIT', 'n_tokens_mistral': 504, 'n_tokens_neox': 487, 'n_words': 89, 'path': 'our-analysis-yo.ipynb', 'repo_name': 'Zsailer/bioinformatics-demo', 'size': '1199'}