Skip to content

Update dev from main branch - #24

Merged
ypriverol merged 20 commits into
devfrom
main
Jul 3, 2026
Merged

Update dev from main branch #24
ypriverol merged 20 commits into
devfrom
main

Conversation

@ypriverol

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to the documentation, deployment workflow, and discoverability of the mokume project. The changes include a complete overhaul of the documentation deployment pipeline, the addition of new overview and reference materials, enhancements for SEO and LLM discovery, and improved navigation and branding for the documentation site. Minor code formatting and docstring clarifications are also included.

Documentation and Discoverability Enhancements

  • Added new overview and reference documents for both general users (docs/llms.txt) and LLMs (docs/llms-full.txt), including installation, usage examples, method descriptions, and citation information. [1] [2]
  • Added a CITATION.cff file to standardize citation information and a CNAME file to configure the custom documentation domain. [1] [2]
  • Added robots.txt to allow web crawlers and LLMs to index the documentation and reference files, improving discoverability.
  • Added Open Graph and structured data (JSON-LD) to the documentation homepage for improved SEO and sharing.

Documentation Site Structure and Theming

  • Updated mkdocs.yml to reorganize navigation, add a custom theme, inject analytics, and include custom CSS for branding. [1] [2] [3]
  • Added a custom footer with quantms ecosystem links and branding to the documentation site.

Deployment Workflow Improvements

  • Replaced the legacy documentation deployment workflow with a modern, two-stage GitHub Actions pipeline: building docs on all branches and deploying to GitHub Pages only from main, with improved permissions and concurrency control.

Minor Documentation and Code Updates

  • Clarified differential expression analysis docstrings and improved code formatting for readability in differential_expression.py. [1] [2] [3] [4] [5] [6] [7]
  • Removed an unused import from the Python API reference documentation.

References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]

ypriverol and others added 20 commits March 16, 2026 14:13
Major changes including differential expression module
Same deployment approach as pmultiqc and qpx.
Deploys on push to main when docs/ or mkdocs.yml change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ci: switch to GitHub Actions Pages deployment
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ne discoverability

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace [tool.poetry] with standard [project] table, hatchling build
backend, and hatch-vcs for version management from git tags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 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

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eff5e4a6-0c1c-437e-b891-ab603de75d60

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch main

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

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 3 high · 2 medium · 95 minor

Alerts:
⚠ 100 issues (≤ 0 issues of at least minor severity)

Results:
100 new issues

Category Results
Documentation 94 minor
ErrorProne 3 high
Security 2 medium
CodeStyle 1 minor

View in Codacy

🟢 Metrics 569 complexity · 4 duplication

Metric Results
Complexity 569
Duplication 4

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add QpxDataset pipeline core; modernize docs and Pages deployment

✨ Enhancement 📝 Documentation ⚙️ Configuration changes 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Introduce QpxDataset container with DuckDB lazy loading and schema validation.
• Add plugin-driven pipeline flows, normalization/harmonization/imputation/export modules, and
 tests.
• Revamp MkDocs site, improve SEO/LLM discovery, and deploy docs via GitHub Pages.
Diagram

