def parse_cli_args(): """Parse command line arguments""" parser = argparse.ArgumentParser( description='Check if a set of files adheres to the PEtab format.') # General options: parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='More verbose output') # Call with set of files parser.add_argument('-s', '--sbml', dest='sbml_file_name', help='SBML model filename') parser.add_argument('-m', '--measurements', dest='measurement_file_name', help='Measurement table') parser.add_argument('-c', '--conditions', dest='condition_file_name', help='Conditions table') parser.add_argument('-p', '--parameters', dest='parameter_file_name', help='Parameter table') # or with model name, following default naming parser.add_argument('-n', '--model-name', dest='model_name', help='Model name where all files are in the working ' 'directory and follow PEtab naming convention. ' 'Specifying -[smcp] will override defaults') args = parser.parse_args() if args.model_name: if not args.sbml_file_name: args.sbml_file_name = petab.get_default_sbml_file_name( args.model_name) if not args.measurement_file_name: args.measurement_file_name = \ petab.get_default_measurement_file_name(args.model_name) if not args.condition_file_name: args.condition_file_name = petab.get_default_condition_file_name( args.model_name) if not args.parameter_file_name: args.parameter_file_name = petab.get_default_parameter_file_name( args.model_name) if not args.model_name and \ (not args.sbml_file_name or not args.condition_file_name or not args.measurement_file_name): # TODO: we should also allow running (limited) tests on a subset of # files parser.error('When not specifying a model name, sbml, ' 'condition and measurement file must be specified') return args
def parse_cli_args(): """Parse command line arguments""" parser = argparse.ArgumentParser( description='Import PEtab-format model into AMICI.') # General options: parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='More verbose output') parser.add_argument('-o', '--output-dir', dest='model_output_dir', help='Name of the model directory to create') parser.add_argument('--no-compile', action='store_false', dest='compile', help='Only generate model code, do not compile') # Call with set of files parser.add_argument('-s', '--sbml', dest='sbml_file_name', help='SBML model filename') parser.add_argument('-m', '--measurements', dest='measurement_file_name', help='Measurement table') parser.add_argument('-c', '--conditions', dest='condition_file_name', help='Conditions table') parser.add_argument('-p', '--parameters', dest='parameter_file_name', help='Parameter table') # or with model name, following default naming parser.add_argument('-n', '--model-name', dest='model_name', help='Model name where all files are in the working ' 'directory and follow PEtab naming convention. ' 'Specifying -[smcp] will override defaults') args = parser.parse_args() if args.model_name: if not args.sbml_file_name: args.sbml_file_name = petab.get_default_sbml_file_name( args.model_name) if not args.measurement_file_name: args.measurement_file_name = \ petab.get_default_measurement_file_name(args.model_name) if not args.condition_file_name: args.condition_file_name = petab.get_default_condition_file_name( args.model_name) if not args.parameter_file_name: args.parameter_file_name = petab.get_default_parameter_file_name( args.model_name) if not args.model_name and \ (not args.sbml_file_name or not args.condition_file_name or not args.measurement_file_name): parser.error('When not specifying a model name, sbml, ' 'condition and measurement file must be specified') return args
def parse_cli_args(): """Parse command line arguments""" parser = argparse.ArgumentParser( description='Check if a set of files adheres to the PEtab format.') # General options: parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='More verbose output') # Call with set of files parser.add_argument('-s', '--sbml', dest='sbml_file_name', help='SBML model filename') parser.add_argument('-o', '--observables', dest='observable_file_name', help='Observable table') parser.add_argument('-m', '--measurements', dest='measurement_file_name', help='Measurement table') parser.add_argument('-c', '--conditions', dest='condition_file_name', help='Conditions table') parser.add_argument('-p', '--parameters', dest='parameter_file_name', help='Parameter table') group = parser.add_mutually_exclusive_group() group.add_argument('-y', '--yaml', dest='yaml_file_name', help='PEtab YAML problem filename') # or with model name, following default naming group.add_argument('-n', '--model-name', dest='model_name', help='Model name where all files are in the working ' 'directory and follow PEtab naming convention. ' 'Specifying -[smcp] will override defaults') parser.add_argument('-d', '--directory', dest='directory', default=os.getcwd()) args = parser.parse_args() if args.model_name: if not args.sbml_file_name: args.sbml_file_name = petab.get_default_sbml_file_name( args.model_name, folder=args.directory, ) if not args.measurement_file_name: args.measurement_file_name = \ petab.get_default_measurement_file_name( args.model_name, folder=args.directory, ) if not args.condition_file_name: args.condition_file_name = petab.get_default_condition_file_name( args.model_name, folder=args.directory, ) if not args.parameter_file_name: args.parameter_file_name = petab.get_default_parameter_file_name( args.model_name, folder=args.directory, ) if (args.yaml_file_name and any( (args.sbml_file_name, args.condition_file_name, args.measurement_file_name, args.parameter_file_name))): parser.error('When providing a yaml file, no other files may ' 'be specified.') if (not args.model_name and not any([ args.sbml_file_name, args.condition_file_name, args.measurement_file_name, args.parameter_file_name, args.observable_file_name, args.yaml_file_name ])): parser.error('Neither model name nor any filename specified. ' 'What shall I do?') return args