! ==================== program read_inbreed ! ==================== ! auxiliary program to WOMBAT to examine contents of binary file ! "inbreed.bin" -> inbreeding coefficients (in %) implicit none integer :: m, n, ii, i, m1, n1 integer, dimension(:), allocatable :: nannew integer, dimension(:,:), allocatable :: idwec real(8), dimension(:,:), allocatable :: inbreed character(len=11) :: inbrdfile = 'inbreed.bin' character(len=30) :: pedfile logical :: lex, ids ! does the file exist? inquire(file = inbrdfile, exist = lex) if( .not. lex ) then write(*,*)'Binary file "',inbrdfile,'" does not seem to exist'; stop end if ! open file & read header open(1,file = inbrdfile, status ='old', form = 'unformatted', action ='read') read(1) m, n ! ... allocate arrays allocate( nannew(m), stat = ii); if(ii /= 0 ) stop 'alloc nannew' rewind(1); read(1) m, n, nannew, pedfile allocate(inbreed(n,m), stat=ii); if(ii/=0) stop 'alloc inbreed' ! ... read inbreeding coefficients read(1) inbreed ! ... look for list of IDs read(1,iostat = ii ) m1, n1 if( ii /= 0 ) then ids = .false.; go to 10 end if allocate( idwec(m1,n1), stat = ii ); if( ii /= 0 ) stop 'alloc idwec' read(1,iostat=ii) idwec; if( ii == 0 ) ids = .true. 10 close(1) ! now ready to write out information - modify to your requirements write(*,'(5a)')'Information from WOMBAT binary file "',inbrdfile,'"' write(*,'(5a)')' ... inbreeding for pedigree file "',trim(pedfile),'"' write(*,'(a,i8)')' ... no. of genetic effects =',m write(*,'(a,8i8)')' ... no. of levels =',nannew ! ... list of inbreeding coefficients if( ids ) then do i = 1, n write(*,'(i8,i12,f9.3)') i, idwec(i,1), 100.d0*inbreed(i,1) end do else ! no. ids (older version of wombat) do i = 1, n write(*,'(i8,f9.3)') i, 100.d0*inbreed(i,1) end do end if stop 'end of READ_INBREED' end program read_inbreed ! @(C) K.M. 2009