choderalab / assaytools

Modeling and Bayesian analysis of fluorescence and absorbance assays.
http://assaytools.readthedocs.org
GNU Lesser General Public License v2.1
18 stars 11 forks source link

First example using autoprotocol API #41

Closed jchodera closed 8 years ago

jchodera commented 8 years ago

This is just a start at using the autoprotcol-python API.

jchodera commented 8 years ago

Sorry about the delay---things kept getting in the way. Trying to get that done today.

jchodera commented 8 years ago

Remaining work:

jchodera commented 8 years ago

I've just run into a case where the generalized binding model failed to find a solution:

  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/assaytools/bindingmodels.py", line 220, in equilibrium_concentrations
    raise Exception(msg)
Exception: root-finder failed to converge:
    fjac: array([[-0.5773503 ,  0.5773502 ,  0.5773503 ],
       [-0.81649322, -0.41026908, -0.40622421],
       [-0.00233535,  0.70593628, -0.7082715 ]])
     fun: array([ -3.33709096e-08,  -1.69514419e-02,   1.69570284e-02])
 message: 'The iteration is not making good progress, as measured by the \n  improvement from the last ten iterations.'
    nfev: 14
    njev: 3
     qtf: array([  3.24639531e-06,   6.63244112e-05,  -2.39768176e-02])
       r: array([ 1.7320507 , -0.57544033, -0.57926018, -0.81785045, -0.81513605,
       -0.00467059])
  status: 5
 success: False
       x: array([  0.63788514, -10.70939932, -49.13352278])

Will take a look at this in more detail.

jchodera commented 8 years ago

I'll add some more debug output. Those log concentrations ([ 0.63788514, -10.70939932, -49.13352278]) look totally crazy.

sonyahanson commented 8 years ago

I'll add some more debug output. Those log concentrations ([ 0.63788514, -10.70939932, -49.13352278]) look totally crazy.

Hmmm.. Any chance we can punt on this bug and we can help you debug this after this is merged?

sonyahanson commented 8 years ago

Move 'grant.py' tool into directory with the only IPython notebooks that use it.

I had been using this in my first figure draft in the fluorescence-assay-manuscript repo: https://github.com/choderalab/fluorescence-assay-manuscript/blob/master/figures/fig1/fig1.py

I can maybe move these plotting helper functions to either plots.py or the manuscript repo. I have used them to help make plots for e.g. Andrea before, so maybe they can stay here?

jchodera commented 8 years ago

Hmmm.. Any chance we can punt on this bug and we can help you debug this after this is merged?

Already fixed it!

jchodera commented 8 years ago

I can maybe move these plotting helper functions to either plots.py or the manuscript repo. I have used them to help make plots for e.g. Andrea before, so maybe they can stay here?

I've already purged them from this branch. If you need them, can you introduce them into some other file, like plots.py?

jchodera commented 8 years ago

Getting closer! Dealing with some nan issues.

jchodera commented 8 years ago

OK, the single-wavelength non-competition assay essentially works now, though the default number of samples is still way too small (32 seconds for 200 very correlated samples).

If it's OK, we can merge this now and then I can update documentation (the main sphinx docs) and work on a way to get the competition assay to work in a separate PR.

jhprinz commented 8 years ago

Cool, glad to hear this is working!!!!

jchodera commented 8 years ago

It's barely working. Because there are so many stochastics---one for each pipetting operation---it is still quite slow with pymc2. I tried pymc3, but theano can't handle so many compiled operations right now.

Our current thinking is that improving the initial guesses (with a quick fit estimate) and providing good proposal distribution widths for the Metropolis step methods will allow a few minutes of sampling to provide good uncertainty estimates. Alternatively, we are also exploring emcee, which seems to rapidly be able to sample the posterior.

jchodera commented 8 years ago

We may need some help from @maxentile or @pgrinaway to figure out how to analyze the emcee-generated data, but there's a script that runs things through emcee right now.

sonyahanson commented 8 years ago

Thanks! Merging.