Using set_reaction_parameters in copasi/basico

11 views
Skip to first unread message

Marc Lefranc

unread,
Jan 13, 2026, 7:10:02 AM (17 hours ago) Jan 13
to COPASI User Forum

 Dear all,

first, happy new year 2026 to the community and to the developper of Copasi.

I have a question regarding the basico interface to Copasi (which is a very useful tool). Specifically, I want to

- locate the reaction parameter which is mapped to a certain global quantity

- change the mapping of this reaction parameter to point to another global quantity (which I have previously added with add_parameter.

However, the following code does nothing (inp is the name of the initial global quantity, to be replaced by mod_inp


inp='basal_mbmal'

mod_inp = inp+'_mod'

...

rpall = get_reaction_parameters()

print(rpall)

rr=rpall.loc[rpall['mapped_to'] == inp] # find the row which is mapped to inp

param_name = rr.index[0] # find the corresponding reaction parameter name

print("Mapping %s to global %s instead of %s" % (param_name,mod_inp,inp))

set_reaction_parameters(name=param_name,mapped_to=mod_inp)

print(get_reaction_parameters())

...


with output (only keeping the relevant part of the 3 print statements)


(synthesis_bmal).basal 0.821282 synthesis_bmal global basal_mbmal

Mapping (synthesis_bmal).basal to global basal_mbmal_mod instead of basal_mbmal

(synthesis_bmal).basal 0.821282 synthesis_bmal global basal_mbmal


As you can see, the mapping was not changed. So what is wrong in the set_reaction_parameters statement ?


Thank you in advance,

best regards,

Marc

Frank Bergmann

unread,
Jan 13, 2026, 7:32:15 AM (17 hours ago) Jan 13
to COPASI User Forum
Hello Marc, 

a happy new year to you as well. I can confirm that there is a bug that prevents the mapping to be changed. I'll release a new version for this by this time tomorrow at the latest. 

best
Frank

Marc Lefranc

unread,
Jan 13, 2026, 8:26:40 AM (16 hours ago) Jan 13
to COPASI User Forum
Dear Frank,

thank you for your ultrafast reply. I am glad to have modestly contributed to making Copasi better !
Best regards,
Marc

Frank Bergmann

unread,
Jan 13, 2026, 10:54:03 AM (14 hours ago) Jan 13
to COPASI User Forum
The new release is now available with `pip install -U copasi-basico` or by downloading from  copasi-basico · PyPI

I've updated the documentation a bit, to show the 2 ways of changing the mapping. Personally i prefer the way using `set_reaction_mapping`:
Getting and setting reaction parameters and reactions — basiCO documentation

But the route via `set_reaction_parameters` is working now too, i've added that mapping to 'None' would make the parameter local again: 
Getting and setting reaction parameters and reactions — basiCO documentation

I hope this solves the issue. Again thank you so much for reporting. 

Frank
Reply all
Reply to author
Forward
0 new messages