sbmlsim.model.model_resources

Model resources.

Interacting with model resources to retrieve models. This currently includes BioModels, but can easily be extended to other models.

Module Contents

Classes

Source

Class for keeping track of the resolved sources.

Functions

is_urn(source)

Check if urn source.

is_http(source)

Check if http source.

model_from_urn(urn)

Get model string from given URN.

model_from_url(url)

Get model string from given URL.

parse_biomodels_mid(text)

Parse biomodel id from string.

model_from_biomodels(mid)

Get SBML string from given BioModels identifier.

Attributes

logger

sbmlsim.model.model_resources.logger[source]
class sbmlsim.model.model_resources.Source[source]

Class for keeping track of the resolved sources.

source :str[source]
path :Optional[pathlib.Path][source]
content :Optional[str][source]
is_path(self)[source]

Check if the source is a Path.

Return type

bool

is_content(self)[source]

Check if the source is Content.

Return type

bool

to_dict(self)[source]

Convert to dict.

Used for serialization.

Return type

Dict[str, Optional[str]]

classmethod from_source(cls, source, base_dir=None)[source]

Resolve the source string.

# FIXME: handle the case of models given as strings.

Parameters
  • source (Union[Source, str, pathlib.Path]) –

  • base_dir (pathlib.Path) –

Return type

Source

sbmlsim.model.model_resources.is_urn(source)[source]

Check if urn source.

Parameters

source (str) –

Return type

bool

sbmlsim.model.model_resources.is_http(source)[source]

Check if http source.

Parameters

source (str) –

Return type

bool

sbmlsim.model.model_resources.model_from_urn(urn)[source]

Get model string from given URN.

Parameters

urn (str) –

Return type

str

sbmlsim.model.model_resources.model_from_url(url)[source]

Get model string from given URL.

Handles redirects of the download page.

Parameters

url (str) –

Returns

Return type

str

sbmlsim.model.model_resources.parse_biomodels_mid(text)[source]

Parse biomodel id from string.

Parameters

text (str) –

Return type

str

sbmlsim.model.model_resources.model_from_biomodels(mid)[source]

Get SBML string from given BioModels identifier.

Parameters

mid (str) – biomodels id

Returns

SBML string

Return type

str