Skip to content

Classify PySB model entities - #657

Draft
dweindl wants to merge 1 commit into
PEtab-dev:mainfrom
dweindl:model-entities-pysb
Draft

dweindl wants to merge 1 commit into
PEtab-dev:mainfrom
dweindl:model-entities-pysb

Conversation

@dweindl

@dweindl dweindl commented Dec 3, 2026

Copy link
Copy Markdown
Member

Implement the private entity classification (_iter_entities) for PySB models.

Components are classified by their type: parameters and compartments are constant; observables and global expressions are algebraic quantities; monomers, rules, tags, and local expressions are not quantities.

Species are classified by their pattern: a pattern with all sites of all monomers specified and all bonds paired is a species, whether or not the model's rules generate it, and independently of network generation. In a model with compartments, the pattern has to specify the compartment, as PySB requires for initial conditions. Species are constant if they have a fixed initial condition (compared by pattern equivalence), and differential otherwise.

Validation does not change yet: PySB species can only be referred to via mapping-table aliases, which CheckModelEntityEligibility does not resolve yet, and all other condition targets and parameter-table entries that the other validation tasks accept are constant. Alias resolution will follow in a separate PR.

Relates to #518.

🤖 Generated with Claude Code

Implement the private entity classification for PySB models: components
by their type, and species by their pattern. A pattern with all sites of
all monomers specified and all bonds paired is a species, whether or not
the model's rules generate it; in a model with compartments, it has to
specify the compartment, as PySB requires for initial conditions.
Species are constant if they have a fixed initial condition, and
differential otherwise.

Validation does not change yet: PySB species can only be referred to via
mapping-table aliases, which `CheckModelEntityEligibility` does not
resolve, and all other condition targets and parameter-table entries
that the other validation tasks accept are constant.

Relates to PEtab-dev#518.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.52%. Comparing base (b694a77) to head (3a07855).

Files with missing lines Patch % Lines
petab/_models/pysb_model.py 95.74% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #657      +/-   ##
==========================================
+ Coverage   81.45%   81.52%   +0.07%     
==========================================
  Files          76       76              
  Lines        8906     8942      +36     
  Branches     1631     1639       +8     
==========================================
+ Hits         7254     7290      +36     
  Misses       1171     1171              
  Partials      481      481              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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