Add annotations that can be used to verify network integrity. #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new mechanism that adds optional network annotations into the
.aeon
file that can be used to verify network integrity. This is mostly intended to avoid unintended typos during manual network modification.The mechanism is opt-in (
check_declarations:true
must be present in the network file), but all future versions of lib-param-bn will add this annotation by default. So any previously created networks will ignore this mechanism, and any newly created networks will have this data available if not explicitly deleted.A variable is considered declared if it appears in the
variable
annotation string (e.g.#! variable: X
declares variableX
), or if there are any data keys present for it (e.g.#! variable: X: gene_name: XY
also declares variableX
). The same mechanism applies to explicit parameters (using the annotation keyfunction
), but here, we mostly expect a data entryarity
to be present (e.g.#! function: f: arity: 5
), since all functions without arity will be regarded as constants (i.e. arity zero).This also resolves the long standing issue where variables with no regulations would disappear from the model because they are not representable. Such cases will now recreate the variable from its declaration. (this is the only instance where the presence of a declaration takes precedence over the contents of the model).