We have not yet simplified the API for this, so it is not yet in basico or corc. However, I've just tried it and it does work. As long as you are careful, and merge always objects of the same type (i.e compartments with compartments, species with species and so on) The following uses a mix of basico and the normal COPASI python API.
1. first download all the biomodels and save them locally as copasi files:
from basico import *
import COPASI
dms = {}
for m in ['BIOMD0000000009', 'BIOMD0000000426', 'BIOMD0000000093']:
dms[m] = load_biomodel(m)
save_model(m + '.cps', model=dms[m])
2. choose one of those models to start out with, or choose a new model to add all of the other models to:
nm = new_model(name='Combined')
for m in ['BIOMD0000000009', 'BIOMD0000000426', 'BIOMD0000000093']:
nm.addModel(m + '.cps')
3. now you have all the elements of the three models together. For example you see that there are 4 compartments now when running:
get_compartments(model=nm)
4. what you need to do from then on is to go through all items that you identified as being the same and merge them together. So lets merge the compartments 'compartment_[merge]' and 'compartment[merge]':
model = nm.getModel()
expa = COPASI.CModelExpansion(model)
emap = COPASI.CModelExpansion_ElementsMap()
c1 = model.getCompartment('compartment[merge]')
c2 = model.getCompartment('compartment_[merge]')
emap.add(c1, c2)
expa.replaceInModel(emap, True)
5. now look again, and you will find only 3 compartments in the model.
Let us know if you have further questions.
Frank