Exemplo n.º 1
0
 def test_scn_write():
     intervals = np.hstack((np.arange(1,501),np.arange(1,501)))
     amplitudes = np.ones(1000)*-1
     amplitudes[::2] = 0
     amplitudes = amplitudes.astype('int')
     flags = np.zeros(1000)
     flags = flags.astype('int')
     dcio.scn_write(intervals, amplitudes, flags, filename='./test.SCN')
     new_patch = Patch('./test.SCN')
     new_patch.read_scn(tres=0, tcrit=500)
     new_patch.write_scn()
     new_patch = Patch('./modified_test.SCN')
     new_patch.read_scn(tres=0, tcrit=np.inf)
     period = new_patch[1].period
     print(sum(intervals[3:-1]-period))
Exemplo n.º 2
0
data = np.loadtxt('./ekdist_paramteters.csv', 
                  delimiter=',', dtype={
                  'names': ('filename', 'concentration', 'res', 'tcrit'),
                  'formats': ('S8', 'S3', 'f4', 'f4')})

concentrations = [1,3,10,100]
for concentration in concentrations:
    for patch in data:
        if float(patch['concentration']) == concentration:
            filename = "./ekdist_traces/{}.scn".format(patch['filename'].decode('utf8'))
#
#            filename = "./raw trace/{}/{}.scn".format(patch['concentration'].decode('utf8'), 
#    patch['filename'].decode('utf8'))
            patch = Patch(filename)
            patch.read_scn(tres=patch['res']*1e-6, tcrit=patch['tcrit']*1e-6)
            cluster_list.extend(patch.get_cluster_list())
            
    
    
    batch_analysis = BatchAnalysis(cluster_list)
    summary = batch_analysis.compute_cluster_summary()
    summary['start'] /= 1000
    summary['end'] /= 1000
    
    np.savetxt('temp.csv', summary, delimiter=',', fmt = '%s,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e')
    col_name = str(summary.dtype.names)
    col_name = col_name[1:-1] + '\n'
    f = open('temp.csv','r')
    string = f.read()
    string = col_name + string
Exemplo n.º 3
0
# -*- coding: utf-8 -*-
"""
Created on Fri May 20 11:26:23 2016

@author: zhiyiwu
"""

from info import Cluster,Patch
from dcpyps import dataset
from PlotAnalysis import PlotSingle
from batch_analysis import BatchAnalysis
import matplotlib.pyplot as plt


patch_F = Patch('/Users/zhiyiwu/Documents/pharmfit/raw trace/1/15071710.SCN')
patch_F.read_scn(tres=30, tcrit=100)
plt.plot(patch_F.mean_open, patch_F.mean_shut,'o', alpha=0.5, label = 'F')

patch_G = Patch('/Users/zhiyiwu/Documents/pharmfit/raw trace/1/15080500.SCN')
patch_G.read_scn(tres=20, tcrit=300)
plt.plot(patch_G.mean_open, patch_G.mean_shut,'o', alpha=0.5, label = 'G')

patch_H = Patch('/Users/zhiyiwu/Documents/pharmfit/raw trace/1/15080705.SCN')
patch_H.read_scn(tres=20, tcrit=300)
plt.plot(patch_H.mean_open, patch_H.mean_shut,'o', alpha=0.5, label = 'H')

plt.legend()
Exemplo n.º 4
0
'15080408'
]
tres = [
20,
30,
20
]
tcrit = [
100,
70,
100
]
popen =[]
for index, name in enumerate(name_list):
    patch = Patch('/Users/zhiyiwu/Documents/pharmfit/raw trace/3/{}.SCN'.format(name))
    patch.read_scn(tres=tres[index], tcrit=tcrit[index])

maxopen = 1
maxshut = float('inf')
def rule(cluster, maxopen, maxshut): 
    if (cluster.mean_open > maxopen) or (cluster.mean_shut > maxshut): 
        return False
    else:
        return True


for i in range(3):
    patch = Patch('/Users/zhiyiwu/Documents/pharmfit/raw trace/3/{}.SCN'.format(name_list[i]))
    patch.read_scn(tres=tres[i], tcrit=tcrit[i])
    patch.filter_cluster(rule, maxopen, maxshut)
    patch.write_scn()
Exemplo n.º 5
0
def change(name, tres, tcrit, minPopen = 0, maxPopen = 1.1):
    new_patch = Patch('./set/{}.SCN'.format(name))
    new_patch.read_scn(tres=tres, tcrit=tcrit)
    new_patch.filter_cluster(rule, minPopen, maxPopen)
    new_patch.write_scn()