-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint: detect duplicated observable IDs #446
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #446 +/- ##
===========================================
+ Coverage 77.88% 77.99% +0.10%
===========================================
Files 22 22
Lines 2211 2222 +11
Branches 529 531 +2
===========================================
+ Hits 1722 1733 +11
Misses 363 363
Partials 126 126
Continue to review full report at Codecov.
|
petab/lint.py
Outdated
@@ -621,6 +625,21 @@ def assert_noise_distributions_valid(observable_df: pd.DataFrame) -> None: | |||
f"table: {distr}.") | |||
|
|||
|
|||
def assert_observable_id_is_unique(observable_df: pd.DataFrame) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def assert_observable_id_is_unique(observable_df: pd.DataFrame) -> None: | |
def assert_unique_observable_ids(observable_df: pd.DataFrame) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name is indeed better. But since I essentially copied assert_parameter_id_is_unique
, maybe if I change the name for the new function I should change it for the old too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. yes, makes sense to change the old one too then.
if len(observable_df.index) != len(set(observable_df.index)): | ||
raise AssertionError( | ||
f"{OBSERVABLE_ID} column in observable table is not unique.") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be good to also return the duplicate ids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean to put the duplicated list inside the AssertionError
message? It is certainly more informative. Again, if I do it here I should do it for assert_parameter_id_is_unique
too I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not crucial, but I guess that would be helpful.
Release 0.1.9 Library: * Allow URL as filenames for YAML files and SBML models (Closes #187) (#459) * Allow model time in observable formulas (#445) * Make float parsing from CSV round-trip (#444) * Validator: Error message for missing IDs, with line numbers. (#467) * Validator: Detect duplicated observable IDs (#446) * Some documentation and CI fixes / updates * Visualization: Add option to save visualization specification (#457) * Visualization: Column XValue not mandatory anymore (#429) * Visualization: Add sorting of indices of dataframes for the correct sorting of x-values (#430) * Visualization: Default value for the column x_label in vis_spec (#431)
The linter function
check_observable_df
does not detect duplicated observable IDs. MWE isIncidentally, this causes a problem in
check_measurement_df
too.