-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gdsSubset and other gds object interactions are not practial for loops/parallel #37
Comments
This should really be an issue in the GWASTools package, since If you really want to do it this way, set |
If you do pass it plan("multicore", workers = 8)
options(future.globals.maxSize = 4 * 1e9)
# prune to the relevant biomarker overlap
gds <- GenotypeBlockIterator(GenotypeData(GdsGenotypeReader(gds_fn, allow.fork = TRUE)))
sample.sel <- getScanID(gds)
# for each biomarker make grm
future_lapply(bios, function(i) {
# intersection for variable of interest
both <- intersect(a[DS1V == 0 & !is.na(get(i)), PIDN], sample.sel)
# run PC-Relate
mypcrelate <- pcrelate(gds,
pcs = mypcair$vectors[, 1:8],
training.set = intersect(mypcair$unrels, both),
BPPARAM = BiocParallel::SerialParam(),
sample.include = both
)
# write pcrelate RDS and GRM to file
saveRDS(mypcrelate, file = paste("mypcrelate", i, "rds", sep = "."))
}, future.seed = TRUE) |
I don't entirely understand your question. If you're getting an error or unexpected results using |
If you want to
gdsSubset
your object, you cannot have it open, which is incredibly impractical for downstream use if I need information from it, for example sample IDs.This will fail unless I close the object first, and would be a major chokepoint if I had to access elements inside the gds object in the
lapply
, as it would open and close the gds file for each iteration. Not to mention impossible to use with something likefuture_lapply
trying to parallelize the process since it only allows the file to be open once. Is there a reason it has to lock the file for use?The text was updated successfully, but these errors were encountered: