Re: [sbml-discuss] Extracting fbc logical expressions

19 views
Skip to first unread message

Andreas Dräger

unread,
Dec 28, 2021, 12:03:03 PM12/28/21
to jsbml-de...@googlegroups.com, sbml-d...@googlegroups.com
Dear Bill,

Merry Christmas and Happy New Year to you as well!

I am transferring this conversation to the more specific jsbml-development group. We should continue this discussion there as needed and remove sbml-discuss from the list of recipients from further communication. If you aren't on it yet, please subscribe to this list at https://groups.google.com/d/forum/jsbml-development.

Now, to answer your question: You are already doing everything correctly. What you get are the gene-protein-reaction association objects. However, the output via System.out follows the standard Java convention. It displays the SBML object's name (such as "or" or "geneProductRef") followed by all the attributes that are directly set on this particular object in square brackets, e.g., fbc:geneProduct="G_YOR100C".

I assume you prefer to print the SBML code instead. For this, you'll need to pass the object to an SBMLWriter. As I see it, you can't easily serialize a part of an SBML object to SBML code using JSBML with existing tools.

There are two options:
1) You could create an SBML String of the entire SBML document and then use String manipulation to get the part you need.
2) Another option would be to write the parts you are interested in yourself by accessing fields and producing a String in SBML format.

Maybe, if we know more about what you strive to achieve, we might find another solution or a workaround.

Cheers
Andreas


> Am 26.12.2021 um 18:23 schrieb Bill Yang <billy...@gmail.com>:
>
> Merry Christmas and Happy New Year!
>
> I am trying to extract the logical expressions from GeneProductAssociation of fbc reactions. And thankfully I am almost there with the FBCReactionPlugin:
> <Screen Shot 2021-12-26 at 5.09.12 PM.png>
> But I got something like these, which is the first line of the <fbc:geneProductAssociation>:
> <Screen Shot 2021-12-26 at 5.13.48 PM.png>
>
> Example files:
> <Screen Shot 2021-12-26 at 5.19.18 PM.png>
> <Screen Shot 2021-12-26 at 5.19.55 PM.png>
>
> Please could you guide me through mining the geneProductAssociation correctly?
>
> Thanks a lot!
>
> Bill

With best regards

Dr. Andreas Draeger
Assistant Professor
---
University of Tübingen
Institute for Bioinformatics and Medical Informatics (IBMI)
Computational Systems Biology of Infections and Antimicrobial-Resistant Pathogens
Sand 14 · Office #C108 · 72076 Tübingen · Germany
Phone: +49-7071-29-70459 · Fax: +49-7071-29-5152
Web: http://systems-biology.info · Twitter: @dr_drae
YouTube: https://www.youtube.com/c/systemsbiology

Bill Yang

unread,
Dec 29, 2021, 6:04:56 AM12/29/21
to jsbml-development
Hi Andreas,

Thanks for your advice! I have successfully written it to a new SBML document. But what I am trying to do is extract the information of reactants, products and gene product association, then put them in an SBOL file as interactions with the help of libSBOLj. For reactants and products, it seems OK. But it looks like I have to write a parser to do this for the gene product association. Do you have any other suggestions for this purpose?

Thanks again!

Bill

niko.rodrigue

unread,
Dec 30, 2021, 10:20:28 AM12/30/21
to jsbml-development
Hi Bill,

If you are not after a "cobra like gene association string" (which we have existing converters for), you will have indeed to go through the ASTNode tree and create the SBOL structure along the way, depending if the node is a boolean operator or a name.

cheers,
Nico

Nicolas Rodriguez

unread,
Jan 4, 2022, 9:13:36 AM1/4/22
to Bill Yang, jsbml-de...@googlegroups.com
Hi Bill,
Going back to the jsbml-dev list as it could be of interest to other people.

They extend the SBMLConverter class. The basic conversion is in place and working but not sure the students who developed them finished correcting all the small issues we reported.

If you are just interested by the conversion of the gene product association to a string, you can have a look at the two lines below:


That might be something we could extract to a utility method if it is something users want to do on a regular basis.

cheers,
Nico


On Mon, 3 Jan 2022 at 12:52, Bill Yang <billy...@gmail.com> wrote:
Hi Nico,

Thanks for your reply. The converter sounds interesting, maybe I can have a look. Please could you point me to it?

Best,

Bill

Bill Yang

unread,
Jan 7, 2022, 11:55:05 AM1/7/22
to jsbml-development
Hi Nico,

Thanks for your guidance. I have tried both the fbcV2toCobra converter and also just the processAssociation method you highlighted, but all came back with "Exception in thread "main" Undefined combination of Level 0 and Version 0 for element unitDefinition.", though the input SBML document is Level3 and Version1, which is permitted according to the isValidLevelAndVersionCombination method in AbstractSBase class.

Have you seen this bug before? or any suggestions?

Thank you again!

Best,

Bill

Nicolas Rodriguez

unread,
Jan 10, 2022, 9:24:17 AM1/10/22
to jsbml-de...@googlegroups.com
Hi Bill,
Which version of jsbml are you using ? 1.5 or 1.6.x ?

You might have a problem in your code but may be some of the latest developments on units made a change for the fbc converters. Andreas, could you try if the fbc converters are still working for you on 1.6.1 ?

Thanks,
Nico

--
You received this message because you are subscribed to the Google Groups "jsbml-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsbml-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsbml-development/8cd0f9ce-2032-46a4-bd04-e1a6dae364fbn%40googlegroups.com.

Bill Yang

unread,
Jan 15, 2022, 5:32:43 PM1/15/22
to jsbml-development
Hi Nico,

It was jsbml 1.5.

I think I might have fixed the problem by setting Type of the created ASTNode in the processAssociation method. 

By altering lines 232 and 233:

To:
ASTNode newChild = processAssociation((Association)association.getChildAt(j), fbcModelPlugin);
newChild.setType(geneAssociationNode.getType());
geneAssociationNode.addChild(newChild);

Thanks for the help from you all, I have made a simple SBMLfbc-to-SBOL converter that can keep the qualitative information in the SBML model.  

Thanks again!

Bill

Andreas Dräger

unread,
Jan 16, 2022, 6:25:29 AM1/16/22
to jsbml-de...@googlegroups.com
Dear Bill,

I am glad that helped. Now, do you suggest, we should generally add a line

newChild.setType(geneAssociationNode.getType());

in class FbcV2ToFbcV1Converter after this line below?

ASTNode newChild = processAssociation((Association)association.getChildAt(j), fbcModelPlugin);

In other words, did you experience problems with a missing type? If that's the case, we should probably file an issue.

Cheers
Andreas

Bill Yang

unread,
Jan 16, 2022, 10:06:31 AM1/16/22
to jsbml-de...@googlegroups.com
Hi Andreas,

Yes, that's what I did to make codes work.

I was testing the converter with the yeast consensus model yeast_8.5.xml: https://github.com/SysBioChalmers/yeast-GEM

After calling the processAssociation method:
Exception in thread "main" Undefined combination of Level 0 and Version 0 for element unitDefinition.
at org.sbml.jsbml.AbstractSBase.<init>(AbstractSBase.java:282)
at org.sbml.jsbml.AbstractNamedSBase.<init>(AbstractNamedSBase.java:80)
at org.sbml.jsbml.UnitDefinition.<init>(UnitDefinition.java:550)
at org.sbml.jsbml.util.compilers.ASTNodeValue.getUnits(ASTNodeValue.java:243)
at org.sbml.jsbml.ASTNode.deriveUnit(ASTNode.java:2356)
at org.sbml.jsbml.ASTNode.astNodeToTree(ASTNode.java:4601)
at org.sbml.jsbml.ASTNode.addChild(ASTNode.java:1826)

The extra line as you described could fix this:
newChild.setType(geneAssociationNode.getType());

Best,

Bill



--
You received this message because you are subscribed to the Google Groups "jsbml-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsbml-developm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages