# How to convert a String to a Reaction/ReactionSystem type (Catalyst.jl)?

**URL:** <https://discourse.julialang.org/t/how-to-convert-a-string-to-a-reaction-reactionsystem-type-catalyst-jl/75377>\
**Category:** Chemistry\
**Tags:** question, package, diffeq\
**Created:** [January 28, 2022, 4:12pm UTC](https://discourse.julialang.org/t/how-to-convert-a-string-to-a-reaction-reactionsystem-type-catalyst-jl/75377 "2022-01-28T16:12:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leticia-maria](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leticia-maria/32/30981_2.png) [@Leticia-maria](https://discourse.julialang.org/u/Leticia-maria)\
**Post date:** [January 28, 2022, 4:12pm UTC](https://discourse.julialang.org/t/how-to-convert-a-string-to-a-reaction-reactionsystem-type-catalyst-jl/75377/1 "2022-01-28T16:12:52Z")

</div>

Hey you all, I wanna use Strings to add reactions to a `@reaction_network` in Catalyst.jl. For example:

```julia
julia> example = @reaction_network empty
julia> addreaction!(example, "k, A --> B")

```

or

```julia
julia> addreaction!(example, "A --> B")

```

---

<div class="post-metadata">

**Author:** ![Leticia-maria](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leticia-maria/32/30981_2.png) [@Leticia-maria](https://discourse.julialang.org/u/Leticia-maria)\
**Post date:** [January 29, 2022, 2:58pm UTC](https://discourse.julialang.org/t/how-to-convert-a-string-to-a-reaction-reactionsystem-type-catalyst-jl/75377/2 "2022-01-29T14:58:18Z")

</div>

I have used parse and eval methods to wrap the string. That’s a temporary solution

```julia
function reaction_network(constants, schemes)
    reactions = String[]

    for (constant, scheme) in zip(constants, schemes)
        push!(reactions, constant*", "*scheme*" \n")
    end 

    network = "@reaction_network begin \n"

    for reaction in reactions
        network *= reaction
    end

    complete_network = network*"end "

    for constant in constants
        complete_network *= constant*" "
    end

    parsed_network = Meta.parse(complete_network)

    rn = eval(parsed_network)    

    return rn
end

```
