-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: python I/O functions + BiGG compliance flag #224
Conversation
Added functions for loading/saving the model in python in a more straightforward way. Also the id replacement is no longer necessary, as it was fixed in cobrapy. Updated the model as a test (will be reverted later)
minor changes, including shuffling of groups (as the latest cobrapy version still treats them as sets)
add a BiGG compliance flag that defaults to false when loading the model. If true, will read the annotation and use BiGG ids (if any)
model cannot be stored at this stage, as there are repeated ids in the BiGG dicts
introduce a copy suffix when id is repeated
taken from devel
Hi @BenjaSanchez I am not sure whether errors exist when load model using python, i have used the followed self-function to correct some errors: return model0 |
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.
I have no experience with running cobrapy, so I'm unable to review this functionality.
@hongzhonglu the changes you are performing are not needed anymore with the latest versions of cobrapy, as they convert the non-ASCII characters by default. Are you testing the PR with the proper environment? please update your cobrapy version, or even better, |
Hi @BenjaSanchez, Thanks for your information. I will test it. |
@hongzhonglu is the setup working now for you? :) |
hi Ben, could you replace this package named "dotenv" as i found it is can't be installed by pycharm? |
@hongzhonglu the package is called |
Hi Ben, thanks for your remind! when run the above code, REPO_PATH is "", thus the followed commond can not be run. Why not directly set the whole path of model as the input for function "read_yeast_model"? |
@hongzhonglu did you follow the new installation instructions as the README now states? You should create an empty type nul > .env # creates a .env file for locating the root The idea of using dotenv is precisely to avoid specifying the path depending of where in the repo we are, as that (absolute) path never changes. This makes it easier & safer for the user to read/write, as it requires less typing and avoids mistaking the path and saving the model somewhere undesired. |
Now, i can run it! |
Main improvements in this PR:
read_yeast_model
andwrite_yeast_model
) without needing to specify the model path. Usage, as indicated now in the README file, is as follows:.env
is required in the repo's root (as also indicated in the README file).requirements.txt
file for ensuring a reproducible environment when performing simulations in Python.read_yeast_model
features amake_bigg_compliant
flag for loading the model with BiGG ids instead of regular ids. If chosen, the BiGG annotation in the model + the BiGG dictionaries in./ComplementaryData/databases
are used for the conversion. Some additional info:_copyN
suffix if they are repeated in the model (as ids should be unique).met_comp
standard).{"er":"r", "erm":"rm", "p":"x"}
NOTE that in each commit I saved the model with
write_yeast_model
to confirm changes were as expected, but in the last commit I reverted the model to be as the original one indevel
, so no model changes are performed here.NOTE ALSO that although the model can be saved in cobrapy format keeping all fields, it changes considerably the structure of the
.xml
file and hence should not be done if contributing to this repo until issue #218 is solved.I hereby confirm that I have:
devel
as a target branch (top left drop-down menu)