Skip to content

Commit

Permalink
fix: add "G_" prefix when exporting model to SBML
Browse files Browse the repository at this point in the history
  • Loading branch information
simas232 committed Mar 14, 2024
1 parent 1df6493 commit 00483a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions io/exportModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ function exportModel(model,fileName,exportGeneComplexes,supressWarnings,sortIds)
model.mets=regexprep(model.mets,'([^0-9_a-zA-Z])','__${num2str($1+0)}__');
model.comps=regexprep(model.comps,'([^0-9_a-zA-Z])','__${num2str($1+0)}__');
if isfield(model,'genes')
% Add "G_" prefix to genes. This is to ensure SBML file compatibility
% with MEMOTE
rawGenes = model.genes;
model.genes = strcat('G_',model.genes);
for i=1:numel(rawGenes)
model.grRules = regexprep(model.grRules, ['(^|\s|\()' rawGenes{i} '($|\s|\))'], ['$1' model.genes{i} '$2']);
end

problemGenes=find(~cellfun('isempty',regexp(model.genes,'([^0-9_a-zA-Z])')));
originalGenes=model.genes(problemGenes);
replacedGenes=regexprep(model.genes(problemGenes),'([^0-9_a-zA-Z])','__${num2str($1+0)}__');
Expand Down

0 comments on commit 00483a5

Please sign in to comment.