Skip to content

Commit

Permalink
refactor: identifier prefixes (#566)
Browse files Browse the repository at this point in the history
* refactor: default behaviour add/remove prefixes

* fix: filenames

* fix: update test result importExport
  • Loading branch information
edkerk authored Oct 14, 2024
1 parent 792d982 commit 5dcec1c
Show file tree
Hide file tree
Showing 20 changed files with 2,522 additions and 2,550 deletions.
19 changes: 7 additions & 12 deletions core/checkModelStruct.m
Original file line number Diff line number Diff line change
Expand Up @@ -250,22 +250,17 @@ function checkModelStruct(model,throwErrors,trimWarnings)
fieldPrefix = {'R_';'M_';'C_';'G_'};
for i=1:numel(fields)
try
numIDs = startsWith(model.(fields{i}),digitsPattern(1));
numIDs = ~startsWith(model.(fields{i}),regexpPattern('^[a-zA-Z_]'));
catch
numIDs = [];
end
if any(numIDs)
EM = ['The following ' fieldNames{i} ' identifiers start with a ' ...
'digit, which does not comply with SBML specifications. This ' ...
'does not impact RAVEN functionality, but before exporting ' ...
'the model to SBML you should either (a) correct these ' ...
'identifiers directly; or (b) run "model = addCOBRAstylePrefixes ' ...
'(model,''' fields{i} ''');" to have COBRA style "' fieldPrefix{i} ...
'" prefixes added to all ' fieldNames{i} ' identifiers; or (c) ' ...
'let exportModel add COBRA style prefixes to all identifiers ' ...
'in the model by setting COBRAstyle as true. Example: ' ...
'"exportModel(model, ''filename.xml'', true);"'];
dispEM(EM,throwErrors,{model.(fields{i}){numIDs}},trimWarnings);
EM = ['The following ' fieldNames{i} ' identifiers do not start '...
'with a letter or _ (conflicting with SBML specifications). '...
'This does not impact RAVEN functionality, but be aware that '...
'exportModel will automatically add ' fieldPrefix{i} ...
' prefixes to all ' fieldNames{i} ' identifiers:'];
dispEM(EM,false,{model.(fields{i}){numIDs}},trimWarnings);
end
end

Expand Down
399 changes: 197 additions & 202 deletions doc/core/checkModelStruct.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ <h2>Matlab Files found in these Directories</h2>
<td><a href="INIT/INITStepDesc.html" title="INIT">INITStepDesc</a></td> <td><a href="core/expandModel.html" title="core">expandModel</a></td> <td><a href="plotting/getObjectiveString.html" title="plotting">getObjectiveString</a></td> <td><a href="core/randomSampling.html" title="core">randomSampling</a></td> </tr> <tr>
<td><a href="testing/manual_tests/ManualINITTests.html" title="testing\manual_tests">ManualINITTests</a></td> <td><a href="io/exportForGit.html" title="io">exportForGit</a></td> <td><a href="pathway/getPathwayDimensions.html" title="pathway">getPathwayDimensions</a></td> <td><a href="struct_conversion/ravenCobraWrapper.html" title="struct_conversion">ravenCobraWrapper</a></td> </tr> <tr>
<td><a href="io/SBMLFromExcel.html" title="io">SBMLFromExcel</a></td> <td><a href="io/exportModel.html" title="io">exportModel</a></td> <td><a href="external/kegg/getPhylDist.html" title="external\kegg">getPhylDist</a></td> <td><a href="io/readYAMLmodel.html" title="io">readYAMLmodel</a></td> </tr> <tr>
<td><a href="struct_conversion/addCOBRAstylePrefixes.html" title="struct_conversion">addCOBRAstylePrefixes</a></td> <td><a href="io/exportModelToSIF.html" title="io">exportModelToSIF</a></td> <td><a href="external/kegg/getRxnsFromKEGG.html" title="external\kegg">getRxnsFromKEGG</a></td> <td><a href="core/removeBadRxns.html" title="core">removeBadRxns</a></td> </tr> <tr>
<td><a href="core/addExchangeRxns.html" title="core">addExchangeRxns</a></td> <td><a href="io/exportToExcelFormat.html" title="io">exportToExcelFormat</a></td> <td><a href="external/metacyc/getRxnsFromMetaCyc.html" title="external\metacyc">getRxnsFromMetaCyc</a></td> <td><a href="struct_conversion/removeCOBRAstylePrefixes.html" title="struct_conversion">removeCOBRAstylePrefixes</a></td> </tr> <tr>
<td><a href="core/addGenesRaven.html" title="core">addGenesRaven</a></td> <td><a href="io/exportToTabDelimited.html" title="io">exportToTabDelimited</a></td> <td><a href="core/getRxnsInComp.html" title="core">getRxnsInComp</a></td> <td><a href="core/removeGenes.html" title="core">removeGenes</a></td> </tr> <tr>
<td><a href="core/addExchangeRxns.html" title="core">addExchangeRxns</a></td> <td><a href="io/exportModelToSIF.html" title="io">exportModelToSIF</a></td> <td><a href="external/kegg/getRxnsFromKEGG.html" title="external\kegg">getRxnsFromKEGG</a></td> <td><a href="core/removeBadRxns.html" title="core">removeBadRxns</a></td> </tr> <tr>
<td><a href="core/addGenesRaven.html" title="core">addGenesRaven</a></td> <td><a href="io/exportToExcelFormat.html" title="io">exportToExcelFormat</a></td> <td><a href="external/metacyc/getRxnsFromMetaCyc.html" title="external\metacyc">getRxnsFromMetaCyc</a></td> <td><a href="core/removeGenes.html" title="core">removeGenes</a></td> </tr> <tr>
<td><a href="struct_conversion/addIdentifierPrefix.html" title="struct_conversion">addIdentifierPrefix</a></td> <td><a href="io/exportToTabDelimited.html" title="io">exportToTabDelimited</a></td> <td><a href="core/getRxnsInComp.html" title="core">getRxnsInComp</a></td> <td><a href="struct_conversion/removeIdentifierPrefix.html" title="struct_conversion">removeIdentifierPrefix</a></td> </tr> <tr>
<td><a href="io/addJavaPaths.html" title="io">addJavaPaths</a></td> <td><a href="struct_conversion/extractMiriam.html" title="struct_conversion">extractMiriam</a></td> <td><a href="io/getToolboxVersion.html" title="io">getToolboxVersion</a></td> <td><a href="INIT/removeLowScoreGenes.html" title="INIT">removeLowScoreGenes</a></td> </tr> <tr>
<td><a href="core/addMets.html" title="core">addMets</a></td> <td><a href="core/fillGaps.html" title="core">fillGaps</a></td> <td><a href="core/getTransportRxns.html" title="core">getTransportRxns</a></td> <td><a href="core/removeMets.html" title="core">removeMets</a></td> </tr> <tr>
<td><a href="installation/addRavenToUserPath.html" title="installation">addRavenToUserPath</a></td> <td><a href="testing/unit_tests/fillGapsLargeTests.html" title="testing\unit_tests">fillGapsLargeTests</a></td> <td><a href="external/kegg/getWSLpath.html" title="external\kegg">getWSLpath</a></td> <td><a href="installation/removeRavenFromPath.html" title="installation">removeRavenFromPath</a></td> </tr> <tr>
Expand Down
4 changes: 2 additions & 2 deletions doc/io/SBMLFromExcel.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="exportModel.html" class="code" title="function exportModel(model,fileName,COBRAstyle,supressWarnings,sortIds)">exportModel</a> exportModel</li><li><a href="importExcelModel.html" class="code" title="function model=importExcelModel(fileName,removeExcMets,printWarnings,ignoreErrors)">importExcelModel</a> importExcelModel</li></ul>
<li><a href="exportModel.html" class="code" title="function exportModel(model,fileName,neverPrefix,supressWarnings,sortIds)">exportModel</a> exportModel</li><li><a href="importExcelModel.html" class="code" title="function model=importExcelModel(fileName,removeExcMets,printWarnings,ignoreErrors)">importExcelModel</a> importExcelModel</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
Expand Down Expand Up @@ -87,7 +87,7 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0027
0028 model=<a href="importExcelModel.html" class="code" title="function model=importExcelModel(fileName,removeExcMets,printWarnings,ignoreErrors)">importExcelModel</a>(fileName,false,printWarnings);
0029 printModelStats(model,printWarnings,false);
0030 <a href="exportModel.html" class="code" title="function exportModel(model,fileName,COBRAstyle,supressWarnings,sortIds)">exportModel</a>(model,outputFileName,toCOBRA,true);
0030 <a href="exportModel.html" class="code" title="function exportModel(model,fileName,neverPrefix,supressWarnings,sortIds)">exportModel</a>(model,outputFileName,toCOBRA,true);
0031 <span class="keyword">end</span></pre></div>
<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
Expand Down
2 changes: 1 addition & 1 deletion doc/io/checkFileExistence.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="exportModel.html" class="code" title="function exportModel(model,fileName,COBRAstyle,supressWarnings,sortIds)">exportModel</a> exportModel</li><li><a href="getMD5Hash.html" class="code" title="function md5Hash=getMD5Hash(inputFile,binEnd)">getMD5Hash</a> getMD5Hash</li><li><a href="importModel.html" class="code" title="function model=importModel(fileName,removeExcMets,COBRAstyle,supressWarnings)">importModel</a> importModel</li></ul>
<li><a href="exportModel.html" class="code" title="function exportModel(model,fileName,neverPrefix,supressWarnings,sortIds)">exportModel</a> exportModel</li><li><a href="getMD5Hash.html" class="code" title="function md5Hash=getMD5Hash(inputFile,binEnd)">getMD5Hash</a> getMD5Hash</li><li><a href="importModel.html" class="code" title="function model=importModel(fileName,removeExcMets,removePrefix,supressWarnings)">importModel</a> importModel</li></ul>
<!-- crossreference -->


Expand Down
4 changes: 2 additions & 2 deletions doc/io/exportForGit.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="exportModel.html" class="code" title="function exportModel(model,fileName,COBRAstyle,supressWarnings,sortIds)">exportModel</a> exportModel</li><li><a href="exportToExcelFormat.html" class="code" title="function exportToExcelFormat(model,fileName,sortIds)">exportToExcelFormat</a> exportToExcelFormat</li><li><a href="getToolboxVersion.html" class="code" title="function version = getToolboxVersion(toolbox,fileID,mainBranchFlag)">getToolboxVersion</a> getToolboxVersion</li><li><a href="sortIdentifiers.html" class="code" title="function newModel = sortIdentifiers(model)">sortIdentifiers</a> exportModel</li><li><a href="writeYAMLmodel.html" class="code" title="function writeYAMLmodel(model,fileName,preserveQuotes,sortIds)">writeYAMLmodel</a> writeYAMLmodel</li></ul>
<li><a href="exportModel.html" class="code" title="function exportModel(model,fileName,neverPrefix,supressWarnings,sortIds)">exportModel</a> exportModel</li><li><a href="exportToExcelFormat.html" class="code" title="function exportToExcelFormat(model,fileName,sortIds)">exportToExcelFormat</a> exportToExcelFormat</li><li><a href="getToolboxVersion.html" class="code" title="function version = getToolboxVersion(toolbox,fileID,mainBranchFlag)">getToolboxVersion</a> getToolboxVersion</li><li><a href="sortIdentifiers.html" class="code" title="function newModel = sortIdentifiers(model)">sortIdentifiers</a> exportModel</li><li><a href="writeYAMLmodel.html" class="code" title="function writeYAMLmodel(model,fileName,preserveQuotes,sortIds)">writeYAMLmodel</a> writeYAMLmodel</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
Expand Down Expand Up @@ -222,7 +222,7 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0142
0143 <span class="comment">% Write XML format</span>
0144 <span class="keyword">if</span> ismember(<span class="string">'xml'</span>, formats)
0145 <a href="exportModel.html" class="code" title="function exportModel(model,fileName,COBRAstyle,supressWarnings,sortIds)">exportModel</a>(model,fullfile(filePath{5},strcat(prefix,<span class="string">'.xml'</span>)),COBRAstyle);
0145 <a href="exportModel.html" class="code" title="function exportModel(model,fileName,neverPrefix,supressWarnings,sortIds)">exportModel</a>(model,fullfile(filePath{5},strcat(prefix,<span class="string">'.xml'</span>)),COBRAstyle);
0146 <span class="keyword">end</span>
0147
0148 <span class="comment">%Save file with versions:</span>
Expand Down
Loading

0 comments on commit 5dcec1c

Please sign in to comment.