Skip to content

Normalize pgx$organism values (Human/human/Homo sapiens etc. all coexist) #522

Description

@ivokwee

Problem

pgx$organism is stored un-normalized across the fleet: existing datasets carry "Human", "human", "Homo sapiens", "Mouse", "mouse", "Mus musculus", etc. as distinct strings rather than a canonical value.

This breaks any exact-match check against organism, most concretely:

# R/pgx-compute.R:1170
species_go <- !(pgx$organism %in% c("Human", "Mouse", "Rat"))

A dataset labeled "Homo sapiens" (rather than "Human") takes the TRUE branch and pays for a full AnnotationHub GO download it shouldn't need. The same fragility likely affects other pgx$organism %in% c(...) checks throughout the codebase (e.g. pgx-init.R, correlation_table_corr.R, compare_server.R in omicsplayground).

Origin

Flagged by @phisanti in review of bigomics/omicsplayground#1891 (companion PR to #520), while live-testing dataset loads against the real fleet:

Source organism: yes. pgx$organism (pgx-compute.R:422), on all 52, mirrored in datasets-info.csv. But it's stored un-normalised — the fleet has "Human", "human", "Homo sapiens", "Mouse", "mouse", "Mus musculus" as distinct strings. That's exactly what breaks species_go <- !(pgx$organism %in% c("Human","Mouse","Rat")) at pgx-compute.R:1170: "Homo sapiens" takes the TRUE branch and pays a full AnnotationHub GO download.

Suggested fix

  • Add a canonicalization step (e.g. in pgx.initialize() or pgx.getOrganism()) that maps known aliases/scientific names to the canonical display form used throughout the codebase ("Human", "Mouse", "Rat", ...).
  • Audit pgx$organism %in% c(...) call sites across both playbase and omicsplayground for the same fragility.
  • Consider whether existing .pgx files / datasets-info.csv need a one-time backfill, or whether normalizing on load is sufficient.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NdKjbG6mq44txcD2jbmgid

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions