function r = est_rec_fracs(geno) %estimate adjacent pairwise recfracs in a genotype array % %Copyright notice %this code was written by Gary Churchill who retains all rights. %If this code to generate results in publications please cite %Sugiyama F, Churchill GA, Higgins DC, Johns C, Makaritsis KP, Gavras H, Paigen B (1999) %Quantitative trait loci analysis of blood pressure in mice on a high salt regimen: %Concordance with rat and human loci. Submitted to Nature Genetics. % m = size(geno,2); r = zeros(m,m); % array of rec fracs cnt = [0 1 2; 1 0 1; 2 1 0]; if max(geno(:)>1) F2 = 1; else F2 = 0; end for i = 1:m-1 for j = i+1:m M = geno(:,[i,j]); %pull two adjacent rows out of geno M(any(isnan(M)'),:) = []; %remove rows with missing values r(i,j) = sum(diag(cnt(M(:,1)+1, M(:,2)+1))); %count crossovers if F2 r(i,j) = sum(M(:,1)~=M(:,2)); r(i,j) = r(i,j)+ sum((M(:,1)==0 & M(:,2)==2) | (M(:,1)==2 & M(:,2)==0)); else r(i,j) = sum(M(:,1)~=M(:,2)); end %normalize if F2 %backcross r(i,j) = min( r(i,j)/(2*size(M,1)), 0.5); else %f2 r(i,j) = min( r(i,j)/size(M,1), 0.5); end end end %symmetrize for i = 2:m for j = 1:i-1 r(i,j) = r(j,i); end end