Skip to content

Commit

Permalink
bug fix for one sample block in pcrelate
Browse files Browse the repository at this point in the history
  • Loading branch information
smgogarten committed Apr 19, 2019
1 parent 7d7f42a commit 4892b3f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
33 changes: 19 additions & 14 deletions R/pcrelate.R
Expand Up @@ -53,21 +53,26 @@ iterator <- SeqVarBlockIterator(seqData, variantBlock=block.size)
# create sample blocks
#nsampblock <- ceiling(length(sample.include)/sample.block.size)
nsampblock <- as.integer(config["n_sample_blocks"])
samp.blocks <- unname(split(sample.include, cut(1:length(sample.include), nsampblock)))
if (nsampblock > 1) {
samp.blocks <- unname(split(sample.include, cut(1:length(sample.include), nsampblock)))

# map segment number to sample block numbers
## jobs <- list()
## s <- 1
## for (i in 1:nsampblock) {
## for (j in i:nsampblock) {
## jobs[[s]] <- c(i,j)
## s <- s + 1
## }
## }
jobs <- c(combn(1:nsampblock, 2, simplify=FALSE),
lapply(1:nsampblock, function(x) c(x,x)))
i <- jobs[[segment]][1]
j <- jobs[[segment]][2]
# map segment number to sample block numbers
## jobs <- list()
## s <- 1
## for (i in 1:nsampblock) {
## for (j in i:nsampblock) {
## jobs[[s]] <- c(i,j)
## s <- s + 1
## }
## }
jobs <- c(combn(1:nsampblock, 2, simplify=FALSE),
lapply(1:nsampblock, function(x) c(x,x)))
i <- jobs[[segment]][1]
j <- jobs[[segment]][2]
} else {
samp.blocks <- list(sample.include)
i <- j <- 1
}

out <- pcrelateSampBlock(iterator,
betaobj=beta,
Expand Down
7 changes: 5 additions & 2 deletions pcrelate.py
Expand Up @@ -76,8 +76,11 @@

# define sample blocks
n_blocks = int(configdict.setdefault("n_sample_blocks", "1"))
blocks = [(i,j) for i in range(1, n_blocks+1) for j in range(i, n_blocks+1)]
block_range = "1-" + str(len(blocks))
if n_blocks > 1:
blocks = [(i,j) for i in range(1, n_blocks+1) for j in range(i, n_blocks+1)]
block_range = "1-" + str(len(blocks))
else:
block_range = "1"

jobid = cluster.submitJob(job_name=job, cmd=driver, args=["-s", rscript, configfile, version], holdid=[jobid], array_range=block_range, email=email, print_only=print_only)

Expand Down

0 comments on commit 4892b3f

Please sign in to comment.