Skip to content

Commit

Permalink
iterating ready to go!
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchrist committed Sep 23, 2024
1 parent 9749c4b commit 2fbd289
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions vignettes/Iterating_Over_Loci.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,29 @@ Here show how to use \pkg{kalis} to efficiently iterate over loci sequentially.

```{r, results='hide'}
require(kalis)
#
# total.nthreads <- 4
# n.checkpoints <- 7
#
# nthreads <- as.integer(0:(total.nthreads-1))
# CacheHaplotypes(SmallHaps)
#
# m <- rbeta(L()-1,1,10)*1e-6
# pars <- Parameters(CalcRho(cM = m, s = 1, gamma = 1), mu = 1e-8, use.speidel = TRUE)
#
# fwd <- MakeForwardTable(pars)
# bck <- MakeBackwardTable(pars)
# M <- matrix(0,N(),N())
#
# Iter <- ForwardIterator(pars,n.checkpoints)
#
# start.time <- proc.time()
#
# for(t in L():1){
# Iter(fwd,pars,t,nthreads = nthreads)
# Backward(bck,pars,t, nthreads = nthreads)
# # Optional: DistMat(fwd,bck,M,type="minus.min", nthreads = total.nthreads)
# print(paste("At locus",t))
# }
#
# print(proc.time() - start.time)
n.checkpoints <- 7
nthreads <- 4
CacheHaplotypes(SmallHaps)
m <- rbeta(L()-1,1,10)*1e-6
pars <- Parameters(CalcRho(cM = m, s = 1, gamma = 1), mu = 1e-8, use.speidel = TRUE)
fwd <- MakeForwardTable(pars)
bck <- MakeBackwardTable(pars)
M <- matrix(0,N(),N())
Iter <- ForwardIterator(pars,n.checkpoints)
start.time <- proc.time()
for(t in L():1){
Iter(fwd,pars,t,nthreads = nthreads)
Backward(bck,pars,t, nthreads = nthreads)
if(t==200){plot(DistMat(fwd,bck,M,type="minus.min", nthreads = nthreads))}
print(paste("At locus",t))
}
print(proc.time() - start.time)
```

0 comments on commit 2fbd289

Please sign in to comment.