Forums

F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Search Search
SBML Discussions » sbml-interoperability » simple question about adding a species
Show: Today's Posts  :: Message Navigator
| Subscribe to topic 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
ajouraku


Posts: 57
Registered:
May 2008
Re: simple question about adding a species 22 Jan '09 03:56 Go to previous messageGo to previous message

Hi Allyson,

Allyson Lister <a.l.lister@newcastle.ac.uk> wrote
> Hi Alejandro,
>
> Your explanation is clear - thanks. I think it will actually lead me to a
> solution. The first responder mentioned how you can add duplicate species.
> You have added that you've noticed that an update or removal of a species
> doesn't affect the rest of the model, and that this must all be done
> manually. While I agree that this is a pain, it does mean that one solution
> for my problem would be:
>
>
> 1. get a copy of the original species with getSpecies (id)
> 2. modify it locally
> 3. delete the original species from the model completely
> 4. add the modified species to the model

The getSpecies(id or index) method returns a *reference* (not copy) to the
underlying Species object as Frank indicated in his reply.
This means that the underlying Species object in the Model object can be modified
just by invoking functions, which modify the Species object (e.g. setId, setName,
setAnnotation, and etc.), via the returned Species object.

For example, if you want to add an annotation to the underlying Species object
whose id is "sp" in the model object, this can be implemented as follows:


// (a) get the underlying Species object (id is "sp") from the model object (Model model)

Species spc = model.getSpecies("sp"); // "spc" is a reference to the underlying
// Species object in the Model object

// (b) check if "spc" is not null (try..catch block may alternatively be used )

if ( spc != null )
{
// (c) set an annotation (by string) to the Species object

spc.setAnnotation("<annotation>..*snip*...</annotation>");
}


So, you don't have to do the step 3. (delete the original species) and 4. (add the modified
species) to modify the underlying Species object.
This behaviour is also true for other Model.getXXXXX functions.

Hope this helps.

Thanks,

Akiya

> Since you say deleting a species doesn't affect everything it's linked to
> (my original worry) then I can happily delete and then immediately add back.
>
> Thanks for your help! :)
>
> 2009/1/21 Alejandro <hadeshell@gmail.com>
>
> >
> > Hello.
> >
> > When you add a new specie with the same id that an existant specie, it
> > doesn't detect it and add two species with the same id (and 3,4...infinite)
> > I think it could be solved using Exception throwing. (to catch the problem
> > and solve in code on a easy way).
> >
> > Another Problem (in my point of view) is when you delete, or change the ID
> > of an existant specie. it doesnt erase or refresh this specie of the species
> > reference list (of a reaccion for example), and also occurs when a specie is
> > referenced in a kineticLaw.
> >
> > is my anwser able to solve your question?
> >
> > Sorry for my English :) I'm untrained.
> >
> > Cheers,
> > Alejandro
> > ____________________________________________________________
> > To manage your sbml-interoperability list subscription, visit
> > https://utils.its.caltech.edu/mailman/listinfo/sbml-interoperability
> >
> > For a web interface to the sbml-interoperability mailing list, visit
> > http://sbml.org/Forums/
> >
> > For questions or feedback about the sbml-interoperability list,
> > contact sbml-team@caltech.edu
> >
>
>
>
> --
>
> Allyson Lister
> http://lurena.vox.com
>
> CISBAN, http://www.cisban.ac.uk
> Newcastle University
> ____________________________________________________________
> To manage your sbml-interoperability list subscription, visit
> https://utils.its.caltech.edu/mailman/listinfo/sbml-interoperability
>
> For a web interface to the sbml-interoperability mailing list, visit
> http://sbml.org/Forums/
>
> For questions or feedback about the sbml-interoperability list,
> contact sbml-team@caltech.edu
____________________________________________________________
To manage your sbml-interoperability list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/sbml-interoperability

For a web interface to the sbml-interoperability mailing list, visit
http://sbml.org/Forums/

For questions or feedback about the sbml-interoperability list,
contact sbml-team@caltech.edu

      

SubjectPosterDate
Read Message   simple question about adding a species Allyson Lister21 Jan '09 03:49
Read Message   Re: simple question about adding a species Alejandro21 Jan '09 08:55
Read Message   Re: simple question about adding a species Neil Swainston21 Jan '09 09:06
Read Message   Re: simple question about adding a species ajouraku22 Jan '09 01:57
Read Message   Re: simple question about adding a species Frank Bergmann21 Jan '09 09:18
Read Message   Re: simple question about adding a species Allyson Lister22 Jan '09 01:21
Read Message   Re: simple question about adding a species Neil Swainston22 Jan '09 01:50
Read Message   Re: simple question about adding a species Allyson Lister22 Jan '09 01:24
Read Message   Re: simple question about adding a species  ajouraku22 Jan '09 03:56
Read Message   Re: simple question about adding a species Sarah Keating22 Jan '09 08:58
Read Message   Re: simple question about adding a species Mike Hucka02 Feb '09 22:21
Read Message   Re: simple question about adding a species Allyson Lister22 Jan '09 01:31
Read Message   Re: simple question about adding a species Allyson Lister22 Jan '09 02:58
Read Message   Re: simple question about adding a species Allyson Lister22 Jan '09 09:21
Read Message   Re: simple question about adding a species Mike Hucka23 Jan '09 00:25
Read Message   Re: simple question about adding a species curoli23 Jan '09 06:19
Read Message   Re: simple question about adding a species Allyson Lister23 Jan '09 01:09
Previous Topic:Re: &quot; The basic libsbml library file&quot;
Next Topic:libsbml and tomcat
Go to forum:
-=] Back to Top [=-

Powered by FUDforum. (Copyright Advanced Internet Designs Inc.)

Please use our issue tracking system for any questions or suggestions about this website.