-
Notifications
You must be signed in to change notification settings - Fork 218
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
User defined constraints #1228
User defined constraints #1228
Conversation
json.schema updated to have user_defined_constraints as array
Codecov Report
@@ Coverage Diff @@
## devel #1228 +/- ##
==========================================
- Coverage 84.44% 82.94% -1.51%
==========================================
Files 66 67 +1
Lines 5491 5822 +331
Branches 1264 1363 +99
==========================================
+ Hits 4637 4829 +192
- Misses 550 648 +98
- Partials 304 345 +41
Continue to review full report at Codecov.
|
|
Okay. I updated 988 in #1225
The original #996 includes #988 and these changes. These are the only
changes in the original that are not in 988 or the updated version.
As for adding new accessor- I agree that this is wrong and shouldn't done
via optlamg, but I don't know how. I tried replacing these new
accessorswithcalls tooptlang, but my attempt just leads to optlang errors.
…On Mon., Jun. 6, 2022, 2:29 p.m. Christian Diener, ***@***.***> wrote:
Wasn't there a different PR that refactored this already? I think one of
the issues was the addition of a new constraint accessor even though custom
constraints are already a part of COBRAPY via optlang. The issue is that
SBML only supports a subset of those constraints since it does not put the
problem in standard form (all v>0, separate forward and reverse fluxes),
however it is fairly straight forward to check if an existing constraint
can be expressed in FBC3 and that is probably the way to go.
—
Reply to this email directly, view it on GitHub
<#1228 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQYYZQT75BU5L45OD2P5KLVNY7Q7ANCNFSM5XK2BIZQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
see #1240 |
Now it is pure optlang. JSON import and export work. SBML, Mat, YAML next. Almost all tests work. Some tests give different results with the optlang and the pure accessor (last two asserts in test_user_defined_constraints_with_variable_documented). I can't figure out what is wrong, and would appreciate help. |
1a6bca6
to
3897ec7
Compare
Sorry for the slow reply. Yes, libsbml implements all of the UserDefinedConstraints. This was part of the original pull request. |
Where does the original implement this?
comparing #996 to #988 doesn't show any changes in sbml.py. Do you mean
that libsbml implements these changes, and that sbml.py needs to be
modified to take advantage of it?
…On Wed, Jul 13, 2022 at 5:25 AM Matthias König ***@***.***> wrote:
Sorry for the slow reply. Yes, libsbml implements all of the
UserDefinedConstraints. This was part of the original pull request.
—
Reply to this email directly, view it on GitHub
<#1228 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQYYZQKXUDSBIMXIGAZV7DVT2DOXANCNFSM5XK2BIZQ>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
You are right. There was no code in the original submission. I will implement the SBML serialization but it seems some issues still have to be solved. I just checked and the fbc version 3 code is in the current I am testing this currently outside of cobrapy for another project and as soon as the issues are resolved I will take care of the SBML serialization of the UserDefinedConstraints and the KeyValuePairs. See sbmlteam/libsbml#241 for an example problem I just encountered. I am implementing full serialization of the new features in sbmlutils and as soon as I am sure things are working I will implement the serialization here. |
Okay.
If you can set up a filter that checks if constraints are valid for FBC3, I
can set up something that would read/write constraints to JSON format, and
probably MAT as well. The reason I would like a filter is that there are
some SBML FBC3 limitations on constraints, but I'm not 100% sure what they
are.
Since user constraints are a new feature, we can merge it in with the
filter, so if you try adding a constraint that's not valid for FBC3,
cobrapy will complain. And then all formats read/write the constraints
without loss of data.
…On Wed, Jul 13, 2022 at 8:50 AM Matthias König ***@***.***> wrote:
You are right. There was no code in the original submission. I will
implement the SBML serialization but it seems some issues still have to be
solved. I just checked and the fbc version 3 code is in the current
python-libsbml packages.
But unfortunately nobody tried this so far. So there are still bugs.
I am testing this currently outside of cobrapy for another project and as
soon as the issues are resolved I will take care of the SBML serialization
of the UserDefinedConstraints and the KeyValuePairs. See
sbmlteam/libsbml#241 <sbmlteam/libsbml#241> for
an example problem I just encountered. I am implementing full serialization
of the new features in sbmlutils and as soon as I am sure things are
working I will implement the serialization here.
—
Reply to this email directly, view it on GitHub
<#1228 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQYYZXESNAOH25NWF3Y7JLVT23PZANCNFSM5XK2BIZQ>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
I can imagine that not all constraints can be serialized to SBML. I.e.
there could be constraints in cobrapy/optlang which are not supported by
FBC3. I would still allow to create this in cobrapy, they will just give
errors/warnings on serialization (or even on creation). I.e. not
necessarily everything which is possible in cobrapy can be
serialized/exchanged.
Yes, it should be straight-forward to figure out the subset of constraints
supported by FBC3.
…On Wed, Jul 13, 2022 at 4:03 PM akaviaLab ***@***.***> wrote:
Okay.
If you can set up a filter that checks if constraints are valid for FBC3, I
can set up something that would read/write constraints to JSON format, and
probably MAT as well. The reason I would like a filter is that there are
some SBML FBC3 limitations on constraints, but I'm not 100% sure what they
are.
Since user constraints are a new feature, we can merge it in with the
filter, so if you try adding a constraint that's not valid for FBC3,
cobrapy will complain. And then all formats read/write the constraints
without loss of data.
On Wed, Jul 13, 2022 at 8:50 AM Matthias König ***@***.***>
wrote:
> You are right. There was no code in the original submission. I will
> implement the SBML serialization but it seems some issues still have to
be
> solved. I just checked and the fbc version 3 code is in the current
> python-libsbml packages.
> But unfortunately nobody tried this so far. So there are still bugs.
>
> I am testing this currently outside of cobrapy for another project and as
> soon as the issues are resolved I will take care of the SBML
serialization
> of the UserDefinedConstraints and the KeyValuePairs. See
> sbmlteam/libsbml#241 <sbmlteam/libsbml#241>
for
> an example problem I just encountered. I am implementing full
serialization
> of the new features in sbmlutils and as soon as I am sure things are
> working I will implement the serialization here.
>
> —
> Reply to this email directly, view it on GitHub
> <#1228 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ACQYYZXESNAOH25NWF3Y7JLVT23PZANCNFSM5XK2BIZQ
>
> .
> You are receiving this because you modified the open/close state.Message
> ID: ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#1228 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG33OSOZ3X55ATU3X5FCELVT3EEXANCNFSM5XK2BIZQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Matthias König, PhD.
Junior Group Leader Systems Medicine of the Liver Lab
Humboldt-Universität zu Berlin,
Institute of Biology, Institute for Theoretical Biology
Philippstraße 13, Haus 20, 10115 Berlin
Tel: +49 30 2093 98435
https://livermetabolism.com
***@***.***
https://twitter.com/konigmatt
https://github.com/matthiaskoenig
|
This is an updated version of User defined constraints #996 that contains only the changes needed for user defined constraints. Some corrections like iteritems to items(), etc.
I think the original PR doesn't use optlang correctly. There is a lot of ast parsing, which I'm not sure is necessary.
I don't understand optlang that well, so if it needs to be rewritten, I would need a starting point. I think that it can just be replaced with optlang symbolic parsing and leave the ast to optlang (so just remove that code).
@matthiaskoenig - I think that as this point libsbml supports fbc with user defined constraints. Is that correct?
This PR adds some tests for adding user constraints.