Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to support null species as reactant or product in a reaction? #1

Open
yewalenikhil65 opened this issue Sep 17, 2021 · 1 comment

Comments

@yewalenikhil65
Copy link

how to add a nullspecies in a reaction as a reactant or product ?

@yewalenikhil65
Copy link
Author

how to add a nullspecies in a reaction as a reactant or product ?
i am trying along following lines

using GillesPy2
dnadimer_repressor = GillesPy2.model()
k1 = GillesPy2.parameter("k1", .09)
k2 = GillesPy2.parameter("k2", .05)
k3 = GillesPy2.parameter("k3", .001)
k4 = GillesPy2.parameter("k4", .0009)
k5 = GillesPy2.parameter("k5", .00001)
k6 = GillesPy2.parameter("k6", .0005)
k7 = GillesPy2.parameter("k7", .005)
k8 = GillesPy2.parameter("k8", 0.1)
dnadimer_repressor.add_parameter([k1, k2, k3, k4, k5, k6, k7, k8])
G = GillesPy2.species("G", 1000)
M = GillesPy2.species("M", 0)
P = GillesPy2.species("P", 0)
P2 = GillesPy2.species("P2", 0)
P2G = GillesPy2.species("P2G", 0)
null = GillesPy2.species("null", 0)
dnadimer_repressor.add_species([G, M, P, P2, P2G, null])
r1 = GillesPy2.reaction("k1", Dict(G => 1), Dict(G => 1, M => 1), k1)
r2 = GillesPy2.reaction("k2", Dict(M => 1), Dict(M => 1, P => 1), k2)
r3 = GillesPy2.reaction("k3", Dict(M => 1), Dict(null => 0), k3)
r4 = GillesPy2.reaction("k4", Dict(P => 1), Dict(null => 0), k4)
r5 = GillesPy2.reaction("k5", Dict(P => 2), Dict(P2 => 1), k5)
r6 = GillesPy2.reaction("k6", Dict(P2 => 1), Dict(P => 2), k6)
r7 = GillesPy2.reaction("k7", Dict(P2 => 1, G => 1), Dict(P2G => 1), k7)
r8 = GillesPy2.reaction("k8", Dict(P2G => 1), Dict(P2 => 1, G => 1), k8)
dnadimer_repressor.add_reaction([r1, r2, r3, r4, r5, r6, r7, r8])

this results in a error as follows

ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/chetan/.julia/packages/PyCall/BD546/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'gillespy2.core.gillespyError.ParameterError'>
ParameterError('Error using k1\n\tReactants\n\t\tG: 1\n\tProducts\n\t\tG: 1\n\t\tM: 1\n\tPropensity Function: k1*G as a Reaction. Reason given: Name "k1" is unavailable. A parameter with that name exists.')
  File "/home/chetan/.local/lib/python3.8/site-packages/gillespy2/core/model.py", line 500, in add_reaction
    self.add_reaction(r)
  File "/home/chetan/.local/lib/python3.8/site-packages/gillespy2/core/model.py", line 530, in add_reaction
    raise ParameterError("Error using {} as a Reaction. Reason given: {}".format(reactions, e))

Stacktrace:
  [1] pyerr_check
    @ ~/.julia/packages/PyCall/BD546/src/exception.jl:62 [inlined]
  [2] pyerr_check
    @ ~/.julia/packages/PyCall/BD546/src/exception.jl:66 [inlined]
  [3] _handle_error(msg::String)
    @ PyCall ~/.julia/packages/PyCall/BD546/src/exception.jl:83
  [4] macro expansion
    @ ~/.julia/packages/PyCall/BD546/src/exception.jl:97 [inlined]
  [5] #107
    @ ~/.julia/packages/PyCall/BD546/src/pyfncall.jl:43 [inlined]
  [6] disable_sigint
    @ ./c.jl:458 [inlined]
  [7] __pycall!
    @ ~/.julia/packages/PyCall/BD546/src/pyfncall.jl:42 [inlined]
  [8] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{Vector{PyCall.PyObject}}, nargs::Int64, kw::Ptr{Nothing})
    @ PyCall ~/.julia/packages/PyCall/BD546/src/pyfncall.jl:29
  [9] _pycall!
    @ ~/.julia/packages/PyCall/BD546/src/pyfncall.jl:11 [inlined]
 [10] #_#114
    @ ~/.julia/packages/PyCall/BD546/src/pyfncall.jl:86 [inlined]
 [11] (::PyCall.PyObject)(args::Vector{PyCall.PyObject})
    @ PyCall ~/.julia/packages/PyCall/BD546/src/pyfncall.jl:86
 [12] top-level scope
    @ none:1

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

No branches or pull requests

1 participant