Skip to content

Commit

Permalink
Merge branch 'master' into assemblyautoinhibition-updates2
Browse files Browse the repository at this point in the history
  • Loading branch information
harmsm committed Mar 25, 2019
2 parents 10a5e39 + d029453 commit f07b10f
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 16 deletions.
29 changes: 27 additions & 2 deletions docs/source/api_fits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,34 @@ Workflow
+ Evaluate the `fit statistics <https://pytc.readthedocs.io/en/latest/statistics.html>`_.
+ Export the results, which will save a csv file and pdf files showing the fit and corner plot.


API demos
=========

We have posted a collection of Jupyter notebooks that demonstrate working with
the API: `<https://github.com/harmslab/pytc-demos>`_.
the API: `<https://github.com/harmslab/pytc-demos>`_. The topics covered are
listed below.

Fitter choice
-------------
+ Using maximum likelihood to fit a model. `00_fit-single-site.ipynb <https://github.com/harmslab/pytc-demos/blob/master/00_fit-single-site.ipynb>`_.
+ Using a Bayesian sampler. `01_single-site-Bayesian.ipynb <https://github.com/harmslab/pytc-demos/blob/master/01_single-site-Bayesian.ipynb>`_.
+ Comparision of maximum likelihood, bootstrap, or Bayesian methods. `04_ml-v-bootstrap-v-bayesian.ipynb <https://github.com/harmslab/pytc-demos/blob/master/03_fit-competitor-model.ipynb>`_.

Model choice
------------
+ Fit a single-site model. `00_fit-single-site.ipynb <https://github.com/harmslab/pytc-demos/blob/master/00_fit-single-site.ipynb>`_.
+ Fit a binding polynomial. `02_fit-binding-polynomial.ipynb <https://github.com/harmslab/pytc-demos/blob/master/02_fit-binding-polynomial.ipynb>`_.
+ Fit a competitor binding model. `03_fit-competitor-model.ipynb <https://github.com/harmslab/pytc-demos/blob/master/03_fit-competitor-model.ipynb>`_.

Fitting options
---------------
+ Change fit guesses or fix parameters. `05_change-param-guess-fix.ipynb <https://github.com/harmslab/pytc-demos/blob/master/05_change-param-guess-fix.ipynb>`_.
+ Choose the best model using AIC. `11_use-aic-choose-model.ipynb <https://github.com/harmslab/pytc-demos/blob/master/11_use-aic-choose-model.ipynb>`_.

Global fits
-----------
+ Global fit of a single site model to a blank and experimental titration. `07_simultaneous-fit-blank-experiment.ipynb <https://github.com/harmslab/pytc-demos/blob/master/07_simultaneous-fit-blank-experiment.ipynb>`_.
+ Global fit of a single site model to a blank and three replicate experimental titrations `06_global-fit-three-replicates-and-blank.ipynb <https://github.com/harmslab/pytc-demos/blob/master/06_global-fit-three-replicates-and-blank.ipynb>`_.
+ Global connector: fit the same binding reaction measured in different buffers to extract ionization enthalpy and num protons `08_global-fit-with-NumProtons-connector.ipynb <https://github.com/harmslab/pytc-demos/blob/master/08_global-fit-with-NumProtons-connector.ipynb>`_.
+ Global connector: fit the same binding reaction measured at different temperatures to extract van't Hoff enthalpy `09_global-fit-for-vant-hoff-enthalpy.ipynb <https://github.com/harmslab/pytc-demos/blob/master/09_global-fit-for-vant-hoff-enthalpy.ipynb>`_.
+ Global connector: implement a custom global connector `10_implement-custom-global-connector.ipynb <https://github.com/harmslab/pytc-demos/blob/master/10_implement-custom-global-connector.ipynb>`_.
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pytc
====
Open source python software for extracting thermodynamic information from
Isothermal Titration Calorimetry expriements.
Isothermal Titration Calorimetry experiments.

