Skip to content

fix(ai-report): build DE tables for PGX files without group means - #566

Merged
ESCRI11 merged 1 commit into
fantafrom
fix/ai-report-de-missing-group-means
Dec 1, 2026
Merged

ESCRI11 merged 1 commit into
fantafrom
fix/ai-report-de-missing-group-means

Conversation

@ESCRI11

@ESCRI11 ESCRI11 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Every AI Studio report on an older PGX file fails before any model call. The public geiger2016-arginine (a 2020 LC/MS proteomics dataset) is one example:

Error in data.frame(gene = info$symbol, annotation = info$title, logFC = ...:
  arguments imply differing number of rows: 50, 0
Calls: ... .de_contrast_detail -> vapply -> FUN -> .de_gene_table -> data.frame

These files keep only meta.fx meta.p meta.q fc p q per contrast in gx.meta, with no avg.0/avg.1. So mx$avg.0[ord] has length 0. The annotation column is not the cause: .de_annotate_genes() already falls back to gene_title, which older and current files both carry.

Fix

.de_gene_table() leaves out avg_first/avg_second when the group means are absent. Newer PGX files get the same table as before, with the same column order.

I checked the rest of the report family on the same dataset (de_build_methods, pathways, drugs for both stored databases, .ai_report_get_label, combined_build_report_data). All pass, so nothing else changes. That dataset has no wgcna or mofa slot, so those were not checked against it.

Tests

  • New test-ai-report.R case that builds the old gx.meta shape synthetically. It errors on fanta and passes with the fix. It also pins the full column order when the means are present.
  • test-ai-* files in a prod compute-light image: 11/11 pass.
  • Full suite in the same image, run before and after the fix: the only difference is the new test going from error to pass. The 47 failures and errors it shares with fanta (createPGX, PathBank network calls, importance snapshots) come from the image being older than fanta.
  • Against the real datasets in a beta compute-light pod, with this branch's AI Studio helper files loaded in memory and driven through the monorepo's compute_ai_studio_report_context():
    • geiger2016-arginine: DE, pathways, two drug databases and the combined phase all build (they failed before);
    • the 2026 example-data recompute: unchanged, still has avg_first/avg_second, and wgcna also builds.

The monorepo's playbase-ai-studio source bundle will pin this commit in a separate PR.

🤖 Generated with Claude Code

Older PGX files keep only meta.fx/meta.p/meta.q/fc/p/q per contrast in
gx.meta, with no avg.0/avg.1. .de_gene_table() passed the resulting
zero-length vectors to data.frame(), which failed with "arguments imply
differing number of rows: 50, 0" and stopped every AI Studio report on such
a dataset before any model call.

The avg_first/avg_second columns are now left out when the group means are
absent; newer PGX files render the same table as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 07396ffb-d464-4eba-aa23-8846d0b49d34

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ESCRI11

ESCRI11 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Merging with the unittest check red. The job fails at "Update documentation", before any test runs: devtools::document() in the CI image bigomics/omicsplayground:devel stops with The package "playbase.annotation" is required, because that image does not have playbase.annotation installed. #565 failed at the same step.

Checked outside CI instead:

  • the new .de_gene_table test errors on fanta and passes on this branch;
  • the monorepo's compute_ai_studio_report_context() with this branch's helper bundle builds the DE evidence for a PGX without avg.0/avg.1 (the previous bundle fails with differing number of rows: 50, 0), and current PGX files keep avg_first/avg_second;
  • the monorepo's compute-light build installs this bundle and passes its helper health check.

@ESCRI11
ESCRI11 merged commit 243ed52 into fanta Dec 1, 2026
1 of 2 checks passed
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