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

Added parser function to make quickmodel more modular #82

Closed sonyahanson closed 7 years ago

sonyahanson commented 7 years ago

Added parser function to make quickmodel.py more modular. Currently it's just the parser function, and has yet to be incorporated into quickmodel itself.

sonyahanson commented 7 years ago

Usable with a script like this:

from assaytools import parser
import numpy as np

inputs = {
   'my_file' :  "/Users/hansons/Documents/github/fluorescence-assay-manuscript/data/singlet/DMSO-backfill/p38_singlet1_20160420_153238.xml",
   'section'       :  '280_480_TOP_120',
   'ligand_order'  :  ['Bosutinib','Bosutinib Isomer','Erlotinib','Gefitinib','Bosutinib','Bosutinib Isomer','Erlotinib','Gefitinib'],
   'Lstated'       :  np.array([20.0e-6,14.0e-6,9.82e-6,6.88e-6,4.82e-6,3.38e-6,2.37e-6,1.66e-6,1.16e-6,0.815e-6,0.571e-6,0.4e-6,0.28e-6,0.196e-6,0.138e-6,0.0964e-6,0.0676e-6,0.0474e-6,0.0320e-6,0.0240e-6,0.0160e-6,0.0120e-6,0.008e-6,0.00001e-6], np.float64), # ligand concentration, M
   'protein'       :  'p38',
   'Pstated'       :  0.5e-6 * np.ones([24],np.float64), # protein concentration, M
   'assay_volume'  :  50e-6, # assay volume, L
   'well_area'     :  0.1369, # well area, cm^2 for 4ti-0203 [http://4ti.co.uk/files/3113/4217/2464/4ti-0201.pdf]
   'P_error'       :  0.35, # protein concentration uncertainty
   'L_error'       :  0.08 # ligand concentraiton uncertainty (due to gravimetric preparation and HP D300 dispensing)
   }

[complex_fluorescence, ligand_fluorescence] = parser.get_data_using_inputs(inputs)

# Uncertainties in protein and ligand concentrations.
dPstated = inputs['P_error'] * inputs['Pstated'] # protein concentration uncertainty
dLstated = inputs['L_error'] * inputs['Lstated'] # ligand concentraiton uncertainty (due to gravimetric preparation and HP D300 dispensing)

pymc_model = pymcmodels.make_model(inputs['Pstated'], dPstated, inputs['Lstated'], dLstated,
   top_complex_fluorescence=complex_fluorescence['Bosutinib Isomer-CD'],
   top_ligand_fluorescence=ligand_fluorescence['Bosutinib Isomer-CD'],
   use_primary_inner_filter_correction=True,
   use_secondary_inner_filter_correction=True,
   assay_volume=inputs['assay_volume'], DG_prior='uniform')
gregoryross commented 7 years ago

This looks really good to me. As it's only a single file, please go ahead with the merger @sonyahanson.