# Displaying details of the included models & equations

---

[Author] ERGM

---

A number of functions can be used to display the equations for the various models already encoded in Pyfolding.

1. We can list all of the models available by calling the ```list_models``` function.

2. If we want to know any further information, we can print individual equations as each function has a pre-formatted $\LaTeX$ equation. This can be displayed using the ```print_equation()``` function. 

3. If we would like to get further details, for example the arguments of the equation, we can get those easily by request the fit function arguments using the ```fit_func_args``` function.
---

#### First off lets load pyfolding into this ipython notebook:


```python
# The following two command lines are always required for the correct running of PyFolding

# this command causes figures to be plotted inline with the text
%matplotlib inline

# this command imports all pyfolding models and pyfolding ising models
import pyfolding
from pyfolding import *

```


    <IPython.core.display.Javascript object>


    PyFolding: Jupyter autoscrolling has been disabled


---
#### Now lets list all the models available in pyfolding {does not list the Ising model}




```python
# Command imports pyfolding models
from pyfolding.models import *

# command lists models
list_models()

# After the model name:
#'Verified: True' signifies that we have tested the model and it functions as expected.
#'Verified:False' signifies that the model has not been tested.
```




    [('ChevronPolynomialFit', 'Verified: True'),
     ('HeteropolymerIsingEquilibrium', 'Verified: False'),
     ('HomozipperIsingEquilibrium', 'Verified: True'),
     ('ParallelTwoStateChevron', 'Verified: False'),
     ('ParallelTwoStateUnfoldingChevron', 'Verified: False'),
     ('TemplateModel', 'Verified: False'),
     ('ThreeStateChevron', 'Verified: True'),
     ('ThreeStateDimericIEquilibrium', 'Verified: True'),
     ('ThreeStateEquilibrium', 'Verified: True'),
     ('ThreeStateFastPhaseChevron', 'Verified: True'),
     ('ThreeStateMonoIEquilibrium', 'Verified: True'),
     ('ThreeStateSequentialChevron', 'Verified: True'),
     ('TwoStateChevron', 'Verified: True'),
     ('TwoStateChevronMovingTransition', 'Verified: True'),
     ('TwoStateDimerEquilibrium', 'Verified: True'),
     ('TwoStateEquilibrium', 'Verified: True'),
     ('TwoStateEquilibriumSloping', 'Verified: True')]



---
#### Print individual equations

If we want to know any further information, we can print each equation using the *Print_equation*: 


```python
# The function has two parts:
# part1 states the model you want to print: "******()"
# part2 prints equation: ".print_equation()"
# as an example I have printed a two-state kinetic folding model:
# print the info
models.TwoStateEquilibrium().info()

```


$$F = \frac{\exp( m(x-d_{50})) / RT} { 1+\exp(m(x-d_{50}))/RT}$$


     Two state equilibrium denaturation curve - No sloping baseline.
    
    	Folding Scheme:
    		N <-> D
    
    	Params:
    		F = Fraction unfolded
    		m = m-value
    		x = denaturant concentration (M)
    		d50 = denaturant midpoint (M)
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Reference:
    		Clarke and Fersht. Engineered disulfide bonds as probes of
    		the folding pathway of barnase: Increasing the stability
    		of proteins against the rate of denaturation.
    		Biochemistry (1993) vol. 32 (16) pp. 4322-4329
    	



```python
# To print all equations at once
# create a list

folding_models = [TwoStateEquilibrium,
                  TwoStateDimerEquilibrium,
                  ThreeStateEquilibrium,
                  ThreeStateMonoIEquilibrium,
                  ThreeStateDimericIEquilibrium,
                  HomozipperIsingEquilibrium,
                  HeteropolymerIsingEquilibrium]

#feed the list into print_equation()

for model in folding_models: 
    model().info()

```


$$F = \frac{\exp( m(x-d_{50})) / RT} { 1+\exp(m(x-d_{50}))/RT}$$


     Two state equilibrium denaturation curve - No sloping baseline.
    
    	Folding Scheme:
    		N <-> D
    
    	Params:
    		F = Fraction unfolded
    		m = m-value
    		x = denaturant concentration (M)
    		d50 = denaturant midpoint (M)
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Reference:
    		Clarke and Fersht. Engineered disulfide bonds as probes of
    		the folding pathway of barnase: Increasing the stability
    		of proteins against the rate of denaturation.
    		Biochemistry (1993) vol. 32 (16) pp. 4322-4329
    	



