Skip to content

Add fgseaBatch: batch preranked GSEA over multiple stats vectors in o…#1

Merged
paliocha merged 1 commit into
mainfrom
feature/fgsea-batch
May 22, 2026
Merged

Add fgseaBatch: batch preranked GSEA over multiple stats vectors in o…#1
paliocha merged 1 commit into
mainfrom
feature/fgsea-batch

Conversation

@paliocha
Copy link
Copy Markdown
Owner

…ne C++ call

  • fgsea_batch_cpp() (src/rcpp_glue.cpp): Rcpp export that accepts H sorted stats vectors and precomputed pathway positions, builds std::vector at the R->C++ boundary, then dispatches: GPU path: sequential for-loop (each HOG fully saturates the device) CPU path: std::for_each(par_unseq) over HOG indices via TBB Returns flat List with hog_idx (1-based), pathway, pval, padj, ES, NES, nMoreExtreme, size, leadingEdge (1-based gene indices), pi0.

  • fgseaBatch() (R/fgsea.R): R wrapper; precomputes sorted stats and pathway positions on the R side (reuses .prepareStats / .pathwayPositions), calls fgsea_batch_cpp, converts leading-edge indices back to gene names, returns data.table with extra hog_idx column plus standard fgsea columns.

  • NAMESPACE: export(fgseaBatch)

  • README.md: document fgseaBatch in usage example and entry-points table

Motivation: eliminates per-query R dispatch overhead; on CPU enables TBB parallel processing of queries rather than a sequential R for-loop; on GPU ensures the device is kept busy across many independent queries.

…ne C++ call

- fgsea_batch_cpp() (src/rcpp_glue.cpp): Rcpp export that accepts H sorted
  stats vectors and precomputed pathway positions, builds
  std::vector<FgseaInput> at the R->C++ boundary, then dispatches:
    GPU path: sequential for-loop (each HOG fully saturates the device)
    CPU path: std::for_each(par_unseq) over HOG indices via TBB
  Returns flat List with hog_idx (1-based), pathway, pval, padj, ES, NES,
  nMoreExtreme, size, leadingEdge (1-based gene indices), pi0.

- fgseaBatch() (R/fgsea.R): R wrapper; precomputes sorted stats and pathway
  positions on the R side (reuses .prepareStats / .pathwayPositions),
  calls fgsea_batch_cpp, converts leading-edge indices back to gene names,
  returns data.table with extra hog_idx column plus standard fgsea columns.

- NAMESPACE: export(fgseaBatch)

- README.md: document fgseaBatch in usage example and entry-points table

Motivation: eliminates per-query R dispatch overhead; on CPU enables TBB
parallel processing of queries rather than a sequential R for-loop; on GPU
ensures the device is kept busy across many independent queries.
Copilot AI review requested due to automatic review settings May 22, 2026 11:10
@paliocha paliocha merged commit cc2e14d into main May 22, 2026
1 check failed
@paliocha paliocha deleted the feature/fgsea-batch branch May 22, 2026 11:10
@paliocha paliocha review requested due to automatic review settings May 22, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant