0001 function [output] = calcMDVfromSamp(glc,points,experiment)
0002
0003 npoints = size(points,2);
0004 fprintf('found %d samples in input\n',npoints);
0005
0006
0007
0008 fprintf('processing %d samples\n',npoints);
0009
0010 output = struct;
0011 mdv = [];
0012
0013 if isempty(glc)
0014 glc = experiment.inputfrag;
0015 else
0016 glc = convert_input(glc);
0017 end
0018 if isempty(experiment)
0019 o = slvrEMU_fast(points(:,1), glc);
0020 names = fields(o);
0021 else
0022 names = fields(experiment.fragments);
0023 end
0024
0025 parfor c = 1:npoints
0026 o = slvrEMU_fast(points(:,c), glc);
0027 tmdv = zeros(0,1);
0028 if ~ isempty(experiment)
0029 for l = 1:length(names)
0030 name = names{l};
0031 tname = experiment.fragments.(name).metfrag;
0032 tresult = o.(tname);
0033 tmdv = [tmdv; tresult];
0034 end
0035 else
0036 for l = 1:length(names)
0037 tresult = o.(names{l});
0038 tmdv = [tmdv; tresult];
0039 end
0040 end
0041 mdv(:,c) = tmdv;
0042 end
0043
0044 o = slvrEMU_fast(points(:,1), glc);
0045 mdvnames = {};
0046 k = 1;
0047 for l = 1:length(names)
0048 name = names{l};
0049 if isempty(experiment)
0050 tname = name;
0051 else
0052 tname = experiment.fragments.(name).metfrag;
0053 end
0054 tresult = o.(tname);
0055 for i = 1:length(tresult)
0056 newname = strcat(name, num2str(i-1));
0057 mdvnames{k,1} = newname;
0058 k = k+1;
0059 end
0060 end
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 ave = mean(mdv,2);
0081 stdev = std(mdv,0,2);
0082
0083 output.mdv = mdv;
0084 output.names = mdvnames;
0085 output.ave = ave;
0086 output.stdev = stdev;
0087 if ~isempty(experiment)
0088 output.xglc = experiment.input;
0089 end
0090
0091 return
0092 end