|
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
|