tanaylab/misha

Parallelization of percentiles queries in gextract

Closed this issue · 0 comments

When calling gextract on quantile gvtracks, the preparation of percentiles queries is not parallelized by default, when it could easily be...
Does this have to do with the recommendation to turn off gmultitasking?

devtools::load_all("/home/feshap/src/mcATAC")
gset_genome("mm10")
mc_tracks <- gtrack.ls('mmcortex_metacell')
mc_tracks_ord <- mc_tracks[order(as.numeric(gsub("mmcortex_metacell.mc", "", mc_tracks)))]
mc_tracks_prc <- gsub("mmcortex_metacell.mc", "mmcortex_metacell_prc_test.mc", mc_tracks_ord)
dd <- mapply(mc_tracks_ord, mc_tracks_prc, FUN = function(trko, trkp) {
    gvtrack.create(vtrack = trkp, src = trko, func = "global.percentile")
})

## Compare behavior of this ....
plot_tracks_at_locus(mc_tracks_prc, intervals = gintervals(1, 1e+7, 1.01e+7))

## With this ....
prc <- 0.97
screen_peaks <- parallel::mclapply(mc_tracks_prc, function(x) {
    gscreen(expr = glue::glue("{x} > {prc}"), intervals = gintervals.all(), iterator = 10)
}, mc.cores = 50)