Executed: Mon Mar 27 11:37:02 2017
Duration: 3 seconds.
This notebook estracts the leakage coefficient from the set of 5 us-ALEX smFRET measurements.
For each measurement, we fit the donor-only peak position of the uncorrected proximity ratio histogram. These values are saved in a .txt
file. This notebook just performs a weighted mean where the weights are the number of bursts in each measurement.
This notebook read data from the file:
In [1]:
#bsearch_ph_sel = 'all-ph'
#bsearch_ph_sel = 'Dex'
bsearch_ph_sel = 'DexDem'
data_file = 'results/usALEX-5samples-PR-raw-%s.csv' % bsearch_ph_sel
To recompute the PR data used by this notebook run the 8-spots paper analysis notebook.
In [2]:
from __future__ import division
import numpy as np
import pandas as pd
from IPython.display import display
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
%config InlineBackend.figure_format='retina' # for hi-dpi displays
sns.set_style('whitegrid')
palette = ('Paired', 10)
sns.palplot(sns.color_palette(*palette))
sns.set_palette(*palette)
In [3]:
data = pd.read_csv(data_file).set_index('sample')
data
Out[3]:
In [4]:
display(data[['E_pr_do_gauss', 'E_pr_do_kde', 'E_pr_do_hsm', 'n_bursts_do']])
print('KDE Mean (%): ', data.E_pr_do_kde.mean()*100)
print('KDE Std. Dev. (%):', data.E_pr_do_kde.std()*100)
In [5]:
d = data[['E_pr_do_gauss', 'E_pr_do_kde', 'E_pr_do_hsm']]#, 'n_bursts_do']]
d.plot(lw=3);
In [6]:
E_table = data[['E_pr_do_gauss', 'E_pr_do_kde']]
E_table
Out[6]:
In [7]:
lk_table = E_table / (1 - E_table)
lk_table.columns = [c.replace('E_pr_do', 'lk') for c in E_table.columns]
lk_table['num_bursts'] = data['n_bursts_do']
lk_table
Out[7]:
In [8]:
data.E_pr_do_kde
Out[8]:
In [9]:
lk_table.lk_kde
Out[9]:
In [10]:
E_m = np.average(data.E_pr_do_kde, weights=data.n_bursts_do)
E_m
Out[10]:
In [11]:
k_E_m = E_m / (1 - E_m)
k_E_m
Out[11]:
In [12]:
k_m = np.average(lk_table.lk_kde, weights=data.n_bursts_do)
k_m
Out[12]:
In [13]:
stats = pd.concat([lk_table.mean(), lk_table.std()], axis=1, keys=['mean', 'std']).T
stats
Out[13]:
In [14]:
table_to_save = lk_table.append(stats)
table_to_save = table_to_save.round({'lk_gauss': 5, 'lk_kde': 5, 'num_bursts': 2})
table_to_save
Out[14]:
In [15]:
table_to_save.to_csv('results/table_usalex_5samples_leakage_coeff.csv')
In [16]:
'%.5f' % k_m
Out[16]:
In [17]:
with open('results/usALEX - leakage coefficient %s.csv' % bsearch_ph_sel, 'w') as f:
f.write('%.5f' % k_m)