When I do
import cbmpy as cbm
mod = cbm.CBRead.readSBML3FBC('e_coli_core.xml.gz')
print(mod.getAllProteinGeneAssociations()['G_b4395'])
mod.deleteReactionAndBounds('R_PGM')
print(mod.getAllProteinGeneAssociations()['G_b4395'])
cbm.CBWrite.writeSBML3FBCV2(mod, 'ecoli_mod.xml')
mod2 = cbm.CBRead.readSBML3FBC('ecoli_mod.xml')
the following will be printed:
['R_PGM']
Deleting reaction R_PGM and 2 associated bounds
['R_PGM']
...
Skipping group "g6" member "R_PGM", it is an incompatible type.
There are two issues with it, I think:
When a reaction is deleted, I would expect it to be also removed from all groups it is member of (now the ID will still be exported causing the "Skipping group..." part) and getAllProteinGeneAssociations() should then return an empty list for the associated gene (now it still returns the ID of the deleted reaction).
I guess both things are unintended behavior?!