This is a static copy of a profile report

Home

fit_Gaussian_model_monosomy_2 (1 call, 0.071 sec)
Generated 14-Nov-2016 07:47:11 using cpu time.
function in file /home/user/dev/ymap/scripts_seqModules/scripts_WGseq/fit_Gaussian_model_monosomy_2.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
FindGaussianCutoffs_3function1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
33
[Estimates,~,exitflag] = fmins...
10.060 s85.7%
63
end
10 s0%
62
p2_c = p2_c*p2_c/c2_;
10 s0%
61
c2_  = p2_c/2 + p2_c*skew_fact...
10 s0%
60
p1_c = p1_c*p1_c/c1_;
10 s0%
All other lines  0.010 s14.3%
Totals  0.071 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
fminsearchfunction10.060 s85.7%
optimsetfunction10 s0%
Self time (built-ins, overhead, etc.)  0.010 s14.3%
Totals  0.071 s100% 
Code Analyzer results
Line numberMessage
1Input argument 'workingDir' might be unused, although a later one is used. Consider replacing it by ~.
1Input argument 'saveName' might be unused, although a later one is used. Consider replacing it by ~.
26The value assigned to variable 'p1_bi' might be unused.
27The value assigned to variable 'p2_bi' might be unused.
Coverage results
Show coverage for parent directory
Total lines in function63
Non-code lines (comments, blank lines)27
Code lines (lines that can run)36
Code lines that did run28
Code lines that did not run8
Coverage (did run/can run)77.78 %
Function listing
time 
calls 
 line
   1 
function [p1_a,p1_b,p1_c, p2_a,p2_b,p2_c, skew_factor] = fit_Gaussian_model_monosomy_2(workingDir, saveName, data,locations,init_width,func_type)
   2 
	% attempt to fit a 2-gaussian model to data.
   3 

      1 
   4 
	show = false; 
      1 
   5 
	p1_a = nan;   p1_b = nan;   p1_c = nan; 
      1 
   6 
	p2_a = nan;   p2_b = nan;   p2_c = nan; 
      1 
   7 
	skew_factor = 1; 
   8 

      1 
   9 
	if isnan(data) 
  10 
		% fitting variables
  11 
		return
  12 
	end
  13 

  14 
	% find max height in data.
      1 
  15 
	datamax = max(data); 
  16 
	%datamax(data ~= max(datamax)) = [];
  17 

  18 
	% if maxdata is final bin, then find next highest p
      1 
  19 
	if (find(data == datamax) == length(data)) 
  20 
		data(data == datamax) = 0;
  21 
		datamax = data;
  22 
		datamax(data ~= max(datamax)) = [];
  23 
	end;
  24 

  25 
	% a = height; b = location; c = width.
      1 
  26 
	p1_ai = datamax;   p1_bi = locations(1);   p1_ci = init_width; 
      1 
  27 
	p2_ai = datamax;   p2_bi = locations(2);   p2_ci = init_width; 
  28 

      1 
  29 
	initial = [p1_ai,p1_ci,p2_ai,p2_ci,skew_factor,skew_factor]; 
      1 
  30 
	options = optimset('Display','off','FunValCheck','on','MaxFunEvals',100000); 
      1 
  31 
	time= 1:length(data); 
  32 

  0.06 
      1 
  33 
	[Estimates,~,exitflag] = fminsearch(@fiterror, ...   % function to be fitted. 
  34 
	                                    initial, ...     % initial values.
  35 
	                                    options, ...     % options for fitting algorithm.
  36 
	                                    time, ...        % problem-specific parameter 1.
  37 
	                                    data, ...        % problem-specific parameter 2.
  38 
	                                    func_type, ...   % problem-specific parameter 3.
  39 
	                                    locations, ...   % problem-specific parameter 4.
  40 
	                                    show ...         % problem-specific parameter 5.
  41 
	                            );
      1 
  42 
	if (exitflag > 0) 
  43 
		% > 0 : converged to a solution.
  44 
	else
  45 
		% = 0 : exceeded maximum iterations allowed.
  46 
		% < 0 : did not converge to a solution.
  47 
		% return last best estimate anyhow.
  48 
	end;
      1 
  49 
	p1_a         = abs(Estimates(1)); 
      1 
  50 
	p1_b         = locations(1); 
      1 
  51 
	p1_c         = abs(Estimates(2)); 
      1 
  52 
	p2_a         = abs(Estimates(3)); 
      1 
  53 
	p2_b         = locations(2); 
      1 
  54 
	p2_c         = abs(Estimates(4)); 
      1 
  55 
	skew_factor1 = abs(Estimates(5)); 
      1 
  56 
	skew_factor2 = abs(Estimates(6)); 
      1 
  57 
	if (skew_factor < 0); skew_factor = 0; end; if (skew_factor > 2); skew_factor = 2; end; 
  58 

      1 
  59 
	c1_  = p1_c/2 + p1_c*skew_factor1/(100.5-abs(100.5-p1_b))/2; 
      1 
  60 
	p1_c = p1_c*p1_c/c1_; 
      1 
  61 
	c2_  = p2_c/2 + p2_c*skew_factor2/(100.5-abs(100.5-p2_b))/2; 
      1 
  62 
	p2_c = p2_c*p2_c/c2_; 
      1 
  63 
end 

Other subfunctions in this file are not included in this listing.