-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadEnvisionDirectory2.m
78 lines (55 loc) · 2.58 KB
/
readEnvisionDirectory2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function [ GC_data, all_data, all_times ] = readEnvisionDirectory( dir_name, num_experiments, beta )
% this script goes through all the Envision GC files in a directory and
% reads them in one by one. It uses the parameters in the ParameterFile to
% obtain the number of plates and assign the conditions (e.g. media type,
% dilution factor) to each plate.
% TODO:
% take in another file that contains the strain information for each well
% in the plates
% JW 20130305
try
file_dir=dir([dir_name,'*.csv']); %This makes sure that only CSV files are read
catch
end
% how many plates were there
counts = zeros(num_experiments,1); % this will keep track of how many reads per plate
[ unused, order ] = sort( [ file_dir(:).datenum ] );
sorted_file_dir = file_dir( order ); % the files sorted by date
%filedir
time_point = 0;
%t_vec = zeros(size(sorted_file_dir)/4);
t_vec = [];
%t0 = datevec(sorted_file_dir(1).date);
for f=1:length(sorted_file_dir)
file_name = sorted_file_dir(f).name;
if( regexp( file_name, 'initial' ) )
continue;
end
% first determine which plate this read is from
file_name_array = regexp( file_name, '\_', 'split' );
% parse the plate file name data
% plate_name = strcat( file_name_array(1), file_name_array(2) );
% plate_index = str2num(file_name_array{2});
[temp,plate_name]=regexp(file_name,'plate(\d+)','tokens','match');
plate_index = str2num(temp{1}{1});
% get the plate data
[ plate_data ] = readEnvisionFile( dir_name, file_name );
% increment the number of reads for this plate
counts( plate_index ) = counts( plate_index ) + 1;
if( counts( plate_index ) == 1 )
t0(plate_index,:) = datevec(sorted_file_dir(f).date);
%t0_data(plate_index) = plate_data;
end
% this is currently irrelevant- gets calculated later
t_vec( plate_index, counts(plate_index) ) = etime( datevec(sorted_file_dir(f).date), t0(plate_index,:) ) / 60;
% correct the OD saturation
% plate_data.OD600 = mm_correction( beta, plate_data.OD600 ); % - t0_data(plate_index).OD600;
all_data( plate_index, counts(plate_index), : ) = reshape( plate_data.OD600, 1, 96 );
% populate the struct that will contain all the data
GC_data( plate_index ).time{ counts( plate_index ) } = datenum(sorted_file_dir(f).date);
GC_data( plate_index ).data{ counts( plate_index ) } = plate_data;
GC_data( plate_index ).name = plate_name; %experiments( plate_index );
% GC_data( plate_index ).experiment = experiment;
end
all_times = t_vec;
%plot( [1:1:size(t_vec)],t_vec )