Skip to content

species that only appear within observables #1314

@isaacsas

Description

@isaacsas

I feel like this should error or auto-discover but it goes through ok and results in a system that does not have species_A2 as a variable or species:

function model()
          t = default_t() # i have to add this, otherwise it throws error
          
          @species begin
                species_A1(t)
                species_A2(t)
          end

          @parameters begin
                p1
                p2
          end

          A_rate = p1 * species_A1
          B_rate = p2 * p1 * species_A1
          
          rn = @reaction_network begin

               @combinatoric_ratelaws false

               @observables begin 
                   total_A ~ $species_A1 + $species_A2 
                   Tree ~ $species_A1 * $p1 - $species_A2 * ($p2-$p1) 
               end
               
              $B_rate, B => A
              $A_rate, 0 => A
              
          end
          return rn
       end

Output:

julia> rn = model()
Model ##ReactionSystem#307:
Unknowns (3): see unknowns(##ReactionSystem#307)
  B(t)
  A(t)
  species_A1(t)
Parameters (2): see parameters(##ReactionSystem#307)
  p2
  p1
Observed (2): see observed(##ReactionSystem#307)

julia> unknowns(rn)
3-element Vector{SymbolicUtils.BasicSymbolic{Real}}:
 B(t)
 A(t)
 species_A1(t)

julia> species(rn)
3-element Vector{SymbolicUtils.BasicSymbolic{Real}}:
 B(t)
 A(t)
 species_A1(t)

julia> nonspecies(rn)
SymbolicUtils.BasicSymbolic{Real}[]

julia> observed(rn)
2-element Vector{Equation}:
 total_A(t) ~ species_A2(t) + species_A1(t)
 Tree(t) ~ -(-p1 + p2)*species_A2(t) + p1*species_A1(t)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions