petab.v1.lint
Integrity checks and tests for specific features used
Functions
Ensure all required parameters are contained in the parameter table with no additional ones |
|
Check if all observables in the measurement table have been defined in the observable table |
|
|
Ensure that all entries from measurement_df.simulationConditionId and measurement_df.preequilibrationConditionId are present in condition_df.index. |
|
Check whether all measurements are not null. |
|
Check whether all measurements are numeric. |
|
Model parameters that are rule targets must not be present in the parameter table. |
Check that there is no trailing whitespace in elements of Iterable |
|
|
Ensure that noise distributions and transformations for observables are valid. |
|
Check if all entries in the lowerBound and upperBound columns of the parameter table are numeric. |
Check if all entries in the estimate column of the parameter table are 0 or 1. |
|
|
Check if all entries in the parameterId column of the parameter table are string and not empty. |
Check that the prior parameters are valid. |
|
Check that valid prior types have been selected |
|
|
Check if all entries in the parameterScale column of the parameter table are 'lin' for linear, 'log' for natural logarithm or 'log10' for base 10 logarithm. |
|
Check if the observableId column of the observable table is unique. |
|
Check if the parameterId column of the parameter table is unique. |
|
Run sanity checks on PEtab condition table |
|
Check IDs are valid |
|
Run sanity checks on PEtab measurement table |
|
Check validity of observable table |
|
Check if all entries in the lowerBound are smaller than upperBound column in the parameter table and that bounds are positive for parameterScale log|log10. |
|
Run sanity checks on PEtab parameter table |
|
Check if all entries in the condition table are numeric (no parameter IDs) |
|
|
Checks whether input is a number or can be transformed into a number via float |
|
Check whether x is a valid identifier |
|
|
Run PEtab validation on problem |
|
Are there any numbers to override observable parameters? |
Are there time-point or replicate specific parameter assignments in the measurement table. |
|
Does any observable have a noise formula that is not just a single parameter? |
- petab.v1.lint.assert_all_parameters_present_in_parameter_df(parameter_df: DataFrame, model: Model, observable_df: DataFrame, measurement_df: DataFrame, condition_df: DataFrame, mapping_df: DataFrame | None = None) None [source]
Ensure all required parameters are contained in the parameter table with no additional ones
- Parameters:
parameter_df – PEtab parameter DataFrame
model – model
observable_df – PEtab observable table
measurement_df – PEtab measurement table
condition_df – PEtab condition table
mapping_df – PEtab mapping table for additional checks
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_measured_observables_defined(measurement_df: DataFrame, observable_df: DataFrame) None [source]
Check if all observables in the measurement table have been defined in the observable table
- Parameters:
measurement_df – PEtab measurement table
observable_df – PEtab observable table
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_measurement_conditions_present_in_condition_table(measurement_df: DataFrame, condition_df: DataFrame) None [source]
Ensure that all entries from measurement_df.simulationConditionId and measurement_df.preequilibrationConditionId are present in condition_df.index.
- Parameters:
measurement_df – PEtab measurement table
condition_df – PEtab condition table
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_measurements_not_null(measurement_df: DataFrame) None [source]
Check whether all measurements are not null.
- Parameters:
measurement_df – PEtab measurement table.
- Raises:
AssertionError – Some measurement value(s) are null (missing).
- petab.v1.lint.assert_measurements_numeric(measurement_df: DataFrame) None [source]
Check whether all measurements are numeric.
Note that null (missing) measurements are ignored.
- Parameters:
measurement_df – PEtab measurement table.
- Raises:
AssertionError – Some measurement value(s) are not numeric.
- petab.v1.lint.assert_model_parameters_in_condition_or_parameter_table(model: Model, condition_df: DataFrame, parameter_df: DataFrame, mapping_df: DataFrame | None = None, observable_df: DataFrame | None = None, measurement_df: DataFrame | None = None) None [source]
Model parameters that are rule targets must not be present in the parameter table. Other parameters must only be present in either in parameter table or condition table columns. Check that.
- Parameters:
parameter_df – PEtab parameter DataFrame
model – PEtab model
condition_df – PEtab condition table
mapping_df – PEtab mapping table
observable_df – PEtab observable table
measurement_df – PEtab measurement table
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_no_leading_trailing_whitespace(names_list: Iterable[str], name: str) None [source]
Check that there is no trailing whitespace in elements of Iterable
- Parameters:
names_list – strings to check for whitespace
name – name of names_list for error messages
- Raises:
AssertionError – if there is trailing whitespace
- petab.v1.lint.assert_noise_distributions_valid(observable_df: DataFrame) None [source]
Ensure that noise distributions and transformations for observables are valid.
- Parameters:
observable_df – PEtab observable table
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_parameter_bounds_are_numeric(parameter_df: DataFrame) None [source]
Check if all entries in the lowerBound and upperBound columns of the parameter table are numeric.
- Parameters:
parameter_df – PEtab parameter DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_parameter_estimate_is_boolean(parameter_df: DataFrame) None [source]
Check if all entries in the estimate column of the parameter table are 0 or 1.
- Parameters:
parameter_df – PEtab parameter DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_parameter_id_is_string(parameter_df: DataFrame) None [source]
Check if all entries in the parameterId column of the parameter table are string and not empty.
- Parameters:
parameter_df – PEtab parameter DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_parameter_prior_parameters_are_valid(parameter_df: DataFrame) None [source]
Check that the prior parameters are valid.
- Parameters:
parameter_df – PEtab parameter table
- Raises:
AssertionError – in case of invalid prior parameters
- petab.v1.lint.assert_parameter_prior_type_is_valid(parameter_df: DataFrame) None [source]
Check that valid prior types have been selected
- Parameters:
parameter_df – PEtab parameter table
- Raises:
AssertionError – in case of invalid prior
- petab.v1.lint.assert_parameter_scale_is_valid(parameter_df: DataFrame) None [source]
Check if all entries in the parameterScale column of the parameter table are ‘lin’ for linear, ‘log’ for natural logarithm or ‘log10’ for base 10 logarithm.
- Parameters:
parameter_df – PEtab parameter DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_unique_observable_ids(observable_df: DataFrame) None [source]
Check if the observableId column of the observable table is unique.
- Parameters:
observable_df – PEtab observable DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.assert_unique_parameter_ids(parameter_df: DataFrame) None [source]
Check if the parameterId column of the parameter table is unique.
- Parameters:
parameter_df – PEtab parameter DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.check_condition_df(df: DataFrame, model: Model | None = None, observable_df: DataFrame | None = None, mapping_df: DataFrame | None = None) None [source]
Run sanity checks on PEtab condition table
- Parameters:
df – PEtab condition DataFrame
model – Model for additional checking of parameter IDs
observable_df – PEtab observables DataFrame
mapping_df – PEtab mapping DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.check_ids(ids: Iterable[str], kind: str = '') None [source]
Check IDs are valid
- Parameters:
ids – Iterable of IDs to check
kind – Kind of IDs, for more informative error message
- Raises:
ValueError – in case of invalid IDs
- petab.v1.lint.check_measurement_df(df: DataFrame, observable_df: DataFrame | None = None) None [source]
Run sanity checks on PEtab measurement table
- Parameters:
df – PEtab measurement DataFrame
observable_df – PEtab observable DataFrame for checking if measurements are compatible with observable transformations.
- Raises:
AssertionError, ValueError – in case of problems
- petab.v1.lint.check_observable_df(observable_df: DataFrame) None [source]
Check validity of observable table
- Parameters:
observable_df – PEtab observable DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.check_parameter_bounds(parameter_df: DataFrame) None [source]
Check if all entries in the lowerBound are smaller than upperBound column in the parameter table and that bounds are positive for parameterScale log|log10.
- Parameters:
parameter_df – PEtab parameter DataFrame
- Raises:
AssertionError – in case of problems
- petab.v1.lint.check_parameter_df(df: DataFrame, model: Model | None = None, observable_df: DataFrame | None = None, measurement_df: DataFrame | None = None, condition_df: DataFrame | None = None, mapping_df: DataFrame | None = None) None [source]
Run sanity checks on PEtab parameter table
- Parameters:
df – PEtab parameter DataFrame
model – Model for additional checking of parameter IDs
observable_df – PEtab observable table for additional checks
measurement_df – PEtab measurement table for additional checks
condition_df – PEtab condition table for additional checks
mapping_df – PEtab mapping table for additional checks
- Raises:
AssertionError – in case of problems
- petab.v1.lint.condition_table_is_parameter_free(condition_df: DataFrame) bool [source]
Check if all entries in the condition table are numeric (no parameter IDs)
- Parameters:
condition_df – PEtab condition table
- Returns:
True
if there are no parameter overrides in the condition table,False
otherwise.
- petab.v1.lint.is_scalar_float(x: Any)[source]
Checks whether input is a number or can be transformed into a number via float
- Parameters:
x – input
- Returns:
True
if is or can be converted to number,False
otherwise.
- petab.v1.lint.is_valid_identifier(x: str) bool [source]
Check whether x is a valid identifier
Check whether x is a valid identifier for conditions, parameters, observables… . Identifiers may contain upper and lower case letters, digits and underscores, but must not start with a digit.
- Parameters:
x – string to check
- Returns:
True
if valid,False
otherwise
- petab.v1.lint.lint_problem(problem: Problem) bool [source]
Run PEtab validation on problem
- Parameters:
problem – PEtab problem to check
- Returns:
True
if errors occurred,False
otherwise
- petab.v1.lint.measurement_table_has_observable_parameter_numeric_overrides(measurement_df: DataFrame) bool [source]
Are there any numbers to override observable parameters?
- Parameters:
measurement_df – PEtab measurement table
- Returns:
True
if there are any numbers to override observable/noise parameters,False
otherwise.
- petab.v1.lint.measurement_table_has_timepoint_specific_mappings(measurement_df: DataFrame | None, allow_scalar_numeric_noise_parameters: bool = False, allow_scalar_numeric_observable_parameters: bool = False) bool [source]
Are there time-point or replicate specific parameter assignments in the measurement table.
- Parameters:
measurement_df – PEtab measurement table
allow_scalar_numeric_noise_parameters – ignore scalar numeric assignments to noiseParameter placeholders
allow_scalar_numeric_observable_parameters – ignore scalar numeric assignments to observableParameter placeholders
- Returns:
True if there are time-point or replicate specific (non-numeric) parameter assignments in the measurement table, False otherwise.
- petab.v1.lint.observable_table_has_nontrivial_noise_formula(observable_df: DataFrame | None) bool [source]
Does any observable have a noise formula that is not just a single parameter?
- Parameters:
observable_df – PEtab observable table
- Returns:
True
if any noise formula does not consist of a single identifier,False
otherwise.