graph TD
  runner["Pipeline runner"] --> registry["PluginRegistry"] --> flows["Flow modules"] --> dataset["QpxDataset"] --> lazy["LazyFrame"] --> duck[("DuckDB")]
  flows --> qpx{{"qpx lib"}}
  subgraph Legend
    direction LR
    _mod["Module"] ~~~ _db[("Database")] ~~~ _ext{{"External"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Rely on qpx.Dataset end-to-end (no custom QpxDataset/LazyFrame)
  • ➕ Less bespoke data-model code to maintain
  • ➕ Avoids duplicate schema/serialization concerns
  • ➖ Harder to attach mokume-specific layers/uns/provenance consistently
  • ➖ Less control over lazy/eager behavior and API stability across qpx versions
2. Keep Poetry build backend instead of migrating to Hatch/PEP 621
  • ➕ Avoids tooling migration churn for contributors already invested in Poetry
  • ➕ May simplify existing release processes if Poetry is used downstream
  • ➖ Less standard metadata surface for broader tooling interoperability
  • ➖ VCS-derived versioning is typically cleaner with hatch-vcs than Poetry-only setups
3. Use mkdocs gh-deploy instead of GitHub Pages actions
  • ➕ Simpler YAML and fewer GitHub Pages primitives
  • ➕ No artifacts step; direct push to gh-pages
  • ➖ Requires branch write permissions and gh-pages management
  • ➖ Less aligned with GitHub’s recommended Pages deployment model/permissions tightening

Recommendation: The PR’s overall direction is sound: a mokume-native QpxDataset plus plugin/flow dispatch cleanly separates ingestion (qpx), computation, and export while enabling lazy scaling via DuckDB. The Pages actions-based deployment and PEP 621 metadata migration are maintainable long-term choices; validate versioning/release expectations (tags, hatch-vcs) before cutting a release.

Files changed (41) +5676 / -174

Enhancement (27) +4609 / -60
differential_expression.pyClarify DE behavior and consolidate result finalization +50/-21

Clarify DE behavior and consolidate result finalization

• Adds option validation and clearer semantics around FDR handling (preserving LimROTS adj_pvalue vs applying BH/IHW for others). Centralizes significance classification/sorting and improves logging.

mokume/analysis/differential_expression.py

dataset.pyIntroduce QpxDataset hierarchical container with lazy/eager levels +941/-0

Introduce QpxDataset hierarchical container with lazy/eager levels

• Adds the core QpxDataset abstraction for psms/features/peptides/proteins plus sample/protein metadata, layers, and uns/provenance. Supports DuckDB-lazy levels, schema validation without full materialization, serialization roundtrips, and convenience transforms (wide matrix, peptide/protein maps).

mokume/core/dataset.py

duckdb_backend.pyAdd DuckDB LazyFrame wrapper for parquet-backed lazy operations +351/-0

Add DuckDB LazyFrame wrapper for parquet-backed lazy operations

• Introduces LazyFrame as a wrapper around DuckDB relations, supporting parquet/SQL/dataframe sources, lazy ops (filter/select), and explicit materialization to pandas.

mokume/core/duckdb_backend.py

registry.pyAdd PluginRegistry for decorators, entry points, and TopN patterns +297/-0

Add PluginRegistry for decorators, entry points, and TopN patterns

• Implements a central registry for extension groups (quantification/normalization/harmonization/imputation/filter). Adds instance factories, entry-point discovery, TopN name parsing, and input_level validation for quantification methods.

mokume/core/registry.py

schema.pyCentralize per-level required columns and schema validation +120/-0

Centralize per-level required columns and schema validation

• Defines required column sets for features/peptides/proteins/psms and provides validate_schema helpers used by QpxDataset and pipeline flows.

mokume/core/schema.py

__init__.pyExpose export subpackage surface +17/-0

Expose export subpackage surface

• Adds export package initialization to make CSV/AnnData utilities importable from a stable namespace.

mokume/export/init.py

anndata.pyAdd AnnData export helpers for DataFrames and QpxDataset +101/-0

Add AnnData export helpers for DataFrames and QpxDataset

• Provides convenience wrappers to create AnnData from long-format data or directly from QpxDataset levels, with mokume defaults for obs/var naming.

mokume/export/anndata.py

csv.pyAdd CSV/TSV export helpers for wide and long formats +118/-0

Add CSV/TSV export helpers for wide and long formats

• Implements reusable exporters for wide protein×sample matrices and long tables, plus a QpxDataset-level export wrapper.

mokume/export/csv.py

__init__.pyAdd harmonization package entry point +46/-0

Add harmonization package entry point

• Introduces the harmonization package namespace for batch correction methods and plugin discovery wiring.

mokume/harmonization/init.py

base.pyDefine harmonization method interfaces +65/-0

Define harmonization method interfaces

• Adds base abstractions to standardize batch correction method implementations and integration points.

mokume/harmonization/base.py

combat.pyAdd ComBat harmonization implementation wiring +78/-0

Add ComBat harmonization implementation wiring

• Adds a ComBat-based harmonization method suitable for pipeline selection and plugin registration.

mokume/harmonization/combat.py

correction.pyAdd batch detection and batch correction utilities +477/-0

Add batch detection and batch correction utilities

• Implements batch detection strategies (prefix/run/fraction/techrep/explicit column), SDRF covariate extraction, and dependency checks/orchestration for correction workflows.

mokume/harmonization/correction.py

models.pyAdd harmonization configuration models/enums +127/-0

Add harmonization configuration models/enums

• Adds model types (e.g., BatchDetectionMethod) to configure batch detection and correction behaviors consistently across the pipeline.

mokume/harmonization/models.py

base.pyAdd base interface for imputation plugins +53/-0

Add base interface for imputation plugins

• Defines the imputation method contract used by concrete imputers and the plugin registry.

mokume/imputation/base.py

knn.pyAdd KNN-based imputation method +74/-0

Add KNN-based imputation method

• Implements a KNN imputer and registers it as an imputation plugin for configuration-based selection.

mokume/imputation/knn.py

simple.pyAdd SimpleImputer-based imputation strategies +91/-0

Add SimpleImputer-based imputation strategies

• Wraps sklearn SimpleImputer strategies (mean/median/most_frequent/constant) under mokume’s interface and registers each strategy via PluginRegistry.

mokume/imputation/simple.py

qpx_adapter.pyAdd qpx adapter to map QPX structures into mokume columns +363/-0

Add qpx adapter to map QPX structures into mokume columns

• Adds an adapter layer that delegates reading to qpx while mapping column names and defaulting missing fields for algorithm compatibility. Supports sample iteration, median maps, metadata access, and inference helpers.

mokume/io/qpx_adapter.py

base.pyAdd base classes for feature- and sample-level normalization +212/-0

Add base classes for feature- and sample-level normalization

• Defines abstract base classes and shared orchestration for normalization methods, including dataset-level vs per-sample behavior and plugin registration guidance.

mokume/normalization/base.py

feature_normalizers.pyAdd concrete feature-level normalizers +100/-0

Add concrete feature-level normalizers

• Introduces within-run normalization implementations and registers them for plugin-based discovery.

mokume/normalization/feature_normalizers.py

sample_normalizers.pyAdd concrete sample-level normalizers +251/-0

Add concrete sample-level normalizers

• Introduces across-sample normalization implementations (including dataset-level strategies) and registers them for pipeline selection.

mokume/normalization/sample_normalizers.py

__init__.pyAdd pipeline flows package for dispatch +14/-0

Add pipeline flows package for dispatch

• Creates the flows package surface so the runner can dispatch by input_level to standard/ratio/directlfq flows.

mokume/pipeline/flows/init.py

directlfq.pyAdd DirectLFQ pipeline flow +108/-0

Add DirectLFQ pipeline flow

• Implements a DirectLFQ-specific flow that loads/filters, converts to DirectLFQ input format, runs DirectLFQ normalization/estimation, and returns protein outputs in QpxDataset.

mokume/pipeline/flows/directlfq.py

ratio.pyAdd ratio (TMT) pipeline flow +91/-0

Add ratio (TMT) pipeline flow

• Adds a dedicated flow for ratio quantification from PSM-level inputs and integration with runner dispatch.

mokume/pipeline/flows/ratio.py

standard.pyAdd standard peptide-level pipeline flow +79/-0

Add standard peptide-level pipeline flow

• Implements the peptide-level quantification flow used by iBAQ/TopN/sum/median methods, including schema validation warnings and provenance recording.

mokume/pipeline/flows/standard.py

runner.pyAdd method-driven flow dispatch and shared post-processing +231/-0

Add method-driven flow dispatch and shared post-processing

• Adds run_pipeline to resolve quantification methods via PluginRegistry and dispatch by method input_level. Implements shared post-processing (IRS, coverage filtering, batch correction, differential expression, plots/reports) and optional AnnData export behavior.

mokume/pipeline/runner.py

stages.pyRefine pipeline stage implementations for new flow model +71/-39

Refine pipeline stage implementations for new flow model

• Updates pipeline stages to support flow-driven orchestration and expanded capabilities across loading/normalization/quantification/post-processing.

mokume/pipeline/stages.py

median.pyAdd median-based protein quantification method +83/-0

Add median-based protein quantification method

• Implements a median aggregation quantification method for proteins and registers it via PluginRegistry. Supports optional run-level grouping when a run column is present.

mokume/quantification/median.py

Tests (3) +624 / -0
test_cecilia_integration.pyAdd integration test coverage for pipeline interoperability +238/-0

Add integration test coverage for pipeline interoperability

• Adds an integration-style test exercising a realistic workflow to validate end-to-end interactions across components.

tests/test_cecilia_integration.py

test_dataset.pyAdd unit tests for QpxDataset behaviors and serialization +222/-0

Add unit tests for QpxDataset behaviors and serialization

• Adds tests for level access, schema validation, wide-matrix conversion, subsetting, save/load roundtrips (including layers), and provenance step recording.

tests/test_dataset.py

test_registry.pyAdd unit tests for PluginRegistry registration and validation +164/-0

Add unit tests for PluginRegistry registration and validation

• Adds tests for decorator/factory registration, error handling, available() ordering, reset behavior, and enforcement of valid quantification input_level values.

tests/test_registry.py

Documentation (6) +319 / -3
CITATION.cffAdd standardized citation metadata for GitHub’s cite button +27/-0

Add standardized citation metadata for GitHub’s cite button

• Introduces a CITATION.cff describing the project and preferred citation. Improves scholarly attribution and makes citation export consistent across tooling.

CITATION.cff

llms-full.txtAdd LLM-oriented full reference guide +138/-0

Add LLM-oriented full reference guide

• Adds a detailed single-file reference covering CLI usage, Python API examples, method descriptions, and troubleshooting. Intended for LLM ingestion and deep linking.

docs/llms-full.txt

llms.txtAdd short LLM/tool discovery overview +44/-0

Add short LLM/tool discovery overview

• Adds a concise project overview with capabilities, recommendation guidance, docs links, and citation. Improves LLM and search discovery.

docs/llms.txt

main.htmlAdd homepage SEO metadata and quantms-branded footer override +95/-0

Add homepage SEO metadata and quantms-branded footer override

• Adds OpenGraph social preview and JSON-LD structured data for indexing/sharing. Overrides the MkDocs Material footer to include quantms ecosystem navigation and branding.

docs/overrides/main.html

python-api.mdFix Python API docs snippet by removing unused import +1/-3

Fix Python API docs snippet by removing unused import

• Removes an unused import and related snippet lines in the imputation utilities example.

docs/reference/python-api.md

robots.txtAllow crawling and explicitly expose llms discovery endpoints +14/-0

Allow crawling and explicitly expose llms discovery endpoints

• Adds robots.txt allowing indexing and pointing to sitemap.xml, while explicitly permitting /llms.txt and /llms-full.txt for common LLM crawlers.

docs/robots.txt

Other (5) +124 / -111
deploy-docs.ymlSplit docs build and GitHub Pages deploy with safer permissions +47/-20

Split docs build and GitHub Pages deploy with safer permissions

• Updates docs CI to build on PRs and doc-related pushes, while only deploying from main. Switches to official GitHub Pages actions (configure/upload/deploy), tightens permissions, adds path filters, and introduces Pages concurrency controls.

.github/workflows/deploy-docs.yml

CNAMEConfigure custom domain for GitHub Pages documentation site +1/-0

Configure custom domain for GitHub Pages documentation site

• Adds the GitHub Pages CNAME entry to publish docs at mokume.quantms.org.

CNAME

mkdocs.ymlReorganize docs navigation and add theme overrides + analytics +16/-11

Reorganize docs navigation and add theme overrides + analytics

• Reworks nav structure/labels, enables template overrides, and injects shared quantms theme CSS. Adds Google Analytics configuration and adjusts Material palette/features.

mkdocs.yml

pyproject.tomlMigrate packaging to PEP 621 + Hatch and enrich project metadata +59/-80

Migrate packaging to PEP 621 + Hatch and enrich project metadata

• Replaces Poetry metadata with PEP 621 [project] metadata and switches build backend to hatchling + hatch-vcs (dynamic versioning). Adds/cleans project URLs, expands keywords, and reorganizes optional dependency groups (including a dev extra).

pyproject.toml

IRS_normalizationAdd temporary IRS normalization artifact +1/-0

Add temporary IRS normalization artifact

• Adds a tmp file related to IRS normalization. If not required for runtime/tests, consider removing or relocating to fixtures.

tmp/IRS_normalization

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Bad QuantificationMethod import 🐞 Bug ≡ Correctness
Description
Several new modules import QuantificationMethod from mokume.quantification.base, but that module
only defines ProteinQuantificationMethod, so importing mokume.pipeline.runner /
mokume.pipeline.flows.* / mokume.quantification.median will raise ImportError.
Code

mokume/pipeline/runner.py[19]

+from mokume.quantification.base import QuantificationMethod
Evidence
mokume.pipeline.runner (and other newly added modules) imports QuantificationMethod, but
mokume.quantification.base defines only ProteinQuantificationMethod, so the import target does
not exist and will fail at module import time.

mokume/pipeline/runner.py[14-20]
mokume/quantification/base.py[21-40]
mokume/quantification/median.py[10-24]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
New pipeline/flow code imports `QuantificationMethod` from `mokume.quantification.base`, but `base.py` defines `ProteinQuantificationMethod` only. This causes immediate `ImportError` when importing the new runner/flows/median module.

## Issue Context
This PR introduces `mokume/pipeline/runner.py`, `mokume/pipeline/flows/*`, and `mokume/quantification/median.py`, all of which currently import a non-existent symbol.

## Fix Focus Areas
- mokume/quantification/base.py[21-60]
- mokume/pipeline/runner.py[12-22]
- mokume/pipeline/flows/standard.py[16-32]
- mokume/pipeline/flows/ratio.py[16-26]
- mokume/pipeline/flows/directlfq.py[16-26]
- mokume/quantification/median.py[8-25]

## Suggested fix
- In `mokume/quantification/base.py`, either:
 - Rename `ProteinQuantificationMethod` -> `QuantificationMethod`, or
 - Add a backward-compatible alias: `QuantificationMethod = ProteinQuantificationMethod` (and consider exporting it in `__all__`).
- Update the new runner/flows/median modules to consistently import the correct base type (either the renamed class or the alias).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. input_level attribute missing 🐞 Bug ≡ Correctness
Description
run_pipeline() dispatches with method.input_level, but neither the quantification base class nor
the provided quantification implementations define input_level, so the runner will raise
AttributeError before it can select a flow.
Code

mokume/pipeline/runner.py[59]

+    flow = FLOW_DISPATCH.get(method.input_level)
Evidence
The runner dereferences method.input_level, but the quantification base class does not define it
and the median quantification implementation also omits it, so dispatch will crash even if imports
are fixed.

mokume/pipeline/runner.py[49-64]
mokume/quantification/base.py[25-50]
mokume/quantification/median.py[22-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`mokume/pipeline/runner.py` dispatches flows via `method.input_level`, but quantification methods do not define this attribute/property, causing `AttributeError` at runtime.

## Issue Context
The registry currently validates `input_level` only if it exists (`hasattr(instance, "input_level")`), but the runner assumes it always exists.

## Fix Focus Areas
- mokume/pipeline/runner.py[49-67]
- mokume/quantification/base.py[25-80]
- mokume/core/registry.py[181-190]
- mokume/quantification/median.py[22-40]

## Suggested fix
- Make `input_level` part of the quantification method contract by adding it to the base class (e.g., abstract `@property def input_level(self) -> str` or a required class attribute).
- Update built-in/registered quantification plugins (at minimum `MedianQuantification`) to define `input_level` (likely `"peptides"`).
- Consider tightening `PluginRegistry.get()` validation for quantification plugins to always require `input_level` (remove the `hasattr` guard) so misconfigured plugins fail fast with a clear error message.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. DataFrame not registered 🐞 Bug ≡ Correctness
Description
LazyFrame.from_dataframe() runs SELECT * FROM df without registering the passed DataFrame into
DuckDB, so it will fail because the connection has no table named df. This makes the advertised
constructor unusable.
Code

mokume/core/duckdb_backend.py[R150-152]

+        # Use DuckDB's ability to query DataFrames directly
+        relation = connection.sql("SELECT * FROM df")
+        return cls(relation, connection, source="dataframe", owns_connection=owns)
Evidence
The implementation executes SQL against a table name df but never registers the provided
DataFrame; a separate module demonstrates the expected pattern of calling register() before
querying.

mokume/core/duckdb_backend.py[124-152]
mokume/io/feature.py[263-279]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`LazyFrame.from_dataframe()` claims it registers the DataFrame as a DuckDB temp table, but it never does; it just executes `SELECT * FROM df`. Unless DuckDB replacement-scan magically binds that local variable (not guaranteed and often not true for connection-scoped queries), this will raise a catalog/table-not-found error.

## Issue Context
Elsewhere in the codebase, DataFrames are explicitly registered into DuckDB connections before being used in SQL.

## Fix Focus Areas
- mokume/core/duckdb_backend.py[124-153]
- mokume/io/feature.py[263-279]

## Suggested fix
- In `LazyFrame.from_dataframe`, explicitly register the DataFrame with the connection, e.g.:
 - `connection.register("_mokume_df", df)` then `relation = connection.sql("SELECT * FROM _mokume_df")`, or
 - Use DuckDB’s DataFrame-to-relation API if available on the connection/version (and avoid relying on implicit variable binding).
- Optionally unregister/replace the temp name to avoid collisions if `from_dataframe` is called multiple times on the same connection.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread mokume/pipeline/runner.py
from mokume.core.registry import PluginRegistry
from mokume.pipeline.config import PipelineConfig
from mokume.pipeline import flows
from mokume.quantification.base import QuantificationMethod

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Bad quantificationmethod import 🐞 Bug ≡ Correctness

Several new modules import QuantificationMethod from mokume.quantification.base, but that module
only defines ProteinQuantificationMethod, so importing mokume.pipeline.runner /
mokume.pipeline.flows.* / mokume.quantification.median will raise ImportError.
Agent Prompt
## Issue description
New pipeline/flow code imports `QuantificationMethod` from `mokume.quantification.base`, but `base.py` defines `ProteinQuantificationMethod` only. This causes immediate `ImportError` when importing the new runner/flows/median module.

## Issue Context
This PR introduces `mokume/pipeline/runner.py`, `mokume/pipeline/flows/*`, and `mokume/quantification/median.py`, all of which currently import a non-existent symbol.

## Fix Focus Areas
- mokume/quantification/base.py[21-60]
- mokume/pipeline/runner.py[12-22]
- mokume/pipeline/flows/standard.py[16-32]
- mokume/pipeline/flows/ratio.py[16-26]
- mokume/pipeline/flows/directlfq.py[16-26]
- mokume/quantification/median.py[8-25]

## Suggested fix
- In `mokume/quantification/base.py`, either:
  - Rename `ProteinQuantificationMethod` -> `QuantificationMethod`, or
  - Add a backward-compatible alias: `QuantificationMethod = ProteinQuantificationMethod` (and consider exporting it in `__all__`).
- Update the new runner/flows/median modules to consistently import the correct base type (either the renamed class or the alias).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread mokume/pipeline/runner.py
method = PluginRegistry.get("quantification", quant_method_name)

# Select flow based on method's declared input_level
flow = FLOW_DISPATCH.get(method.input_level)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Input_level attribute missing 🐞 Bug ≡ Correctness

run_pipeline() dispatches with method.input_level, but neither the quantification base class nor
the provided quantification implementations define input_level, so the runner will raise
AttributeError before it can select a flow.
Agent Prompt
## Issue description
`mokume/pipeline/runner.py` dispatches flows via `method.input_level`, but quantification methods do not define this attribute/property, causing `AttributeError` at runtime.

## Issue Context
The registry currently validates `input_level` only if it exists (`hasattr(instance, "input_level")`), but the runner assumes it always exists.

## Fix Focus Areas
- mokume/pipeline/runner.py[49-67]
- mokume/quantification/base.py[25-80]
- mokume/core/registry.py[181-190]
- mokume/quantification/median.py[22-40]

## Suggested fix
- Make `input_level` part of the quantification method contract by adding it to the base class (e.g., abstract `@property def input_level(self) -> str` or a required class attribute).
- Update built-in/registered quantification plugins (at minimum `MedianQuantification`) to define `input_level` (likely `"peptides"`).
- Consider tightening `PluginRegistry.get()` validation for quantification plugins to always require `input_level` (remove the `hasattr` guard) so misconfigured plugins fail fast with a clear error message.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +150 to +152
# Use DuckDB's ability to query DataFrames directly
relation = connection.sql("SELECT * FROM df")
return cls(relation, connection, source="dataframe", owns_connection=owns)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Dataframe not registered 🐞 Bug ≡ Correctness

LazyFrame.from_dataframe() runs SELECT * FROM df without registering the passed DataFrame into
DuckDB, so it will fail because the connection has no table named df. This makes the advertised
constructor unusable.
Agent Prompt
## Issue description
`LazyFrame.from_dataframe()` claims it registers the DataFrame as a DuckDB temp table, but it never does; it just executes `SELECT * FROM df`. Unless DuckDB replacement-scan magically binds that local variable (not guaranteed and often not true for connection-scoped queries), this will raise a catalog/table-not-found error.

## Issue Context
Elsewhere in the codebase, DataFrames are explicitly registered into DuckDB connections before being used in SQL.

## Fix Focus Areas
- mokume/core/duckdb_backend.py[124-153]
- mokume/io/feature.py[263-279]

## Suggested fix
- In `LazyFrame.from_dataframe`, explicitly register the DataFrame with the connection, e.g.:
  - `connection.register("_mokume_df", df)` then `relation = connection.sql("SELECT * FROM _mokume_df")`, or
  - Use DuckDB’s DataFrame-to-relation API if available on the connection/version (and avoid relying on implicit variable binding).
- Optionally unregister/replace the temp name to avoid collisions if `from_dataframe` is called multiple times on the same connection.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@ypriverol
ypriverol merged commit d267a9e into dev Jul 3, 2026
6 of 10 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.

2 participants