$$\begin{equation} \
				\begin{aligned} \
				& \Upsilon_{obs} = \Upsilon_N \cdot (1-F_D)  + \Upsilon_D \cdot F_D \\ \
				\text{where} \\ \
				& \Upsilon_N = \alpha_N+\beta_N x \\ \
				& \Upsilon_D = \alpha_D+\beta_D x \\ \
				& F_D = \frac{\sqrt{((K_U^2 + (8 K_U Pt)) - K_U}}  {4 Pt} \\ \
				& K_U = \exp \frac{(RT \ln(Pt - m(d_{50} - x))} {RT}\
				\end{aligned}\
				\end{equation}$$


     Two State model for a dimer denaturation Equilibrium - No Intermediate.
    
    	Folding Scheme:
    		N2 <-> 2D
    
    	Params:
    		Y_obs = spectroscopic signal at a given concentration of urea
    		Y_N = spectroscopic signal for native monomeric subunits at a concentration of Pt
    		Y_D = spectroscopic signal for denatured monomeric subunits at a concentration of Pt
    		alpha_N = intercept of the native baseline at low denaturation concentrations
    		beta_N = slope/gradient of the native baseline at low denaturation concentrations
    		alpha_D = intercept of the denatured baseline at high denaturation concentrations
    		beta_D = slope/gradient of the denatured baseline at high denaturation concentrations
    		F_D = fraction of unfolded monomers
    		K_U = Equilibrium Constant for Unfolding of dimer.
    		Pt = total protein concentration. This variable needs to be set per denaturation curve.
    		m = m-value
    		x = denaturant concentration (M)
    		d50 = denaturant midpoint (M)
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Reference:
    		Mallam and Jackson. Folding studies on a knotted protein.
    		Journal of Molecular Biology (2005) vol. 346 (5) pp. 1409-1421
    	



$$\begin{equation} \
				\begin{aligned} \
				& \Upsilon_{obs} = \Upsilon_N F_N + \Upsilon_I F_I + \Upsilon_D F_D \ \\ \
				\text{where:}  \\ \
				& F_N = \frac{1} {1 + K_{NI} + K_{NI} K_{ID}}\\ \
				& F_I = \frac{K_{NI}} {1 + K_{NI} + K_{NI} K_{ID}}\\ \
				& F_D = \frac{K_{NI} K_{ID}} {1 + K_{NI} + K_{NI} K_{ID}}\\ \
				\text{and:}  \\ \
				& K_{NI} = \exp \frac{\Delta G_{NI}^{H_2O} + m_{NI} x} {RT}\\ \
				& K_{ID} = \exp \frac{\Delta G_{ID}^{H_2O} + m_{ID} x} {RT}\\ \
				\\ \
				\text{thus:} \\ \
				& \Upsilon_{obs} = \frac{ \Upsilon_N + \Upsilon_I \exp \frac {\Delta G_{NI}^{H_2O} + m_{NI} x} {RT} + \
				\Upsilon_D \exp \frac{\Delta G_{NI}^{H_2O} + m_{NI} x} {RT} \cdot \exp \frac{\Delta G_{ID}^{H_2O} + m_{ID} x} {RT}} {1 + \exp \
				\frac{\Delta G_{NI}^{H_2O} + m_{NI} x} {RT} + \exp \frac{\Delta G_{NI}^{H_2O} + m_{NI} x} {RT} \cdot  \
 			    \exp \frac{\Delta G_{ID}^{H_2O} + m_{ID} x} {RT}}\
				\end{aligned}\
				\end{equation}$$


     Three state equilbrium denaturation curve.
    
    	Folding Scheme:
    		N <-> I <-> D
    
    	Params:
    		Y_obs = The spectroscopic signal maximum as a function of denaturant concentration
    		Y_N = spectroscopic signals of the  native state
    		Y_D = spectroscopic signals of the denatured state
    		F_D = fraction denatured
    		F_N = fraction native
    		F_I = fraction intermediate
    		Kni = equilibrium contstant of unfolding native to intermediate state
    		Kid = equilibrium contstant of unfolding intermediate to denatured state
    		DGni = stability of native state relative to intermediate state
    		m_ni = m-value of native to intermediate transition
    		DGid = stability of intermediate state relative to denatured state
    		m_id = m-value of intermediate to denatured transition
    		x = denaturant concentration (M)
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Reference:
    		Hecky J, Muller K.M. Structural Perturbation and Compensation by Directed
    		Evolution at Physiological Temperature Leads to Thermostabilization of
    		beta-Lactamase. (2005) Biochemistry 44. pp. 12640-12654
    	



$$\begin{equation} \
				\begin{aligned} \
				& \Upsilon_{rel} = \Upsilon_N F_N + \Upsilon_I F_I + \Upsilon_D F_D \\ \
				\text{expanded:} \\ \
				& \Upsilon_{rel} = \Upsilon_N \cdot \frac{2PtF_I^2} {K_1} + \Upsilon_I F_I + \Upsilon_D * K_2F_I \\ \
				\\ \
				\text{where:} \\ \
				& F_I = \frac {- K_1 (1+K_2) + \sqrt{(K_1^2 (1+K_2)^2 + (8 Pt K_1))}} {4Pt} \\ \
				& K_1 = \exp \frac{-\Delta G_{H_20}^1 + m_1 x} {RT} \\ \
				& K_2 = \exp \frac{-\Delta G_{H_20}^2 + m_2 x} {RT}\
				\end{aligned}\
				\end{equation}$$


     Three State model for a dimer denaturation Equilibrium - Monomeric intermediate.
    
    	Folding Scheme:
    		N2 <-> 2I <-> 2D
    
    	Params:
    		Y_rel = spectroscopic signal at a given concentration of urea
    		Y_N = spectroscopic signal for native state
    		Y_D = spectroscopic signal for denatured state
    		Y_I = spectroscopic signal for intermediate state
    		F_D = fraction denatured monomers
    		F_N = fraction native dimers
    		F_I = fraction intermediate dimers
    		Pt = total protein concentration. This variable needs to be set per denaturation curve.
    		K1 = equilibrium constant of unfolding for native to intermediate state
    		K2 = equilibrium constant of unfolding for intermediate to denatured state
    		DG1 = stability of native state relative to intermediate state
    		m1 = m-value of native to intermediate transition
    		DG2 = stability of intermediate state relative to denatured state
    		m2 = m-value of intermediate to denatured transition
    		x = denaturant concentration (M)
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Reference:
    		Mallam and Jackson. Folding studies on a knotted protein.
    		Journal of Molecular Biology (2005) vol. 346 (5) pp. 1409-1421
    	



$$\begin{equation} \
				\begin{aligned} \
				& \Upsilon_{rel} = \Upsilon_N F_N + \Upsilon_I F_I + \Upsilon_D F_D \\ \
				\text{expanded:} \\ \
				& \Upsilon_{rel} = \Upsilon_N \cdot \frac{2PtF_D^2} {K_1 K_2} + \Upsilon_I \frac{2PtF_D^2} {K_2} + \Upsilon_D * (F_D) \\ \
				\\ \
				\text{where:} \\ \
				& F_D = \frac {- K_1 K_2 + \sqrt{((K_1 K_2)^2 + 8(1+K_1)(K_1 K_2)Pt)}} {4Pt (1 + K_1)} \\ \
				& K_1 = \exp \frac{-\Delta G_{H_20}^1 + m_1 x} {RT} \\ \
				& K_2 = \exp \frac{-\Delta G_{H_20}^2 + m_2 x} {RT}\
				\end{aligned}\
				\end{equation}$$


     Three State model for a dimer denaturation Equilibrium - Dimeric Intermediate.
    
    	Folding Scheme:
    		N2 <-> I2 <-> 2D
    
    	Params:
    		Y_rel = spectroscopic signal at a given concentration of urea
    		Y_N = spectroscopic signal for native state
    		Y_D = spectroscopic signal for denatured state
    		Y_I = spectroscopic signal for intermediate state
    		F_D = fraction denatured monomers
    		F_N = fraction native dimers
    		F_I = fraction intermediate dimers
    		Pt = total protein concentration. This variable needs to be set per denaturation curve.
    		K1 = equilibrium contstant of unfolding native to intermediate state
    		K2 = equilibrium contstant of unfolding intermediate to denatured state
    		DG1 = stability of native state relative to intermediate state
    		m1 = m-value of native to intermediate transition
    		DG2 = stability of intermediate state relative to denatured state
    		m2 = m-value of intermediate to denatured transition
    		x = denaturant concentration (M)
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Reference:
    		Mallam and Jackson. Folding studies on a knotted protein.
    		Journal of Molecular Biology (2005) vol. 346 (5) pp. 1409-1421
    	



$$\text{the partition function } (q) \text{ and thus fraction of folded protein } (f) \text{ of n arrayed repeats are given by:}\\ \
				\begin{equation} \\ \
				\begin{aligned} \
				& q = 1 + \frac{\kappa([\kappa \tau]^{n+1} - [n+1]\kappa \tau - n)} {(\kappa \tau + 1)^2}  \\ \
				\\ \
				& f = \frac{1} {n} \sum^{n}_{i=0}i\frac{(n-i+1)\kappa^i\tau^{i-1}} {q} \\ \
				\\ \
				\text{where:} \\ \
				& \kappa (x) = \exp\frac{-G_i} {RT} = \exp\frac{-G_{i,H_20} + m_i x} {RT}  \\ \
				\\ \
				& \tau (x) = \exp\frac{-G_{i,i+1}} {RT} \
				\end{aligned}\
				\end{equation}$$


     Homopolymer Zipper Ising model
    
    	Params:
    		q = partition function
    		f = fraction of folded protein
    		Kappa = equilibrium constant of folding for a given repeating unit
    		Tau = equilibrium constant of association between 2 repeating units
    		n = number of repeating units
    		x = denaturant concentration (M)
    		Gi = intrinsic stability (folding energy) of a repeating unit i
    		mi = denaturant sensitivity of the intrinsic stability of a repeating unit i
    		Gi,i+1 = interface interaction energy between 2 repeating units
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Reference:
    		Aksel and Barrick. Analysis of repeat-protein folding using
    		nearest-neighbor statistical mechanical models.
    		Methods in enzymology (2009) vol. 455 pp. 95-125
    	



$$\text{the partition function } (q) \text{ and thus fraction of folded protein } (f) \text{ of n arrayed repeats are given by:}  \\ \
			\begin{equation} \\ \
			\begin{aligned} \\ \
			\kappa(x) &= \exp(-(\Delta G_{intrinsic} - m_{intrinsic}x) / RT) \\ \
			\tau(x) &= \exp(-\Delta G_{interface}) / RT) \\ \
			q(i) &=  \
			\begin{bmatrix} 0 & 1\end{bmatrix}  \
			\begin{bmatrix} \kappa_1\tau_{-1} & 1\\ \kappa & 1 \end{bmatrix} \
			\ldots  \
			\begin{bmatrix} \kappa_n\tau_{n-1} & 1\\ \kappa & 1 \end{bmatrix} \
			\begin{bmatrix} 1 \\ 1 \end{bmatrix} \\ \
			\theta &=  \frac{1}{nq(n)} \sum_{i=0}^{n}{q(i)} \
			\end{aligned} \
			\end{equation}$$


     Heteropolymer Ising model
    
    	Params:
    		q = partition function
    		f = fraction of folded protein
    		Kappa = equilibrium constant of folding for a given repeating unit
    		Tau = equilibrium constant of association between 2 repeating units
    		n = number of repeating units
    		x = denaturant concentration (M)
    		DG_intrinsic = intrinsic stability (folding energy) of a repeating unit i
    		m_intrinsic = denaturant sensitivity of the intrinsic stability of a repeating unit i
    		DG_interface = interface interaction energy between 2 repeating units
    		R = Universal Gas Constant (kcal.mol-1.K-1)
    		T = Temperature (Kelvin)
    
    	Notes:
    		Aksel and Barrick. Analysis of repeat-protein folding using
    		nearest-neighbor statistical mechanical models.
    		Methods in enzymology (2009) vol. 455 pp. 95-125
    	


---
#### Variables in a given Equation
If we would like to get further details, for example the variables of an equation, we can get those easily by request the fit function arguments:


```python
# The function has two parts:
# part1 states the model you want to find about: "******()"
# part2 prints the variables: ".fit_func_args"
# as an example I have used the two-state kinetic folding model:

TwoStateChevron().fit_func_args
```




    ['kf', 'mf', 'ku', 'mu']



---

### End of this Notebook.

---
