PyHillFit - python code to perform Bayesian inference of Hill curve parameters from dose-response data
Code to load dose-response data and fit dose Hill response curves in a Bayesian inference framework.
This code is associated with the paper "Hierarchical Bayesian inference for ion channel screening dose-response data". Wellcome Open Research 1:6. doi:10.12688/wellcomeopenres.9945.2.
N.B. The response should be the percentage inhibition.
The following python packages are pre-requisites for running PyHillFit:
On most linux distributions you can install these via pip, which itself can be installed, if it isn't already present, following the instructions on the pip homepage.
Then all the above dependencies can be installed in one go with:
sudo pip install numpy cma matplotlib scipy pandas seaborn
We have made a .csv file of the Crumb et al. dataset, which is available in the data folder, together with some example python scripts for reading it. You can fit your own data by putting them into a similar format to this .csv file. Note that doses/concentrations should be given in microMolar.
The noise model is chosen by the --capped-data command line flag, and applies to both the single-level and hierarchical MCMC (and to the Bayes factor scripts python/PyHillTemp.py / python/compute_bayes_factors.py).
Default (no --capped-data): uncapped, iid Gaussian noise.
Every response contributes a Normal density centred on the dose-response curve.
Responses may lie outside [0,100] (e.g. small negative % inhibition from noise), so data/crumb_data.csv can be used as it is (but probably shouldn't be - see below).
With --capped-data: censored Gaussian noise.
Use this when the data have been capped to [0,100], so that values recorded as exactly 0 or 100 may really have been below 0 or above 100:
- a response of exactly 0 is treated as "the noisy response was <= 0" and contributes P(y <= 0);
- a response of exactly 100 is treated as "the noisy response was >= 100" and contributes P(y >= 100);
- any response strictly between 0 and 100 contributes the usual Gaussian density.
With --capped-data, any response outside [0,100] is an error and the script stops, listing the offending rows.
For real fits to the Crumb data, use data/modified_crumb_data.csv with --capped-data. It is identical to data/crumb_data.csv except that the one negative response in the original data (Amitriptyline, Kv4.3, experiment 4, 0.036 uM: -2.6%) has been capped to 0. However there are a suspiciously large number of zeros in the data (and lack of negative numbers other than this single entry) so most of it probably was capped before we received it, and the capped likelihood with the modified file is therefore highly likely to be more appropriate than the uncapped Gaussian likelihood.
To run the python-based dose-response fitting code, see the README in the python folder.
To run the Uncertainty Propagation example based on PyHillFit output, see the README in the chaste folder.