+ We welcome bug reports, patches, and new thermodynamic models. See the
`contributing <contributing.html>`_ page for how to get involved.
Expand Down
16 changes: 7 additions & 9 deletions docs/source/indiv_models/assembly-auto-inhibition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ Parameters
+================================+========================+============================+===============+
|macroscopic association constant| | | |
|for binding of the first ligand | | | |
|to the protein monomer | | | |
|(M\ :sup:`-1`) | :math:`K_{1}` | :code:`Klig1` | thermodynamic |
|to the protein (M\ :sup:`-1`) | :math:`K_{1}` | :code:`Klig1` | thermodynamic |
+--------------------------------+------------------------+----------------------------+---------------+
|average* association constant | | | |
|for binding of the remaining | | | |
|ligands to the protein monomer | | | |
|(M\ :sup:`-1`) | :math:`K_{2}` | :code:`Klig2` | thermodynamic |
|macroscopic association constant| | | |
|for binding of the second ligand| | | |
|to the protein (M\ :sup:`-1`) | :math:`K_{2}` | :code:`Klig2` | thermodynamic |
+--------------------------------+------------------------+----------------------------+---------------+
|average* association constant | | | |
|for formation of the protein | | | |
|oligomer (M\ :sup:`-1`) | :math:`K_{3}` | :code:`Kolig` | thermodynamic |
|"unit normalized" association | | | |
|constant for formation of the | | | |
|protein oligomer (M\ :sup:`-1`) | :math:`K_{3}` | :code:`Kolig` | thermodynamic |
+--------------------------------+------------------------+----------------------------+---------------+
|enthalpy change for | | | |
|binding of the first ligand to | | | |
Expand Down
14 changes: 12 additions & 2 deletions pytc/experiments/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
Units:
Volumes are in microliters
Temperatures are in Kelvin
Energy is `units`/mol, where `units` is specified when instantiating the
ITCExperiment class.
Concentrations are in molar
Energy is `units`, where `units` is specified when instantiating the
ITCExperiment class. It must be a in the AVAIL_UNITS dictionary.
"""
__author__ = "Michael J. Harms"
__date__ = "2016-06-22"
Expand Down Expand Up @@ -196,6 +197,15 @@ def heats_stdev(self,heats_stdev):

self._heats_stdev[self._shot_start:] = heats_stdev[:]

@property
def mol_injected(self):
"""
Return the mols injected over shots.
"""

# uL * mol/L * L/1e6 uL -> mol
return self._shots[self._shot_start:]*self.titrant_syringe_conc*1e-6

@property
def mole_ratio(self):
"""
Expand Down
17 changes: 15 additions & 2 deletions pytc/global_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ def delete_current_fit(self):
self._prep_fit()

def plot(self,correct_molar_ratio=False,subtract_dilution=False,
color_list=None,data_symbol="o",linewidth=1.5,num_samples=100):
normalize_heat_to_shot=False,color_list=None,
data_symbol="o",linewidth=1.5,num_samples=100):
"""
Plot the experimental data and fit results.
Expand All @@ -486,6 +487,8 @@ def plot(self,correct_molar_ratio=False,subtract_dilution=False,
correct the molar ratio using fx_competent
subtract_dilution : bool
subtract the heat of dilution
normalize_heat_to_shot : bool
divide heats by mols titrant injected
color_list : list of things matplotlib can interpret as colors
color of each series
data_symol : character
Expand Down Expand Up @@ -523,7 +526,13 @@ def plot(self,correct_molar_ratio=False,subtract_dilution=False,

# Add labels to top plot and remove x-axis
u = self._expt_dict[self._expt_list_stable_order[0]].units
ax[0].set_ylabel("heat per shot ({})".format(u))

if normalize_heat_to_shot:
ax[0].set_ylabel("heat per mol titrant ({})".format(u))
else:
new_u = u.split("/")[0]
ax[0].set_ylabel("observed heat ({})".format(new_u))

plt.setp(ax[0].get_xticklabels(), visible=False)

# Add labels to the residuals plot
Expand Down Expand Up @@ -587,6 +596,10 @@ def plot(self,correct_molar_ratio=False,subtract_dilution=False,
heats = heats - e.dilution_heats
calc = calc - e.dilution_heats

if normalize_heat_to_shot:
heats = heats/e.mol_injected
calc = calc/e.mol_injected

# Draw fit lines and residuals
if len(e.dQ) > 0:
ax[0].plot(mr,calc,color=color_list[j],linewidth=linewidth,alpha=alpha)
Expand Down

0 comments on commit f07b10f

Please sign in to comment.