startRun <- 0 endRun <- 639 runIndex="" load(file=paste("resDups.Rda",sep="")) lengthAll <- 3201157 shift <- 5000 intervallAll <- 10000 over <- intervallAll%/%shift N1 <- lengthAll%/%shift endRunAll <- (N1-over+1) # 639 allCount <- 0 allCount1 <- 0 res <- list() resA <- list() for (posAll in (startRun+1):(endRun+1)) { start <- (posAll-1)*shift end <- start + intervallAll if (end > lengthAll) { end <- lengthAll } pRange <- paste("_",format(start,scientific=FALSE),"_",format(end,scientific=FALSE),sep="") load(file=paste("resIBD_chr1",pRange,"annot.Rda",sep="")) noIBD <- length(IBDannot) if (noIBD>0) { for (ibdC in 1:noIBD) { allCount <- allCount + 1 res1 <- c(allCount,ibdC,posAll) resA[[allCount]] <- res1 if (!dups[allCount]) { allCount1 <- allCount1 + 1 res1 <- c(allCount1,allCount,ibdC,posAll) res[[allCount1]] <- res1 } cat(allCount," out of 222246\r") } } } rr <- unlist(res) l <-4 countsA1 <- matrix(rr,nrow=allCount1,ncol=l,byrow=TRUE) colnames(countsA1) <- c("allCount1","allCount","ibdC","posAll") rr <- unlist(resA) l <-3 countsA2 <- matrix(rr,nrow=allCount,ncol=l,byrow=TRUE) colnames(countsA2) <- c("allCount","ibdC","posAll") write.table(countsA1,file=paste("countsA1",runIndex,".txt",sep="")) write.table(countsA2,file=paste("countsA2",runIndex,".txt",sep="")) save(countsA1,countsA2,file=paste("counts",runIndex,".Rda",sep=""))