galaxyproject / galaxyproject/brc-analytics

Stepper: organism (species) picker when an organism-scoped workflow's taxonomyId is a clade above species

Open
#1,397 0 comments 1 reaction 1 assignee Claimed by @frano-m View on GitHub
Dominant language
TypeScript
Stars
7
Forks
11
Avg merge
2d 12h
Merged PRs (30d)
16

Description

Sub-issue of #1200 (Epic: Support Organism-Scoped Workflows with Collection Inputs). Follow-on to #1381 / #1349.

### Context

#1381 anchors the organism-scoped workflow stepper (workflow-first entry, `WorkflowView` at `/data/workflows/[trsId]`) on the **workflow's own `taxonomyId`**. When that taxon resolves to a single catalog organism — e.g. influenza (`taxonomyId: 11320`) — the stepper prepopulates the organism context, the ENA read-run picker, and the Organism Details panel.

But a `scope: ORGANISM` workflow can declare a `taxonomyId` that is a **clade — a node above species** (e.g. Viruses `10239`). There's then no single catalog organism to anchor on. Per #1381, `WorkflowView` resolves to *no* organism (matched over `getOrganisms()` so it doesn't crash) and silently falls back to the bare accession path — the user gets no organism context and no way to scope the run to the species they actually mean.

### Goal

When an organism-scoped workflow's `taxonomyId` is a clade above species, present an **organism (species) picker** so the user chooses a specific species within that clade. The picker sits **before the ENA read-run step and constrains it**: after selection, the picked species' taxon anchors the `WorkflowEntity` context (→ scopes the live ENA read-run count/picker to that species) and populates the Organism Details panel — exactly as #1381's prepopulated-species case.

### Approach

There is **no existing organism/species picker to reuse** — selection in the stepper today is per-assembly. The pattern to model after is the reference-assembly selector dialog:

- `ReferenceAssemblyStep` → `AssemblyData` → `AssemblySelector` — a `StyledDialog` with `ColumnFilters` + a filterable `Table` (`UseTable` hook), `DataSelector` as the "Browse" trigger, `AssemblySummary` for the chosen row.
(`app/components/Entity/.../Stepper/components/Step/ReferenceAssemblyStep/…`)

Build a species equivalent (e.g. `OrganismSelector` / a species step, wired through `Stepper/steps/constants.ts`, placed **before the ENA read-run step**) that:

- Lists **catalog organisms only** (`getOrganisms()`) that are descendants of the workflow's clade taxon, via **lineage membership** — i.e. organisms whose `lineageTaxonomyIds` contains the clade taxon. This mirrors the existing assembly behavior, where `getInitialColumnFilters` pushes `workflow.taxonomyId` into the `LINEAGE_TAXONOMY_IDS` filter (`.../AssemblySelector/hooks/UseTable/utils.ts`). Membership, not a recursive subtree walk — consistent with how clade scoping is approximated elsewhere (#1328 lineage index; catalog query design notes).
- Lets the user filter and select one species, mirroring `AssemblySelector` UX.
- On selection, sets the resolved organism into the `WorkflowEntity` context so the **ENA read-run step is constrained to the chosen species' taxon** and the Organism Details panel populates — identical end state to #1381's prepopulated path.

### Acceptance criteria

- [ ] For a `scope: ORGANISM` workflow whose `taxonomyId` is a clade above species (no single catalog organism), the stepper shows an organism/species picker step instead of silently falling back to the bare accession path.
- [ ] The picker sits **before the ENA read-run step**; selecting a species **constrains the ENA read-run picker** to that species' taxon.
- [ ] The picker lists **catalog organisms only**, filtered by **lineage membership** (organisms whose `lineageTaxonomyIds` contains the workflow's clade taxon).
- [ ] Selecting a species anchors the `WorkflowEntity` context and populates the Organism Details panel — same end state as #1381's prepopulated case.
- [ ] Workflows whose `taxonomyId` already resolves to a single catalog organism (e.g. influenza) keep prepopulating and **do not** show the picker.
- [ ] Assembly-scoped and no-`taxonomyId` workflows are unaffected.
- [ ] A test case is added for the clade path (no clade-scoped workflow is exposed today — influenza is the only `scope: ORGANISM` workflow with a `taxonomyId` — so this includes a fixture/example workflow to exercise it).
- [ ] `tsc --noEmit`, `next lint`, `prettier --check`, `npm test` all pass.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.