diff --git a/CREClass.m b/CREClass.m index 1611f1c..22c4c46 100644 --- a/CREClass.m +++ b/CREClass.m @@ -104,7 +104,13 @@ classdef CREClass < handle LogFC=log(FC); LogFC(~isfinite(LogFC))=0;%the log of 0 is -inf. however in Fc.*logFc it should end up as 0. to avoid conflicts removing the -inf if any(isnan(FC));error('something went wrong');end %catch a posible error. - obj.CRE=-transpose(dl)*(FC.*LogFC)./(transpose(dl)*FC); %CRE zografos + if transpose(dl)*FC==0; + %if only one value in the most left bin in the distribution I may get a 0 divided by 0 + %as the CRE of a delta function is 0, enforce this outcome + obj.CRE=0; + else + obj.CRE=-transpose(dl)*(FC.*LogFC)./(transpose(dl)*FC); %CRE zografos + end %% get the RB dl(FC>0.5)=0; %set the weight for all in the histogram to the left side (i.e.