! creates expected growth rates of all sub-blocks present in a block. Program grates implicit none integer(KIND=8) j,k,i,Le1,Le2,l1,l2,k1,k2 real(KIND=8) n,x,temp,y0,delta real(KIND=8),allocatable,dimension(:)::eff1 real(KIND=8),allocatable,dimension(:,:,:)::blocks Le1=2048 ! number of loci in the entire block y0=0.4d+0 ! map length of block delta=0.4D+0/Le1 ! recombination rate per locus allocate(blocks(3,Le1,Le1),eff1(Le1)) ! read contribution of each locus from file open(4,file='genome_L2048_z0_V0y0_0.04.txt') do i=1,Le1 read(4,93) eff1(i) 93 Format(9X,F12.9,16X) enddo close(4) do i=1,Le1 do j=1,Le1 blocks(1,j,i)=0.0D+0 blocks(2,j,i)=0.0d+0 enddo enddo ! For each block, create intrinsic growth rate: Exp[S](1-(j-i)*delta). do i=1,Le1 do j=i,Le1 blocks(1,j,i)=0.0D+0 do k=i,j blocks(1,j,i)=blocks(1,j,i)+eff1(k) enddo blocks(1,j,i)=exp(blocks(1,j,i)) blocks(2,j,i)=blocks(1,j,i)*(1.0D+0-((j-i)*delta)) enddo enddo ! For each block, pick the parent block (that containing this block) with the highest instrinsic growth rate. This is the expected growth rate of the block. do i=1,Le1 do j=i,Le1 temp=blocks(2,j,i) do k1=1,i do k2=j,Le1 if (blocks(2,k2,k1)>temp)then temp=blocks(2,k2,k1) endif enddo enddo blocks(3,j,i)=temp enddo enddo ! output file: columns 1,2--> end points i,j of block [i,j]; column 3--> intrinsic growth rate of block column 4--> expected growth rate of block. open(4,file='blocks_expected_rates.txt') do i=1,Le1 do j=i,Le1 write(4,94) i,j,(blocks(k,j,i),k=2,3) 94 Format(I8,1X,I8,1X,F12.9,1X,F12.9) enddo enddo close(4) end program