Skip to content

Commit

Permalink
Merge pull request #116 from SciML/pl/updatedocs
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
paulflang authored Mar 8, 2023
2 parents 544e577 + 4da48e2 commit 8a544ec
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
out = Cmd(`git diff`) |> read |> String
if out == ""
exit(0)
else
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ prob = ODEProblem(odesys, [], tspan, [])
sol = solve(prob, Tsit5())
```

Alternatively, we also provide more concise methods to import `SBML.Models`, `Catalyst.ReactionSystems`, and `ModelingToolkit.ODESystems`.
Alternatively, SBMLToolkit also provides more concise methods to import `SBML.Models`, `Catalyst.ReactionSystems`, and `ModelingToolkit.ODESystems`.

```julia
mdl = readSBML(sbmlfile, DefaultImporter())
rs = readSBML(sbmlfile, ReactionSystemImporter())
odesys = readSBML(sbmlfile, ODESystemImporter())
```

## License

The package is released under the [MIT license](https://github.com/SciML/SBMLToolkit.jl/blob/main/LICENSE).
Expand Down
8 changes: 8 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ prob = ODEProblem(odesys, [], tspan, [])
sol = solve(prob, Tsit5())
```

SBMLToolkit also provides the following convenience functions to import `SBML.Models`, `Catalyst.ReactionSystems` and `ModelingToolkit.ODESystems`:

```julia
mdl = readSBML(sbmlfile, DefaultImporter())
rs = readSBML(sbmlfile, ReactionSystemImporter())
odesys = readSBML(sbmlfile, ODESystemImporter())
```

## License

The package is released under the [MIT license](https://github.com/SciML/SBMLToolkit.jl/blob/main/LICENSE).
Expand Down
9 changes: 6 additions & 3 deletions src/systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ Create a `ModelingToolkit.ODESystem` from an SBML file, using default import set
See also [`Model`](@ref) and [`ODESystemImporter`](@ref).
"""
function SBML.readSBML(sbmlfile::String, ::ODESystemImporter; include_zero_odes::Bool=true, kwargs...) # Returns an MTK.ODESystem
convert(ODESystem, readSBML(sbmlfile, ReactionSystemImporter(), kwargs...), include_zero_odes = include_zero_odes)
function SBML.readSBML(sbmlfile::String, ::ODESystemImporter;
include_zero_odes::Bool = true, kwargs...) # Returns an MTK.ODESystem
convert(ODESystem, readSBML(sbmlfile, ReactionSystemImporter(), kwargs...),
include_zero_odes = include_zero_odes)
end

"""
Expand Down Expand Up @@ -98,7 +100,8 @@ Create an `ODESystem` from an `SBML.Model`.
See also [`ReactionSystem`](@ref).
"""
function ModelingToolkit.ODESystem(model::SBML.Model; include_zero_odes::Bool = true, kwargs...)
function ModelingToolkit.ODESystem(model::SBML.Model; include_zero_odes::Bool = true,
kwargs...)
rs = ReactionSystem(model; kwargs...)
convert(ODESystem, rs; include_zero_odes = include_zero_odes)
end
Expand Down
4 changes: 2 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ function has_rule_type(id::String, m::SBML.Model, T::Type{<:SBML.Rule})
end

const importdefaults = doc -> begin
set_level_and_version(3, 2)(doc)
convert_promotelocals_expandfuns(doc)
set_level_and_version(3, 2)(doc)
convert_promotelocals_expandfuns(doc)
end
2 changes: 1 addition & 1 deletion test/reactions.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using SBMLToolkit
using Catalyst, SBML, ModelingToolkit
using Catalyst, SBML
using Test

cd(@__DIR__)
Expand Down

0 comments on commit 8a544ec

Please sign in to comment.