Skip to content

Instantly share code, notes, and snippets.

@weinberz
Last active August 29, 2015 14:26
Show Gist options
  • Save weinberz/486a415450111a186340 to your computer and use it in GitHub Desktop.
Save weinberz/486a415450111a186340 to your computer and use it in GitHub Desktop.
Random graphs
% Load condition data and then run analysis for files in directory.
% Need to change "directory", Channels in loadConditionData and ChannelNames
directory = '/Users/exark/Desktop/Crops';
dirs = dir(directory);
dirs = dirs(4:end);
dirs = dirs([dirs.isdir]);
data = repmat(struct('name',1,'data',1), 8, 1 );
for i=1:length(dirs)
data(i).name = dirs(i).name;
data(i).data = loadConditionData([directory filesep dirs(i).name '/Treatment'], {'Ch1'}, {'alexa568'}, 'Parameters', [1.49 250 16e-6]);
end
for i=1:length(data)
varname = genvarname(['res' data(i).name],'#');
eval(['[' varname ',data(i).data] = cmeAnalysis(data(i).data,''ChannelNames'',{''SSF-B2''})']);
end
% From the above, generate a structure for dealing with all the results structs
% then plot at will
vars = who('-regexp','res*');
resStructs(1:numel(vars)) = struct('condition',[],'cumdist',[],'t',[]);
[resStructs.condition] = deal(vars{:});
% this is a messy plot of CDFs from all res structs in workspace.
% depending on the directory, sometimes you have to edit resStructs so it only contains the right structures
figure
hold all
col = hsv(length(resStructs));
for i=1:numel(resStructs)
eval(['[resStructs(i).cumdist, resStructs(i).t] = plot_ccp_cdf(' resStructs(i).condition ',col(i,:))']);
end
legend()
% Another way of plotting hists. THis has been subsumed by plot_ccp_cdf
figure
hold all
col = hsv(length(resStructs));
for i=1:numel(resStructs)
eval(['slaveHist=[' resStructs(i).condition '.lftRes.lftHistSlaveAll]']);
slaveHist=sum(slaveHist);
slaveHist=slaveHist/sum(slaveHist);
cumdist=cumsum(slaveHist);
eval(['plot(' resStructs(i).t ',cumdist)']);
end
legend()
% for loading in Ala (or just cheatsheet for loading and running analysis)
currentdir = pwd;
dataAla = loadConditionData(currentdir, {'Ch2','Ch1'},{'alexa568','egfp'},'Parameters', [1.49 150 16e-6])
[resAla,dataAla] = cmeAnalysis(dataAla,'ChannelNames',{'CLc-EGFP','SSF-B2-Ala'})
% given a lifetimedata.mat, plot max intensity vs
load('/Users/exark/Desktop/Crops/WT #2/Treatment/Cell2_4s/Ch1/Analysis/lifetimeData.mat')
maxA_all = []
for i=1:numel(A_all)
maxA_all = [maxA_all max(A_all{i})];
end
maxA_all = maxA_all';
catFilter = [find(catIdx == 1)' find(catIdx == 2)' find(catIdx ==5)']';
scatter(lifetime_s(catFilter),maxA_all(catFilter))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment