Skip to content
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

added adaptor method and one test #27

Merged
merged 5 commits into from
Aug 31, 2024

Conversation

janisshin
Copy link
Collaborator

@janisshin janisshin commented Aug 20, 2024

Added a method to emll/util.py for converting Antimony models into a form that is compatible with Cobra.
Also added a test for this method which checks to see whether the stoichiometric matrices match after conversion

@janisshin janisshin linked an issue Aug 20, 2024 that may be closed by this pull request
@janisshin
Copy link
Collaborator Author

I am not familiar with pytest, so I am not sure if I incorporated pytest correctly.
However, the adaptor and the test should work. Please let me know if there are other things I can do to improve this pull request.

@mcnaughtonadm
Copy link
Collaborator

I am not familiar with pytest, so I am not sure if I incorporated pytest correctly. However, the adaptor and the test should work. Please let me know if there are other things I can do to improve this pull request.

Taking a look, I'll test things and report back if something needs to be fixed.

@mcnaughtonadm
Copy link
Collaborator

mcnaughtonadm commented Aug 20, 2024

Okay @janisshin, so to finish out the pytest file, we will need to add an actual .ant model as a "tester". This will allow us to actually run the test and see if we get the expected outcome.

Then we can use some pytest functionality to point the test to the example model, this can be done with a pytest.mark.paramaterize decorator. Let's also change the name of the method from compare__stoich_matrices(antimony_path) to test_antimony_to_cobra_conversion(antimony_path). pytest looks for the method to have the prefix test_ or else it will interpret it as a helper function and not add it to the runtime. So making these changes will look something like:

@pytest.mark.parametrize("antimony_path", [
    "path/to/your/antimony/model1.ant",
])

def test_antimony_to_cobra_conversion(antimony_path):
    ...

you can save the model.ant with the other example models under emll/src/emll/test_models.

Once you make these changes, you can run the script with pytest test_antimony_utils.py

@mcnaughtonadm mcnaughtonadm added the enhancement New feature or request label Aug 20, 2024
@janisshin
Copy link
Collaborator Author

Hi Andrew,
I made your suggested changes.
I tried to test it in my terminal by running pytest test_antimony_utils.py in an environment with pytensor installed, but it gave me an error (image). However, if it works on your end, I imagine that this pull request should be good to close (hopefully!)

image

@mcnaughtonadm
Copy link
Collaborator

Perfect, let me check to see if it runs on my end. If it's something small not working, I can fix it so we don't need to go back and forth again. Then I can review and merge.

Thanks for this addition!

Copy link
Collaborator

@mcnaughtonadm mcnaughtonadm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made one more change to fix some small issues, but test passes now. Merging.

@mcnaughtonadm mcnaughtonadm merged commit a799ef2 into master Aug 31, 2024
@mcnaughtonadm mcnaughtonadm deleted the 26-antimony-to-cobra-adaptor branch August 31, 2024 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

antimony to cobra adaptor
2 participants