GPR eval: issue or expected behaviour?

39 views
Skip to first unread message

Juliette Cooke

unread,
Mar 1, 2023, 11:20:27 AM3/1/23
to cobra pie
Hi,

I've been trying to use the new GPR system in cobrapy.
I want to be able to know which reactions would be affected by a gene KO.
It seems to me that this is what the eval function is for: the way I understand it, it returns True on a GPR that is active for a given knockout, and False if the reaction is inactivated by a given knockout.

However, it seems to be returning True no matter what.
Here's an example using Human 1:
import cobra
model = cobra.io.read_sbml_model("Human-GEM.xml")
g = model.genes.get_by_id("ENSG00000100170")
with model:
   print(g.functional)
   g.knock_out()
   print(g.functional)
   for r in g.reactions:
     print(r.bounds)
     print(r.gpr)
     print(r.gpr.eval([g]))

Results:
True
False
True
(0, 0)
ENSG00000100170
True
(-1000.0, 1000.0)
ENSG00000086159 or ENSG00000100170 or ENSG00000103375 or ENSG00000143595 or ENSG00000161798 or ENSG00000165269 or ENSG00000165272 or ENSG00000167580 or ENSG00000171885 or ENSG00000240583 or ENSG00000259916
True
(0, 0)
ENSG00000100170
True
(0, 0)
ENSG00000100170
True
(0, 0)
ENSG00000100170
True
(0, 0)
ENSG00000100170
True
(0, 0)

As you can see, all but one reactions are affected by this gene KO but all of the eval results are True. Is this the intended behaviour or is it a bug?
If it's intended, what is the correct way to test if a reaction will be affected by a KO? Running the KO and checking the bounds?

Thanks,
Juliette

ch.d...@gmail.com

unread,
Mar 8, 2023, 7:11:40 PM3/8/23
to cobra pie
Hi Juliette,

Sorry for the confusion. It's not well documented but GPR.eval expects a list of gene IDs not a list of genes. But the reaction bounds are usually synchronized with Gene.functional. That's why you see that the bounds are actually correct for the reactions (set to zero where the gene knockout creates a non-functional reaction).

Juliette Cooke

unread,
Mar 9, 2023, 5:11:03 AM3/9/23
to cobra pie
Hi,

Thanks for your reply.
It works as expected when using the gene IDs, thanks again! It's good to have a direct method compared with checking the reaction bounds.
Reply all
Reply to author
Forward
0 new messages