Chris1221 / coRge

Evaluation of Simultaneous Inference Methods for the Human Genome.
http://chrisbcole.me/coRge/
Apache License 2.0
0 stars 0 forks source link

Circumvent need for coRge::gen2r() #19

Closed Chris1221 closed 8 years ago

Chris1221 commented 8 years ago

This is way too long, maybe create a vector with three entries for each es and simply multiply the matrices. This has to be faster. Have to make sure that 0*x = 0 and that the 0s don't contribute to rowsums. they shouldn't but just make sure.

Chris1221 commented 8 years ago
# -------------- OLD WAY -------------------
    combR <- gen2r(genfile = comb, local = TRUE)

    b <- phen()

    combR <- as.data.frame(foreach(i = 1:nrow(combR), .combine = 'rbind') %:%
                foreach(j = 1:ncol(combR), .combine = 'c') %do% {
                  combR[i,j] <- combR[i,j]*b[j] - b[j]*snps[j,"all_maf"] })

WAS <- rowSums(combR)
#   ---------------------------------------------------------