testsuite.cases¶
The semantic cases of the SBML Test Suite on disk.
A case is a directory cases/semantic/NNNNN/ with the model in several
encodings, NNNNN-settings.txt with the simulation and the tolerances,
NNNNN-results.csv with the expected results and NNNNN-model.m with the
description and the tags. SemanticCase reads the two metadata files, and
SemanticSuite is a directory of cases, downloaded from a release of the
suite and cached.
SemanticCase
dataclass
¶
SemanticCase(
cid,
path,
model_path,
start,
duration,
steps,
variables,
amount,
concentration,
absolute_tolerance,
relative_tolerance,
component_tags=frozenset(),
test_tags=frozenset(),
test_type="",
generated_by="",
packages=frozenset(),
)
A semantic case of the SBML Test Suite.
Attributes:
| Name | Type | Description |
|---|---|---|
cid |
str
|
identifier of the case, i.e. its directory name such as |
path |
Path
|
directory of the case. |
model_path |
Path
|
the model which is simulated, the newest encoding present. |
start |
float
|
start time of the simulation. |
duration |
float
|
end time of the simulation. |
steps |
int
|
number of steps, so the results have |
variables |
list[str]
|
the columns the results are compared on, without |
amount |
list[str]
|
the variables which are compared as an amount. |
concentration |
list[str]
|
the variables which are compared as a concentration. |
absolute_tolerance |
float
|
absolute tolerance of the comparison. |
relative_tolerance |
float
|
relative tolerance of the comparison. |
component_tags |
frozenset[str]
|
SBML components the case uses, e.g. |
test_tags |
frozenset[str]
|
what the case tests, e.g. |
test_type |
str
|
kind of the case, |
generated_by |
str
|
|
packages |
frozenset[str]
|
SBML packages the case needs, e.g. |
selections
property
¶
Get the roadrunner selections of the compared variables.
A variable of the concentration list is the concentration of a
species, i.e. [S1], everything else is read under its own
identifier. time is always selected first.
settings
staticmethod
¶
Read the settings file of a case.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
|
required |
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
The keys of the file with their raw values, values may be empty. |
tags
staticmethod
¶
Read the tags of the description of a case.
The description is prose with a header of key: value lines; only the
single line keys of the header are read, i.e. not the synopsis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
|
required |
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
The tag keys with their raw values. |
from_directory
classmethod
¶
Read a case from its directory.
A case which is not a timecourse simulation is not read: the flux balance cases have no duration and the stochastic cases are not part of the semantic suite.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
directory of the case, named after its identifier. |
required |
Returns:
| Type | Description |
|---|---|
SemanticCase | None
|
The case, or |
SemanticCase | None
|
model in a known encoding. |
model_of
staticmethod
¶
Get the model of a case in the newest encoding it provides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
directory of the case. |
required |
cid
|
str
|
identifier of the case. |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
The SBML file, or |
expected
¶
Read the results a correct simulator produces.
The time column is time in most cases and Time in others, so it is
renamed; the columns of the variables are named as the settings name
them.
Returns:
| Type | Description |
|---|---|
DataFrame
|
The expected results with a |
DataFrame
|
variable of the case. |
SemanticSuite
dataclass
¶
The semantic cases of a release of the SBML Test Suite.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path
|
directory which holds the case directories. |
version |
str
|
release of the suite, e.g. |
cases
¶
Iterate the timecourse cases of the suite, by identifier.
Yields:
| Type | Description |
|---|---|
SemanticCase
|
Every case which is a timecourse simulation, in the order of the |
SemanticCase
|
case identifiers. |
case
¶
Get a single case by its identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cid
|
str
|
identifier of the case, e.g. |
required |
Returns:
| Type | Description |
|---|---|
SemanticCase
|
The case. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the suite has no such timecourse case. |
cache_path
staticmethod
¶
Get the directory a release of the suite is unpacked into.
SBMLSIM_TEST_SUITE_PATH overrides it, e.g. for an offline machine
which has the cases somewhere else. Otherwise it is the user cache,
i.e. XDG_CACHE_HOME or ~/.cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
release of the suite. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The directory the cases of the release live in. |
latest_version
classmethod
¶
Get the newest release of the suite from GitHub.
Returns:
| Type | Description |
|---|---|
str
|
The tag of the newest release, e.g. |
cached
classmethod
¶
Get a release of the suite if it is already on this machine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
release of the suite. |
SUITE_VERSION
|
Returns:
| Type | Description |
|---|---|
SemanticSuite | None
|
The suite, or |
load
classmethod
¶
Get a release of the suite, downloading it if it is not cached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
release of the suite. |
SUITE_VERSION
|
Returns:
| Type | Description |
|---|---|
SemanticSuite
|
The suite with its cases unpacked in the cache. |
Raises:
| Type | Description |
|---|---|
OSError
|
if the release cannot be downloaded. |