sybila / biodivine-lib-param-bn

Rust library for working with parametrised Boolean networks.
MIT License
2 stars 2 forks source link

Add support for SBML variables with different names and ids #7

Closed daemontus closed 3 years ago

daemontus commented 3 years ago

SBML qualitative species can have an id and a name attribute, where id is used in the model file when referencing the species, but name is the actual value displayed to the user. In a lot of models id == name, but this is not always the case.

For now, we used id as the variable name in the imported model, but this causes unnecessary confusion since models are sometimes imported with seemingly random or unrelated species names. For example, Ginsim SBML seems to be ok, but anything from Cellcollective is problematic.

The problem with using SBML names directly is that they have a very wide range of allowed characters (including ( or ?). We thus have to perform a normalisation, replacing every invalid character with _ so that the model can be imported successfully.

TL;DR, this pull request:

Note that this is closely related to #1, but does not solve it completely because there are still other known problematic SBML models. However, I've tested it with a custom version of aeon backend and it seems to work reasonable on models from cellcollective.org now (previously, only numbers were shown instead of names).

codecov[bot] commented 3 years ago

Codecov Report

Merging #7 into master will decrease coverage by 0.07%. The diff coverage is 96.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #7      +/-   ##
==========================================
- Coverage   85.00%   84.93%   -0.08%     
==========================================
  Files          28       29       +1     
  Lines        1761     1859      +98     
==========================================
+ Hits         1497     1579      +82     
- Misses        264      280      +16     
Impacted Files Coverage Δ
src/impl_variable_id.rs 0.00% <ø> (ø)
src/sbml/mod.rs 73.24% <96.92%> (+2.41%) :arrow_up:
src/impl_fn_update.rs 87.50% <0.00%> (-6.25%) :arrow_down:
src/impl_regulatory_graph.rs 84.90% <0.00%> (-1.89%) :arrow_down:
src/bdd_params/impl_witness_generator.rs 81.08% <0.00%> (-1.81%) :arrow_down:
src/bdd_params/impl_bdd_parameter_encoder.rs 85.45% <0.00%> (-0.61%) :arrow_down:
src/display_regulatory_graph.rs 95.00% <0.00%> (-0.46%) :arrow_down:
src/sbml/export.rs 94.78% <0.00%> (-0.26%) :arrow_down:
src/async_graph/impl_async_graph.rs 88.00% <0.00%> (-0.24%) :arrow_down:
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e1a10e1...f11a06f. Read the comment docs.