<jupyter_start><jupyter_text>Equilibrium urea denaturation curveCD spectra were recorded at 222 nm (minima for PpiA and PpiB) from 0 to 8M Urea<jupyter_code>%matplotlib inline
from symfit import parameters, Variable, Fit, exp
import matplotlib.pyplot as plt
import numpy as np

curve = np.genfromtxt('CD_PpiB_urea_curve.txt').T
curve.shape
#plot raw data
xdata = curve[0]
Fdata = curve[1]

plt.xlabel('Urea')
plt.ylabel('Folded fraction')
plt.scatter(xdata,Fdata)
# model formula for fitting with 2 parameters and one variable
# equation from pyfolding: https://github.com/quantumjot/PyFolding
# https://github.com/quantumjot/PyFolding/blob/3e343644f70d6cfe5e552e7c8ec5da76acb1d8c5/pyfolding/models.py#L78
m, d50 = parameters('m d50')
x = Variable('x')
RT=8.345*(273.15+25)
model = exp((m*(x-d50))/RT) / (1+exp((m*(x-d50))/RT))

model
#fitting
fit = Fit(model, xdata, Fdata)
fit_result = fit.execute()
#Printing the parameters from the fit with d50 the urea concentration for F=0.5 and m-value describing the slope
print(fit_result)
# Plotting the fit on a figure with good resolution (with x 100 steps between 0-8M Urea) and for Y the fit parameters
xmodel = np.linspace(0,8,num=100,endpoint=True)
ymodel = model(xmodel,**fit_result.params)
plt.plot(xmodel,ymodel)
plt.scatter(xdata, Fdata, color='k')
np.savetxt('CD_PpiB urea curve_fit2', ymodel)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11901306240928883, 'fraction_numerical': 0.04862119013062409, 'mean_word_length': 6.1450777202072535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '511982', 'license': 'MIT', 'n_tokens_mistral': 568, 'n_tokens_neox': 511, 'n_words': 136, 'path': 'Circular_Dichroism/CD_Urea_denaturation_PpiB.ipynb', 'repo_name': 'DriesSmets/Non-folding-for-translocation', 'size': '1378'}