Repository navigation
Conversation
Tests: add spec-guided TDD support conftest Add tests/conftest.py from the spec-guided-tdd skill, formatted to ProteoPy's black/flake8 standards. It only affects test modules marked `pytestmark = pytest.mark.spec_guided` (e.g. tests/pl/test_upset.py); all other tests run unchanged. - `pytest` (default, CI) runs the holdout and randomized tests and deselects the `_IMP` mirrors - `pytest --implementer` runs the `_IMP` and randomized tests with obscured failure output, for implementation sessions - `--seed N` reproduces randomized inputs (seed printed in the header) - provides the `rng` and `report_input` fixtures - checks test naming and holdout/_IMP pairing
Tests: pl.var_detected_by_cat_upset() Add a spec-guided test suite for var_detected_by_cat_upset() (module marked `spec_guided`, run by tests/conftest.py): - TestVarDetectedByCatUpset: 75 holdout tests plus 9 randomized property and metamorphic tests - TestVarDetectedByCatUpsetIMP: 75 _IMP mirrors on different inputs, run only with `pytest --implementer` Coverage: intersection counts and thresholds (min_count / min_fraction, inclusivity, per-category denominators, empty categories, float edge cases), zero/NaN detection, category order and str coercion, sparse input, non-mutation (incl. views), UpSet construction and rendered axes, print_stats tables (incl. column-name collisions), verbose output, save/show, and argument validation. UpSet calls are observed through spies on the upsetplot class; randomized tests use the seeded rng fixture (reproduce with `--seed N`).
Feature: pl.var_detected_by_cat_upset() Add an UpSet plot of which features (.var) are detected in which categories of an .obs column, e.g. which proteins are found in which tissues. - A feature is a member of a category when it is detected (non-NaN in .X; with zero_to_na=True also non-zero) in enough of that category's observations: min_count (default 1) or min_fraction, inclusive, per category. Setting both raises ValueError. - Features that are members of no category form a "No category" set, always included, also with a count of 0. - Categories follow the default pl order: category order for a Categorical column (unused categories kept), else lexicographic order of the str-coerced values. Values colliding after str coercion raise ValueError. - print_stats prints global, per-intersection and per-category tables; verbose reports the input matrix, threshold and sizes. - Sparse .X is densified with a UserWarning; adata is never modified. - Returns the axes dict of upsetplot's UpSet.plot(). Add upsetplot>=0.9.0,<0.10 as a core dependency. upsetplot 0.9.0 is broken on pandas 3 / numpy >= 2.4, so proteopy.pl.upset patches it on import (dot style defaults, single-category aggregation, count-label positions, all-empty totals warning). The upper bound keeps these patches from hitting an untested upsetplot release. Export via pr.pl, list it under Quality Control in the plotting API docs, and add a HISTORY.md entry.
Collaborator
Author
leventetn
force-pushed
the
feature/var_detected_by_cat_upset
branch
from
October 8, 2026 21:39
bee29ba to
2c85530
Compare
Implemented sort_by with "degree", "cardinality", "-degree" and "-cardinality". New tests cover all modes, equal counts and degrees, repeatability, bar/dot alignment, and invalid inputs.
leventetn
force-pushed
the
feature/var_detected_by_cat_upset
branch
from
October 11, 2026 09:32
2c85530 to
a4164b5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



upset_test_spec.md
upset_function_spec.md