You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to detect if metabolites or reactions are equal so i can avoid adding duplicates to my model.
Consider:
In [1]: from cobra import Model, Reaction, Metabolite
In [2]: m_o2 = Metabolite("o2", "O2", "oxygen")
In [3]: m_o2 == m_o2.copy()
Out[3]: False
In [4]: ex_o2 = Reaction("EX_o2", lower_bound=-100, upper_bound=100)
...: ex_o2.add_metabolites({m_o2: -1})
...:
In [5]: ex_o2 == ex_o2.copy()
Out[5]: False
Solution
The exact details of how this would work is unclear to me.
In terms of should it require that the metabolites have same id, or should it require a deeper check that they are equal in all fields.
Should it allow different id if name is the same?
In general though we should be be able to detect if reactions are the same.
Alternatives
In general it seems like sometimes reactions are considered equal if they have the same identifier.
Except the equality operator is not implemented.
E.g. model.add_reactions will ignore requests to add things with same id
In [29]: model.add_reactions([ex_o2])
In [30]: model.add_reactions([ex_o2])
Ignoring reaction 'EX_o2' since it already exists.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Checklist
Problem
I want to be able to detect if metabolites or reactions are equal so i can avoid adding duplicates to my model.
Consider:
Solution
The exact details of how this would work is unclear to me.
In terms of should it require that the metabolites have same id, or should it require a deeper check that they are equal in all fields.
Should it allow different id if name is the same?
In general though we should be be able to detect if reactions are the same.
Alternatives
In general it seems like sometimes reactions are considered equal if they have the same identifier.
Except the equality operator is not implemented.
E.g.
model.add_reactions
will ignore requests to add things with same idAnything else?
No response
The text was updated successfully, but these errors were encountered: