working with multi package from Python

39 views
Skip to first unread message

David Hoksza

unread,
Sep 6, 2019, 9:28:54 AM9/6/19
to sbml-interoperability
Hi all, 

does anybody have an example of how to work with the Multi package? I have an SBML file which supports multi but I am not able to get the "multi:listOfSpeciesFeatures" for the elements in it. Here is the SBML file which I have issues with.

Based on what I read in the documentation, I expected I will be able to do something like:

self.model.getPlugin('multi').getElementBySId('species_9')

similarly to:

self.model.getElementBySId('species_9')

However, using the getElementBySid from the multi package gives me empty result (unlike the latter one). I tried to obtain all elements from self.model.getPlugin('multi') and found out that it contains only the elements which are pertinent to the multi package, for example, type of features found in the document.

Sadly, I did not find anywhere an example of how to use the package and all my attempts failed. Is here somebody who would be able to help? 

Thanks a lot, 
David

Zhang, Fengkai (NIH/NIAID) [E]

unread,
Sep 6, 2019, 2:51:54 PM9/6/19
to sbml-interoperability
Dear David,

Thank you for your interest in multi! Just let you know you are not ignored. I will have a look at the detail of your question and example file and come back to you.

Fengkai

================================================
Fengkai Zhang, MD, MMath
Staff Scientist, Computational Biology Section
Laboratory of Immune System Biology (LISB)
National Institute of Allergy and Infectious Diseases (NIAID)
National Institutes of Health (NIH)
9000 Rockville Pike
Building 4, Room 137
MSC 0421
Bethesda MD 20892
Phone: 301.761.5442
Fax: 301.480.1660
e mail: zhan...@nih.gov

******************************************************************
The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives.
******************************************************************

________________________________________
From: David Hoksza <david....@gmail.com>
Sent: Friday, September 6, 2019 8:59:39 AM
To: sbml-interoperability
Subject: [sbml-interoperability] working with multi package from Python

Hi all,

does anybody have an example of how to work with the Multi package? I have an SBML file which supports multi but I am not able to get the "multi:listOfSpeciesFeatures" for the elements in it. Here<http://siret.ms.mff.cuni.cz/hoksza/temp/F001-glycolysis-alt-SBGNv02_p1_1.txt> is the SBML file which I have issues with.

Based on what I read in the documentation<http://sbml.org/Software/libSBML/5.18.0/docs/python-api/classlibsbml_1_1_multi_species_plugin.html>, I expected I will be able to do something like:

self.model.getPlugin('multi').getElementBySId('species_9')

similarly to:

self.model.getElementBySId('species_9')

However, using the getElementBySid from the multi package gives me empty result (unlike the latter one). I tried to obtain all elements from self.model.getPlugin('multi') and found out that it contains only the elements which are pertinent to the multi package, for example, type of features found in the document.

Sadly, I did not find anywhere an example of how to use the package and all my attempts failed. Is here somebody who would be able to help?

Thanks a lot,
David

--
You received this message because you are subscribed to the Google Groups "sbml-interoperability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperab...@googlegroups.com<mailto:sbml-interoperab...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbml-interoperability/dc5cad39-a602-4f57-87cb-17ba529f5779%40googlegroups.com<https://groups.google.com/d/msgid/sbml-interoperability/dc5cad39-a602-4f57-87cb-17ba529f5779%40googlegroups.com?utm_medium=email&utm_source=footer>.

Matthias König

unread,
Sep 9, 2019, 5:08:33 AM9/9/19
to sbml-inter...@googlegroups.com
Could you attach the SBML file and the python script. I could have a look if you provide a concrete example.

Best Matthias

To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperab...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbml-interoperability/BL0PR0901MB24036A6901826F4CA3A2F12297BA0%40BL0PR0901MB2403.namprd09.prod.outlook.com.

David Hoksza

unread,
Sep 9, 2019, 7:06:10 AM9/9/19
to sbml-inter...@googlegroups.com
Dear Matthias, 

Thanks for your replay. Attached is a zip with an SBML and short Python script. I guess I am using the plugin in the wrong way. The goal is to obtain the list of modifications for the species (species_9 in the attached test script).

Best, 
David



--
David Hoksza


Luxembourg Centre for Systems Biomedicine, Bioinformatics core
UNIVERSITÉ DU LUXEMBOURG
Campus Belval | House of Biomedicine II
6, avenue du Swing
L- 4367 Belvaux


SIRET research group
Department of Software Engineering, Faculty of Mathematics And Physics
Charles University, 
Malostranské nám. 25
118 00 Prague

multi.zip

Frank T. Bergmann

unread,
Sep 9, 2019, 7:17:42 AM9/9/19
to sbml-interoperability
Hello David, 

the general way to access extension elements in libSBML is to: 

* first get the SBML element you would like to get (species9 in your case)
* from that element, get the plugin object (getPlugin('multi')
* from the plugin go through all elements. 

In your case it would look something like this: 

```
species = model.getSpecies('species_9')
assert(isinstance(species, libsbml.Species))

plugin = species.getPlugin('multi')
assert(isinstance(plugin, libsbml.MultiSpeciesPlugin))
print ('# type: %s' % plugin.getSpeciesType())
print ('# species featurs: %d' % plugin.getNumSpeciesFeatures())
for feature in plugin.getListOfSpeciesFeatures():
print(' occur: %d speciesFeatureType: %s' % (feature.getOccur(), feature.getSpeciesFeatureType()))
for val in feature.getListOfSpeciesFeatureValues():
print (' value: %s' % val.getValue())
```

David Hoksza

unread,
Sep 9, 2019, 7:21:14 AM9/9/19
to sbml-inter...@googlegroups.com
Oh, now I understand. I was missing that piece that you are supposed to get a plugin from the species directly. Before that, I was working only with the layout plugin, where the approach is slightly different.  

Thanks a lot for the clarification!

Best, 
David

--
You received this message because you are subscribed to the Google Groups "sbml-interoperability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperab...@googlegroups.com.

Zhang, Fengkai (NIH/NIAID) [E]

unread,
Sep 9, 2019, 8:08:28 AM9/9/19
to sbml-interoperability
Thanks, Frank!


Fengkai

________________________________________
From: Frank T. Bergmann <fber...@caltech.edu>
Sent: Monday, September 9, 2019 7:17:42 AM
To: sbml-interoperability
Subject: Re: [sbml-interoperability] working with multi package from Python
--
You received this message because you are subscribed to the Google Groups "sbml-interoperability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperab...@googlegroups.com<mailto:sbml-interoperab...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbml-interoperability/8e1182b5-d816-4a26-84b9-832eff491103%40googlegroups.com<https://groups.google.com/d/msgid/sbml-interoperability/8e1182b5-d816-4a26-84b9-832eff491103%40googlegroups.com?utm_medium=email&utm_source=footer>.

Zhang, Fengkai (NIH/NIAID) [E]

unread,
Sep 9, 2019, 10:33:31 AM9/9/19
to sbml-inter...@googlegroups.com
Hi David,

I also played your example model and tried to import it Simmune. It passed the validation of libSBML for both core and multi.

For the rule-based modeling and simulation purpose, multi is intended to code reactions mediated via binding sites. Looks like your model only has features defined in speciesTypes and does not have any binding site. I guess you are using multi mainly for the purpose of annotation which is good. Let me know if you plan to create rule-based models to simulate and encounter any issue.

Regards,

Fengkai



________________________________________
From: David Hoksza <david....@gmail.com>
Sent: Monday, September 9, 2019 7:21:03 AM
To: sbml-inter...@googlegroups.com
Subject: Re: [sbml-interoperability] working with multi package from Python

Oh, now I understand. I was missing that piece that you are supposed to get a plugin from the species directly. Before that, I was working only with the layout plugin, where the approach is slightly different.

Thanks a lot for the clarification!

Best,
David

On Mon, Sep 9, 2019 at 1:17 PM Frank T. Bergmann <fber...@caltech.edu<mailto:fber...@caltech.edu>> wrote:
Hello David,

the general way to access extension elements in libSBML is to:

* first get the SBML element you would like to get (species9 in your case)
* from that element, get the plugin object (getPlugin('multi')
* from the plugin go through all elements.

In your case it would look something like this:

```
species = model.getSpecies('species_9')
assert(isinstance(species, libsbml.Species))

plugin = species.getPlugin('multi')
assert(isinstance(plugin, libsbml.MultiSpeciesPlugin))
print ('# type: %s' % plugin.getSpeciesType())
print ('# species featurs: %d' % plugin.getNumSpeciesFeatures())
for feature in plugin.getListOfSpeciesFeatures():
print(' occur: %d speciesFeatureType: %s' % (feature.getOccur(), feature.getSpeciesFeatureType()))
for val in feature.getListOfSpeciesFeatureValues():
print (' value: %s' % val.getValue())
```

--
You received this message because you are subscribed to the Google Groups "sbml-interoperability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperab...@googlegroups.com<mailto:sbml-interoperab...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbml-interoperability/8e1182b5-d816-4a26-84b9-832eff491103%40googlegroups.com<https://groups.google.com/d/msgid/sbml-interoperability/8e1182b5-d816-4a26-84b9-832eff491103%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
David Hoksza


Luxembourg Centre for Systems Biomedicine, Bioinformatics core
UNIVERSITÉ DU LUXEMBOURG
Campus Belval | House of Biomedicine II
6, avenue du Swing
L- 4367 Belvaux
Phone: (+352) 46 66 44 6451


SIRET research group
Department of Software Engineering, Faculty of Mathematics And Physics
Charles University,
Malostranské nám. 25
118 00 Prague
Phone: (+420) 951 554 406

http://siret.ms.mff.cuni.cz/hoksza/

--
You received this message because you are subscribed to the Google Groups "sbml-interoperability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperab...@googlegroups.com<mailto:sbml-interoperab...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbml-interoperability/CAJEm%3DXR1SXDaMHWfBzi5yTQDQbYbZ88dZO28TqOmRRKX1QeEcw%40mail.gmail.com<https://groups.google.com/d/msgid/sbml-interoperability/CAJEm%3DXR1SXDaMHWfBzi5yTQDQbYbZ88dZO28TqOmRRKX1QeEcw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages