%MATLAB code for calculating the autocorrelation function of transcription factor alpha-coefficients N = 36; %The number of time points pstrengths = zeros(length(TFList),1); autoCorrFn = zeros(length(TFList),N); RxxRange = [1 2*N-1]; %Find autocorrelation for each TF in TFList, which contains top 20 TFs for k = 1:length(TFList) [Rxx, lag]=xcorr(alphaCoeffs(k+1,:)); startCoord = round(RxxRange(2)/2); endCoord = RxxRange(2); %Ignore the first few values, because those will have high %autocorrelation no matter what. [a,delay]=max(abs(Rxx(1:N-6))); %We expect to see a peak at Rxx(24). Normalize this value. autoCorrFn(k,:)=Rxx(startCoord:endCoord); periodic_strength = Rxx(24)/autoCorrFn(k,1); %Store the periodicity score for the kth TF in pstrengths pstrengths(k) = periodic_strength; end