Repository navigation
Fix incorrect problem IDs #340
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
Open
dweindl
wants to merge
1
commit into
Benchmarking-Initiative:master
Choose a base branch
from
dweindl:fix-problem-ids
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
problems/Giordano_Nature2020/v1/model.xml → problems/Giordano_NatMed2020/v1/model.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
problems/Schwen_PONE2014/v1/model.xml → problems/Schwen_PLoSOne2015/v1/model.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
problems/Schwen_PONE2014/v2/model.xml → problems/Schwen_PLoSOne2015/v2/model.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
problems/Weber_BMC2015/v1/model.xml → problems/Weber_BMCSystBiol2015/v1/model.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| """Handling of former problem IDs.""" | ||
|
|
||
| import warnings | ||
|
|
||
| from .C import RENAMED_MODELS | ||
|
|
||
|
|
||
| def resolve_id(id_: str) -> str: | ||
| """Map a former problem ID to the current one, with a warning. | ||
|
|
||
| Other IDs are returned unchanged. | ||
| """ | ||
| if (new_id := RENAMED_MODELS.get(id_)) is None: | ||
| return id_ | ||
|
|
||
| warnings.warn( | ||
| f"Problem `{id_}` was renamed to `{new_id}`. " | ||
| "The old ID will stop working in a future version.", | ||
| FutureWarning, | ||
| stacklevel=3, | ||
| ) | ||
| return new_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| """Tests for former problem IDs.""" | ||
|
|
||
| import pytest | ||
|
|
||
| import benchmark_models_petab as models | ||
| from benchmark_models_petab.overview import get_readme_table | ||
|
|
||
|
|
||
| def test_renamed_models_are_not_problems(): | ||
| """Former IDs are no separate problems, their replacements exist.""" | ||
| assert not set(models.RENAMED_MODELS) & set(models.MODELS) | ||
| assert not set(models.RENAMED_MODELS) & set(models.v1.MODELS) | ||
| assert not set(models.RENAMED_MODELS) & set(models.v2.MODELS) | ||
| assert set(models.RENAMED_MODELS.values()) <= set(models.MODELS) | ||
|
|
||
| table = get_readme_table() | ||
| for old_id in models.RENAMED_MODELS: | ||
| assert old_id not in table | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "old_id,new_id", | ||
| [("Schwen_PONE2014", "Schwen_PLoSOne2015")], | ||
| ) | ||
| def test_former_id_is_accepted_with_warning(old_id, new_id): | ||
| for version in (models.v1, models.v2): | ||
| with pytest.warns(FutureWarning, match=new_id): | ||
| path = version.get_problem_yaml_path(old_id) | ||
| assert path == version.get_problem_yaml_path(new_id) | ||
| with pytest.warns(FutureWarning, match=new_id): | ||
| problem = models.get_problem(old_id) | ||
| assert problem.model.model_id == new_id | ||
| with pytest.warns(FutureWarning, match=new_id): | ||
| assert models.get_simulation_df(old_id) is not None | ||
| with pytest.warns(FutureWarning, match=new_id): | ||
| assert models.get_metadata(old_id) == models.get_metadata(new_id) |
Oops, something went wrong.
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.
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.
Schwen_PLoSOne2015butLang_PLOSComputBiol2019Is
PLoSstill used?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.
For the new names, I used the ISO 4 journal abbreviations. So far, the names appeared somewhat arbitrary. I think it makes sense to have some consistency, but I didn't want to touch all IDs (although I wouldn't be opposed to...). The ISO / PubMed / Medline abbreviations use
PLoSdespite the renaming.If you prefer
PLOS, I can switch.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.
Ah right, it looks like even ISO 4 is inconsistent for different PLOS/PLoS journals.
For the PR, some standard should be set (ISO 4 is fine for me) and applied to all problem IDs.
The way to generate the problem ID should also be updated in the pull request template. Specifically e.g.
{LAST NAME OF FIRST AUTHOR}_{ISO 4 JOURNAL ABBREVIATION WITH NONALPHABET CHARACTERS STRIPPED}{YEAR OF PUBLICATION}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.
Will do. Yeah, I think for PL[oO]S it depends on whether the respective journal already existed before the rebranding.
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.
Oh, but if we are breaking all IDs, I think we should also clarify some additional things:
a,b, ..., but the first one stays without suffix?_{variant}suffix?Anything else?
And note that some abbreviations may become a bit bulky, e.g., PNAS -> ProcNatlAcadSciUSA