[WIP] Improve input validation and help descriptions for genome utility functions#617
Closed
Copilot wants to merge 1 commit into
Closed
[WIP] Improve input validation and help descriptions for genome utility functions#617Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coding agent has begun work on Improve MATLAB Help Descriptions and Input Validation for Genome Utility Functions and will update this pull request as work progresses.
Original prompt
improve this function by adding if validators of inputs like this for example nargin<1 || isempty(fileName) [fileName, pathName] = uigetfile({'.xml;.sbml'}, 'Please select the model file'); if fileName == 0 error('You should select a model file') else fileName = fullfile(pathName,fileName); end end fileName=char(fileName); if nargin<2 || isempty(removeExcMets) removeExcMets=true; end if nargin<3 || isempty(removePrefix) removePrefix=true; end if nargin<4 supressWarnings=false; end
The user has attached the following files from their workspace:
TITLE: Improve MATLAB Help Descriptions and Input Validation for Genome Utility Functions
USER INTENT: Summarize the full conversation, which covers two sequential tasks: (1) rewriting help blocks for three MATLAB functions, and (2) adding
nargin-style input validators to those same functions following an established RAVEN pattern.TASK DESCRIPTION:
downloadGenomeData,getGeneData, andrenameModelGenesfollowing the structured style used inimportModelandcurateModelFromTables(Parameters / Returns / Examples / Notes / See also sections).nargin < N || isempty(...)pattern already used in RAVEN, includinguigetfileprompts where appropriate,char()casts, default values, and descriptiveerror()messages.EXISTING:
Completed:
downloadGenomeData.m— full structured help block written; input validation block added, including:nargin < 1 || isempty(accession)guard with descriptive errorchar()cast onaccessionstrncmpiformat check forGCF_/GCA_prefixvararginparsed via aforloop withswitch/casefor'outputDir'and'verbose'logMsgwrapper for conditionalfprintfgffFileandfaaFileexplicitly assigned at end of functiongetGeneData.m— full structured help block written (input validation not yet added)renameModelGenes.m— full structured help block written (input validation not yet added)PENDING:
getGeneData.m— addnargin-style input validators for:accession(required,charcast,GCF_/GCA_prefix check)outputFile(optional, default'')gffFile(optional, default triggersdownloadGenomeData)faaFile(optional, default triggersdownloadGenomeData)renameModelGenes.m— addnargin-style input validators for:model(required, must be a struct with.genesand.grRulesfields)geneTable(required, accepttableorcharpath; ifchar, load withreadtable)fromCol(required, must be a valid column name ingeneTable)toCol(required, must be a valid column name ingeneTable)CODE STATE:
downloadGenomeData.m— validation block (completed):