This is a static copy of a profile report

Home

fit_Gaussian_model_trisomy_2>fiterror (4050 calls, 0.685 sec)
Generated 14-Nov-2016 07:47:12 using cpu time.
subfunction in file /home/user/dev/ymap/scripts_seqModules/scripts_WGseq/fit_Gaussian_model_trisomy_2.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
fminsearch>checkfunsubfunction4050
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
110
if (p3_c < 2);   p3_c = 2; ...
40500.040 s5.9%
171
sse  = sum(Error_Vector.^2);
40500.030 s4.4%
170
Error_Vector = (fitted) - (dat...
40500.030 s4.4%
164
width = 0.5;
40500.030 s4.4%
142
p3_fit = [p3_fit_L p3_fit_R];
40500.030 s4.4%
All other lines  0.524 s76.5%
Totals  0.685 s100% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
83Input argument 'time' might be unused, although a later one is used. Consider replacing it by ~.
164The value assigned to variable 'width' might be unused.
182This statement (and possibly following ones) cannot be reached.
Coverage results
Show coverage for parent directory
Total lines in function102
Non-code lines (comments, blank lines)10
Code lines (lines that can run)92
Code lines that did run69
Code lines that did not run23
Coverage (did run/can run)75.00 %
Function listing
time 
calls 
 line
  83 
function sse = fiterror(params,time,data,func_type,locations,show)
   4050 
  84 
	p1_a         = abs(params(1)); % height. 
  0.01 
   4050 
  85 
	p1_b         = locations(1);   % location. 
  0.01 
   4050 
  86 
	p1_c         = abs(params(2)); % width. 
   4050 
  87 
	p2_a         = abs(params(3)); % height. 
   4050 
  88 
	p2_b         = locations(2);   % location. 
   4050 
  89 
	p2_c         = abs(params(4)); % width. 
  0.01 
   4050 
  90 
	p3_a         = abs(params(5)); % height. 
  0.01 
   4050 
  91 
	p3_b         = locations(3);   % location. 
  0.01 
   4050 
  92 
	p3_c         = abs(params(6)); % width. 
   4050 
  93 
	p4_a         = abs(params(7)); % height. 
   4050 
  94 
	p4_b         = locations(4);   % location. 
  0.01 
   4050 
  95 
	p4_c         = abs(params(8)); % width. 
  0.01 
   4050 
  96 
	skew_factor1 = abs(params(9)); 
   4050 
  97 
	skew_factor2 = abs(params(10)); 
  0.01 
   4050 
  98 
	skew_factor3 = abs(params(11)); 
   4050 
  99 
	skew_factor4 = abs(params(12)); 
  0.01 
   4050 
 100 
	if (p1_c == 0); p1_c = 0.001; end; 
  0.01 
   4050 
 101 
	if (p2_c == 0); p2_c = 0.001; end; 
   4050 
 102 
	if (p3_c == 0); p3_c = 0.001; end; 
   4050 
 103 
	if (p4_c == 0); p4_c = 0.001; end; 
   4050 
 104 
	if (skew_factor1 < 0); skew_factor1 = 0; end; if (skew_factor1 > 2); skew_factor1 = 2; end; 
  0.01 
   4050 
 105 
	if (skew_factor2 < 0); skew_factor2 = 0; end; if (skew_factor2 > 2); skew_factor2 = 2; end; 
  0.02 
   4050 
 106 
	if (skew_factor3 < 0); skew_factor3 = 0; end; if (skew_factor3 > 2); skew_factor3 = 2; end; 
   4050 
 107 
	if (skew_factor4 < 0); skew_factor4 = 0; end; if (skew_factor4 > 2); skew_factor4 = 2; end; 
  0.01 
   4050 
 108 
	if (p1_c < 2);   p1_c = 2;   end; 
  0.01 
   4050 
 109 
	if (p2_c < 2);   p2_c = 2;   end; 
  0.04 
   4050 
 110 
	if (p3_c < 2);   p3_c = 2;   end; 
   4050 
 111 
	if (p4_c < 2);   p4_c = 2;   end; 
  0.01 
   4050 
 112 
	time1_1 = 1:floor(p1_b); 
   4050 
 113 
	time1_2 = ceil(p1_b):200; 
  0.01 
   4050 
 114 
	if (time1_1(end) == time1_2(1));time1_1(end) = [];  end; 
  0.02 
   4050 
 115 
	time2_1 = 1:floor(p2_b); 
  0.01 
   4050 
 116 
	time2_2 = ceil(p2_b):200; 
   4050 
 117 
	if (time2_1(end) == time2_2(1));time2_1(end) = [];  end; 
   4050 
 118 
	time3_1 = 1:floor(p3_b); 
   4050 
 119 
	time3_2 = ceil(p3_b):200; 
   4050 
 120 
	if (time3_1(end) == time3_2(1));time3_2(1) = [];end; 
   4050 
 121 
	time4_1 = 1:floor(p4_b); 
   4050 
 122 
	time4_2 = ceil(p4_b):200; 
   4050 
 123 
	if (time4_1(end) == time4_2(1));time4_2(1) = [];end; 
  0.01 
   4050 
 124 
	c1_  = p1_c/2 + p1_c*skew_factor1/(100.5-abs(100.5-p1_b))/2; 
  0.01 
   4050 
 125 
	p1_c = p1_c*p1_c/c1_; 
   4050 
 126 
	c2_  = p2_c/2 + p2_c*skew_factor2/(100.5-abs(100.5-p2_b))/2; 
   4050 
 127 
	p2_c = p2_c*p2_c/c2_; 
   4050 
 128 
	c3_  = p3_c/2 + p3_c*skew_factor3/(100.5-abs(100.5-p3_b))/2; 
  0.01 
   4050 
 129 
	p3_c = p3_c*p3_c/c3_; 
   4050 
 130 
	c4_  = p4_c/2 + p4_c*skew_factor4/(100.5-abs(100.5-p4_b))/2; 
  0.01 
   4050 
 131 
	p4_c = p4_c*p4_c/c4_; 
  0.03 
   4050 
 132 
	p1_fit_L = p1_a*exp(-0.5*((time1_1-p1_b)./p1_c).^2); 
  0.01 
   4050 
 133 
	p1_fit_R = p1_a*exp(-0.5*((time1_2-p1_b)./p1_c/(skew_factor1/(100.5-abs(100.5-p1_b))) ).^2); 
  0.02 
   4050 
 134 
	p2_fit_L = p2_a*exp(-0.5*((time2_1-p2_b)./p2_c).^2); 
  0.01 
   4050 
 135 
	p2_fit_R = p2_a*exp(-0.5*((time2_2-p2_b)./p2_c/(skew_factor2/(100.5-abs(100.5-p2_b))) ).^2); 
   4050 
 136 
	p3_fit_L = p3_a*exp(-0.5*((time3_1-p3_b)./p3_c/(skew_factor3/(100.5-abs(100.5-p3_b))) ).^2); 
  0.03 
   4050 
 137 
	p3_fit_R = p3_a*exp(-0.5*((time3_2-p3_b)./p3_c).^2); 
  0.03 
   4050 
 138 
	p4_fit_L = p4_a*exp(-0.5*((time4_1-p4_b)./p4_c/(skew_factor4/(100.5-abs(100.5-p4_b))) ).^2); 
  0.02 
   4050 
 139 
	p4_fit_R = p4_a*exp(-0.5*((time4_2-p4_b)./p4_c).^2); 
  0.01 
   4050 
 140 
	p1_fit = [p1_fit_L p1_fit_R]; 
   4050 
 141 
	p2_fit = [p2_fit_L p2_fit_R]; 
  0.03 
   4050 
 142 
	p3_fit = [p3_fit_L p3_fit_R]; 
   4050 
 143 
	p4_fit = [p4_fit_L p4_fit_R]; 
   4050 
 144 
	fitted = p1_fit+p2_fit+p3_fit+p4_fit; 
 145 

  0.02 
   4050 
 146 
if (show ~= 0) 
 147 
%----------------------------------------------------------------------
 148 
% show fitting in process.
 149 
figure(show);
 150 
% show data being fit.
 151 
plot(data,'x-','color',[0.75 0.75 1]);
 152 
hold on;
 153 
title('trisomy');
 154 
% show fit lines.
 155 
plot(p1_fit,'-','color',[0 0.75 0.75],'lineWidth',2);
 156 
plot(p2_fit,'-','color',[0 0.75 0.75],'lineWidth',2);
 157 
plot(p3_fit,'-','color',[0 0.75 0.75],'lineWidth',2);
 158 
plot(p4_fit,'-','color',[0 0.75 0.75],'lineWidth',2);
 159 
plot(fitted,'-','color',[0 0.50 0.50],'lineWidth',2);
 160 
hold off;
 161 
%----------------------------------------------------------------------
 162 
end;
 163 

  0.03 
   4050 
 164 
	width = 0.5; 
   4050 
 165 
	switch(func_type) 
  0.02 
   4050 
 166 
		case 'cubic' 
 167 
			Error_Vector = (fitted).^2 - (data).^2;
 168 
			sse  = sum(abs(Error_Vector));
  0.02 
   4050 
 169 
		case 'linear' 
  0.03 
   4050 
 170 
			Error_Vector = (fitted) - (data); 
  0.03 
   4050 
 171 
			sse  = sum(Error_Vector.^2); 
 172 
		case 'log'
 173 
			Error_Vector = log(fitted) - log(data);
 174 
			sse  = sum(abs(Error_Vector));
 175 
		case 'fcs'
 176 
			Error_Vector = (fitted) - (data);
 177 
			%Error_Vector(1:round(G1_b*(1-width))) = 0;
 178 
			%Error_Vector(round(G1_b*(1+width)):end) = 0;
 179 
			sse  = sum(Error_Vector.^2);
 180 
		otherwise
 181 
			error('Error: choice for fitting not implemented yet!');
 182 
			sse  = 1;
 183 
	end;
  0.01 
   4050 
 184 
end