Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
29952ce0
Commit
29952ce0
authored
Jul 15, 2021
by
Mosè Giordano
Browse files
Fix for dimensionless units
parent
4d51159f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/readsbml.jl
View file @
29952ce0
...
...
@@ -177,7 +177,7 @@ function extractModel(mdl::VPtr)::SBML.Model
end
# parse out the unit definitions
units = Dict{String,
Quantity
}()
units = Dict{String,
Number
}()
for i = 1:ccall(sbml(:Model_getNumUnitDefinitions), Cuint, (VPtr,), mdl)
ud = ccall(sbml(:Model_getUnitDefinition), VPtr, (VPtr, Cuint), mdl, i - 1)
id = get_string(ud, :UnitDefinition_getId)
...
...
src/structs.jl
View file @
29952ce0
...
...
@@ -160,7 +160,7 @@ objects.
"""
struct
Model
parameters
::
Dict
{
String
,
Float64
}
units
::
Dict
{
String
,
Quantity
}
units
::
Dict
{
String
,
Number
}
compartments
::
Dict
{
String
,
Compartment
}
species
::
Dict
{
String
,
Species
}
reactions
::
Dict
{
String
,
Reaction
}
...
...
test/data/units.xml
0 → 100644
View file @
29952ce0
<?xml version='1.0' encoding='UTF-8'?>
<sbml
xmlns:fbc=
"http://www.sbml.org/sbml/level3/version1/fbc/version2"
xmlns=
"http://www.sbml.org/sbml/level3/version1/core"
level=
"3"
version=
"1"
sboTerm=
"SBO:0000624"
fbc:required=
"false"
>
<model
fbc:strict=
"true"
id=
"e_coli_core"
>
<listOfUnitDefinitions>
<unitDefinition
id=
"non_existent"
>
<listOfUnits>
<unit
kind=
"blahblah"
scale=
"-3"
multiplier=
"3.14"
exponent=
"1"
/>
</listOfUnits>
</unitDefinition>
<unitDefinition
id=
"no_dimensions"
>
<listOfUnits>
<unit
kind=
"dimensionless"
scale=
"3"
multiplier=
"0.001"
exponent=
"1"
/>
<unit
kind=
"item"
scale=
"1"
multiplier=
"2"
exponent=
"1"
/>
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>
</model>
</sbml>
test/loadmodels.jl
View file @
29952ce0
...
...
@@ -98,6 +98,10 @@ end
@test
m
.
units
[
"volume"
]
==
1
*
u
"L"
@test
m
.
units
[
"time"
]
==
1
*
u
"s"
@test
m
.
units
[
"substance"
]
==
1
*
u
"mol"
m
=
readSBML
(
joinpath
(
@__DIR__
,
"data"
,
"units.xml"
))
@test
m
.
units
[
"non_existent"
]
==
0.00314
@test
m
.
units
[
"no_dimensions"
]
==
20.0
end
@testset
"Initial amounts and concentrations"
begin
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment