Skip to content

Move stage definition to workflow - #98

Open
Aratz wants to merge 3 commits into
mainfrom
feature/register_workflow_stages
Open

Move stage definition to workflow#98
Aratz wants to merge 3 commits into
mainfrom
feature/register_workflow_stages

Conversation

@Aratz

@Aratz Aratz commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This PR lets each workflow define its own stages. This is then used downstream to determine which files to expect and populate the es_data.

Description

Describe the change.

Fixes: PNA-3323

Type of change

  • Bug fix
  • New feature
  • Breaking change

How Has This Been Tested?

Unit tests were run

PR checklist:

  • I have run R CMD check on the package and it passes.
  • I have made changes to the documentation.
  • I have added tests.
  • I have documented any significant changes in CHANGELOG.md

Note

Medium Risk
Breaking public API: register_es_data_workflow(), find_stage(), get_file_paths(), and extract_sample_qc_metrics() now require a stages argument, so extension packages and existing callers will fail until they pass a vocabulary.

Overview
Breaking: pipeline stages are no longer package globals. Each workflow must register a stages factory (all, pool, pxl_preference), stored on es_data$stages and retrieved with get_es_workflow_stages().

find_stage(), get_file_paths(), and extract_sample_qc_metrics() now take a required stages argument (no default), so discovery cannot inherit another workflow’s vocabulary. PXL preference and pool-level QC routing come from that list; the collapse-shard QC filter only runs if collapse is in all.

The built-in amplicon_demux factories (extractors, report, stages) move to workflow_amplicon_demux.R. Registration validates the vocabulary (subsets of all, unique names, empty pool allowed). Downstream callers and tests pass es_data$stages or get_es_workflow_stages("amplicon_demux").

Reviewed by Cursor Bugbot for commit 21755e1. Bugbot is set up for automated code reviews on this repo. Configure here.

@Aratz Aratz self-assigned this Aug 24, 2026
@Aratz
Aratz requested a review from maxkarlsson August 24, 2026 09:13
@Aratz
Aratz marked this pull request as ready for review August 24, 2026 09:13

@maxkarlsson maxkarlsson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good to me 🎉
Some minor comments, just to remove a bloat test file.

Really appreciate your work on this 🙏

Comment thread R/components.R
sample_levels <- es_data$sample_aliases

plot_data <-
extract_sample_qc_metrics(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note for the future: This extraction function should be updated to fit the new data ingestion better. But that is something we should do in a future PR

@@ -0,0 +1,3 @@
amplicon_stages <- function() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this file is needed 😮 I think we can do without it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to use get_es_workflow_stages("amplicon_demux") instead

#' @return A nested named list of functions.
#'
#' @noRd
.amplicon_demux_extractors <- function() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is good that you moved these functions to their own file 👍

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