This notebook converts the us-ALEX
.sm
data file into Photon-HDF5 file format.
In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
In [2]:
import phconvert as phc
phc.__version__
Out[2]:
Paste here the folder containing the .sm
files to convert:
In [3]:
data_dir = '../realtime kinetics/data/singlespot'
In [4]:
path = Path(data_dir)
filenames = list(str(f) for f in path.glob('**/*.sm'))
basenames = list(f.stem for f in path.glob('**/*.sm'))
basenames
Out[4]:
This is the list of the files that will be converted:
In [5]:
filenames
Out[5]:
In [6]:
author = 'Eitan Lerner'
author_affiliation = 'UCLA'
creator = 'Antonino Ingargiola'
creator_affiliation = 'UCLA'
In [7]:
buffer_name = ('Transcription buffer: 40 mM HEPES KOH, 50 mM KCl, 10 mM MgCl2, '
'1 mM DTT, 1 mM cysteamine, 0.01% Tween 20, '
'1 mM 5minute UV-illuminated Trolox, 100 ug/mL BSA, pH 7.')
In [8]:
descriptions = [
'Realtime kinetics from ITC2 to runoff. T=37C',
'Realtime kinetics from ITC2 to runoff. T=37C',
'Realtime kinetics from ITC2 to runoff. T=37C',
'Realtime kinetics from ITC7 to runoff. T=37C',
'Realtime kinetics from RDE11 to runoff. T=37C',
'Realtime kinetics from ITC4 to runoff. T=37C',
'Realtime kinetics from ITC2 to ITC7. T=37C',
'Realtime kinetics from ITC2 to ITC4. T=37C',
"Realtime kinetics of 20dT DNA + 20dA DNA hybridization. T=37C",
"Realtime kinetics of 20dT DNA + 20dA RNA hybridization. T=37C",
]
In [9]:
sample_names = [
'RPO + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
'RPO + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
'RPO + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
'ITC7 + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
'RDE11 + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
'ITC4 + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
'ITC2 + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
'ITC2 + lacCONS promoter labeled at NT(-8)ATTO647N - T(-5)ATTO550',
"20dT DNA (5'TMR - 3' Alexa647) + 20dA DNA",
"20dT DNA (5'TMR - 3' Alexa647) + 20dA RNA",
]
In [10]:
idx = 0
filename = filenames[idx]
sample_name = sample_names[idx]
description = descriptions[idx]
dye_names = 'ATTO550, ATTO647N' if 'lacCONS' in sample_name else 'TMR, Alex647'
In [11]:
sample_name
Out[11]:
In [12]:
description
Out[12]:
In [13]:
dye_names
Out[13]:
In [14]:
d = phc.loader.usalex_sm(filename,
donor = 0,
acceptor = 1,
alex_period = 4000,
alex_offset = 700,
alex_period_donor = (2150, 3900),
alex_period_acceptor = (200, 1900),
excitation_wavelengths = (532e-9, 635e-9),
detection_wavelengths = (580e-9, 680e-9))
In [15]:
ph_data = d['photon_data']
det = ph_data['detectors']
timestamps = ph_data['timestamps']
In [16]:
np.unique(det)
Out[16]:
In [17]:
phc.plotter.alternation_hist(d)
In [18]:
d['description'] = description
d['sample'] = dict(
sample_name=sample_name,
dye_names=dye_names,
buffer_name=buffer_name,
num_dyes = len(dye_names.split(',')))
d['identity'] = dict(
author=author,
author_affiliation=author_affiliation,
creator=creator,
creator_affiliation=creator_affiliation)
In [19]:
#phc.hdf5.save_photon_hdf5(d)
In [20]:
for idx, filename in enumerate(filenames):
sample_name = sample_names[idx]
description = descriptions[idx]
dye_names = 'ATTO550, ATTO647N' if 'lacCONS' in sample_name else 'TMR, Alex647'
print(filename)
print(sample_name)
print(description)
print(dye_names + '\n')
d = phc.loader.usalex_sm(filename,
donor = 0,
acceptor = 1,
alex_period = 4000,
alex_offset = 700,
alex_period_donor = (2150, 3900),
alex_period_acceptor = (200, 1900),
excitation_wavelengths = (532e-9, 635e-9),
detection_wavelengths = (580e-9, 680e-9))
d['description'] = description
d['sample'] = dict(
sample_name=sample_name,
dye_names=dye_names,
buffer_name=buffer_name,
num_dyes = len(dye_names.split(',')))
d['identity'] = dict(
author=author,
author_affiliation=author_affiliation,
creator=creator,
creator_affiliation=creator_affiliation)
phc.hdf5.save_photon_hdf5(d, overwrite=True)
In [21]:
from fretbursts import *
In [22]:
from IPython.display import display
In [23]:
for fname in filenames:
fname = fname[:-2] + 'hdf5'
print(fname)
d = loader.photon_hdf5(fname)
loader.alex_apply_period(d)
d.calc_bg(fun=bg.exp_fit)
d.burst_search()
ds = d.select_bursts(select_bursts.size, th1=20)
alex_jointplot(ds)
fig = plt.gcf()
plt.close(fig)
display(fig)
In [ ]:
In [ ]: