SystemsBioinformatics / cbmpy

CBMPy is a Python based platform for constraint based modelling and analysis.
https://systemsbioinformatics.github.io/cbmpy/
GNU General Public License v3.0
19 stars 6 forks source link

createGeneProteinAssociation can lead to duplicate gene labels #23

Open willigott opened 5 years ago

willigott commented 5 years ago

When I do

import cbmpy as cbm

mod = cbm.CBRead.readSBML3FBC('e_coli_core.xml.gz')

mod.getGene('G_b4395').setLabel('b4301')

I receive - as expected - a warning that the gene label already exists and it is therefore not set.

However, when I then do:

mod.createReaction('dummy')
mod.createGeneProteinAssociation('dummy', 'b4395')

two genes will exist with identical label:

[g for g in mod.getGeneIds() if 'b4395' in g]   # ['G_b4395', 'b4395']
[g for g in mod.getGeneLabels() if 'b4395' in g]  # ['b4395', 'b4395']

Export and import of the model works fine, however, if one uses the online validator it will return the error:

Error Line 10826 Column 47: (SBML Validation Rule #fbc-21205) The attribute 'fbc:label' on a must be unique among the set of all elements defined in the . Reference: L3V1 Fbc V2 Section 3.5 A GeneProduct with the label 'b4395' has already been declared.

Could this be fixed?!

bgoli commented 4 years ago

Good catch, I will look into this