Skip to content

PySBModel.is_state_variable: require compartments for models with compartments #593

Open

Description

@dweindl

PySBModel.is_state_variable checks that all sites are specified (#592), but it accepts species without a compartment even if the model has compartments (e.g., A() in a model with compartment c1). Species of such models always carry a compartment, so these names will never match an actual species. Using pysb.ComplexPattern.is_concrete() instead of MonomerPattern.is_site_concrete() would reject them. This changes behaviour (tests/v1/test_model_pysb.py::test_pysb_model currently asserts is_state_variable("A()") is True for such a model), so it needs a changelog entry.

Possibly related: is_state_variable only checks whether a name is a valid species pattern. It doesn't check whether the model's rules generate that species, or whether all monomers of a complex are connected (A(b=None) % B(a=None) is accepted).

🤖 Generated with Claude Code

Activity

  1. added
    modelsModel abstraction (SBML, PySB)
    v1Affects petab.v1 / PEtab 1.x
    v2Affects petab.v2 / PEtab 2.x
    on Nov 16, 2026
  2. added theissue type on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    modelsModel abstraction (SBML, PySB)v1Affects petab.v1 / PEtab 1.xv2Affects petab.v2 / PEtab 2.x

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions