Skip to content

feat: persist multi-omics WGCNA at upload via pgx$wgcna_mox slot#477

Merged
phisanti merged 7 commits into
edgyfrom
edgy_scm_mWGCNA
May 28, 2026
Merged

feat: persist multi-omics WGCNA at upload via pgx$wgcna_mox slot#477
phisanti merged 7 commits into
edgyfrom
edgy_scm_mWGCNA

Conversation

@phisanti
Copy link
Copy Markdown
Contributor

Before: multi-omics WGCNA lived only in webapp reactive r_multiwgcna. Never written to pgx. Downstream saw NULL slot. AI reports, Copilot context, and re-analysis are all blind to it.

Now, if wgcna %in% compute_extra, and pgx$datatype %in% c("multi-omics","multiomics") then call wgcna.compute_multiomics() at pgx.Compute().

phisanti added 5 commits May 22, 2026 12:23
- move wgcna.get_modTraits, wgcna.getTopGenesAndSets (+ multi/consensus
  variants), wgcna.describeModules from pgx-wgcna.R to a dedicated
  pgx-wgcna-report.R module; new wgcna.getTopModules absorbs the prior
  wrapper and adds a min_modules floor (default 5L) so downstream
  consumers always get a renderable selection
- add wgcna.ensureStats() to lazily populate wgcna\$net\$labels and
  wgcna\$stats for older PGX files that ship without them; idempotent
  guard prevents wgcna.getGeneStats errors on example-data and similar
- harden probe2symbol with a NULL-guard on annot_table so callers can
  drop their local resolve_symbols defensive wrappers; behaviour
  unchanged when annot_table is provided
- new pgx-drugs-report.R exports drugs.analysisInfo,
  drugs.enrichmentTable, drugs.moaEnrichment, drugs.supportBucket;
  promoted from omicsplayground board.drugconnectivity so on-the-fly
  fgsea MOA enrichment and L1000-vs-sensitivity NES direction
  semantics are reusable across boards and pipelines
- lift %||% to utils.R as a backward-compat null-coalesce helper
  (Depends R >= 3.5 — base R 4.4 operator not yet available)
- some L1000 / CMap drug MOA and target strings carry mixed-encoding
  bytes (eg the 0xD0 byte in 'serotonin<d0>norepinephrine reuptake
  inhibitor'); enc2utf8 alone does not strip these, so strsplit's
  regex engine fails with 'input string is invalid' and 'unable to
  translate to a wide string' warnings
- replace enc2utf8 with iconv(from='UTF-8', to='UTF-8', sub='') which
  re-parses the input as UTF-8 and silently drops invalid byte
  sequences; downstream tokenisation only needs the ASCII separators
  (pipe / semicolon / comma) so dropping the offending bytes does not
  lose any information that the splitter would have used
- add .semquery (semquery index store), .active_plans (in-progress
  plan files) and .agents_context (cross-agent scratch notes) to
  .Rbuildignore so devtools::install / R CMD build no longer
  complain about non-portable hidden directories inside the package
  root
- add wgcna_mox branch to compute_extra() gated on
  pgx$datatype %in% c('multi-omics','multiomics'); calls
  wgcna.compute_multiomics() with the multiwgcna board's parameter
  set (deepsplit=2, power=NULL, ngenes=2000, minmodsize=10,
  minKME=0.3, compute.enrichment=TRUE) and writes the result to
  pgx$wgcna_mox alongside the existing single-omics pgx$wgcna so
  both representations coexist (deprecation deferred)
- until now the multi-omics WGCNA only existed as a Shiny reactive
  in the webapp's multiwgcna board and was never persisted, so any
  downstream consumer (AI reports, copilot context, re-analysis)
  saw a NULL wgcna_mox slot on multi-omics PGX files
- new block uses info() rather than message() for non-error
  progress lines (matches the convention emerging across compute
  pipeline); error reporting keeps the message() + ERROR_WGCNA_MOX
  marker-file pattern shared by the other compute_extra branches
@phisanti phisanti requested review from ESCRI11 and ivokwee and removed request for ESCRI11 May 28, 2026 07:46
@phisanti phisanti changed the base branch from main to edgy May 28, 2026 07:48
@ESCRI11 ESCRI11 self-requested a review May 28, 2026 11:17
@phisanti phisanti merged commit 4df9aa2 into edgy May 28, 2026
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.

2 participants