Hi everyone, I'm using the function 'HWE.exact' of 'genetics' package to compute p-values of the HWE test. My data set consists of ~600 subjects (cases and controls) typed at ~ 10K SNP markers; the test is applied separately to cases and controls. The genotypes are stored in a list of 'genotype' objects, all.geno, and p-values are calculated inside the loop over all SNP markers.
I wish to repeat this procedure multiple times (~1000) permuting the cases and controls (affection status). It seems straightforward to implement it like this: ############################################# for (iter in 1:1000) { set.seed(iter) # get the permuted affection status permut <- sample(affSt) for (j in 1:nSNPs) { test <- tapply(all.geno[[j]], permut, HWE.exact) pvalControls[j] <- test$"1"$p.value pvalCases[j] <- test$"2"$p.value } } ############################################## The problem is that it takes ~1 min/iteration (on AMD Opteron 252 processor running Linux). Is there a faster/more efficient way to do this? Thanks, -- Anna Pluzhnikov, PhD Section of Genetic Medicine Department of Medicine The University of Chicago ------------------------------------------------- This email is intended only for the use of the individual or...{{dropped}} ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html