feat: add embl gems repository#1282
feat: add embl gems repository#1282achillesrasquinha wants to merge 6 commits intoopencobra:develfrom
Conversation
achillesrasquinha
commented
Sep 20, 2022
- fix Add EMBL GEMs to Web IO Repository. #1281
- description of feature/fix: It would be nice to have the EMBL GEMs repository added to the Web IO repository list.
- tests added/passed
- add an entry to the next release
Midnighter
left a comment
There was a problem hiding this comment.
A couple of smaller changes are needed, otherwise this looks great. Thanks for the contribution!
| @@ -1,4 +1,4 @@ | |||
| """Provide a concrete implementation of the BioModels repository interface.""" | |||
| """Provide a concrete implementation of the BiGG repository interface.""" | |||
| decoded_path = _decode_model_path(model_id) | ||
|
|
||
| filename = f"{model_id}.xml.gz" | ||
| print(self._url.join(decoded_path).join(filename)) |
There was a problem hiding this comment.
Please remove the print or use logging instead.
| load_model("BIOMD0000000633", cache=False, repositories=[biomodels]) | ||
| biomodels.get_sbml.assert_called_once_with(model_id="BIOMD0000000633") | ||
|
|
||
| def test_biomodels_access(embl_gems: Mock) -> None: |
There was a problem hiding this comment.
Need a different name here:
| def test_biomodels_access(embl_gems: Mock) -> None: | |
| def test_embl_gems_access(embl_gems: Mock) -> None: |
|
|
||
| """ | ||
| load_model("Abiotrophia_defectiva_ATCC_49176", cache=False, repositories=[embl_gems]) | ||
| biomodels.get_sbml.assert_called_once_with(model_id="Abiotrophia_defectiva_ATCC_49176") |
There was a problem hiding this comment.
| biomodels.get_sbml.assert_called_once_with(model_id="Abiotrophia_defectiva_ATCC_49176") | |
| embl_gems.get_sbml.assert_called_once_with(model_id="Abiotrophia_defectiva_ATCC_49176") |
| **kwargs, | ||
| ) -> None: | ||
| """ | ||
| Initialize a EMBL GEMs repository interface. |
There was a problem hiding this comment.
| Initialize a EMBL GEMs repository interface. | |
| Initialize an EMBL GEMs repository interface. |
| return f"{alphabet}/{directory}/{model_path}" | ||
|
|
||
|
|
||
| class EMBLGems(AbstractModelRepository): |
There was a problem hiding this comment.
I think EMBLGEMs would also be an acceptable name, although your version is more legible.
| from .abstract_model_repository import AbstractModelRepository | ||
|
|
||
|
|
||
| def _decode_model_path(model_path): |
|
|
||
| """ | ||
| super().__init__( | ||
| url="https://github.com/cdanielmachado/embl_gems/blob/master/models/", |
There was a problem hiding this comment.
Access the raw content directly:
| url="https://github.com/cdanielmachado/embl_gems/blob/master/models/", | |
| url="https://raw.githubusercontent.com/cdanielmachado/embl_gems/master/models/", |
|
The naming is confusing I think. Biomodels is the official GEM repository from EMBL by their own specification, so that should rather be called carveME repository or similar. And I would include a link to the publication in the docstring to give some recognition to the author. Looks great though and will be a helpful addition for sure. |