def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "annotation_file" if args.annotation_file is None: xlib.Message.print('error', '*** The annotation file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.annotation_file): xlib.Message.print('error', f'*** The file {args.annotation_file} does not exist.') OK = False # check "type" if args.type is None: xlib.Message.print('error', '*** The type of annotation file is not indicated in the input arguments.') OK = False elif not xlib.check_code(args.type, xlib.get_type2_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** The type of annotation file has to be {xlib.get_type2_code_list_text()}.') OK = False else: args.type = args.type.upper() # check "score_file" if args.score_file is None: xlib.Message.print('error', '*** The sequence score file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.score_file): xlib.Message.print('error', f'*** The file {args.score_file} does not exist.') OK = False # check "go_file" if args.go_file is None: xlib.Message.print('error', '*** The file with GO terms per sequence is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "input_gff_file" if args.input_gff_file is None: xlib.Message.print('error', '*** The input GFF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.input_gff_file): xlib.Message.print('error', f'*** The file {args.input_gff_file} does not exist.') OK = False # check "gff_format" if args.gff_format is None: args.gff_format = 'GFF3' elif args.gff_format.upper() != 'GFF3': xlib.Message.print('error', '*** The format of the GFF file has to be GFF3.') OK = False else: args.gff_format = args.gff_format.upper() # check "vcf_file" if args.vcf_file is None: xlib.Message.print('error', '*** The VCF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.vcf_file): xlib.Message.print('error', f'*** The file {args.vcf_file} does not exist.') OK = False # check "output_gff_file" if args.output_gff_file is None: xlib.Message.print('error', '*** The output VCF file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "toa_database" if args.toa_database is None: xlib.Message.print( 'error', '*** The TOA database is not indicated in the input arguments.') OK = False # check "table_group" if args.table_group is None: xlib.Message.print( 'error', '*** The table group is not indicated in the input arguments.') OK = False elif not xlib.check_code(args.table_group, xlib.get_table_group_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The table group has to be {xlib.get_table_group_code_list_text()}.' ) OK = False else: args.table_group = args.table_group.lower() # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "input_vcf_file" if args.input_vcf_file is None: xlib.Message.print('error', '*** The VCF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.input_vcf_file): xlib.Message.print('error', f'*** The file {args.input_vcf_file} does not exist.') OK = False # check "imputed_md_id" if args.imputed_md_id is None: args.imputed_md_id = xlib.Const.DEFAULT_IMPUTED_MD_ID # check "output_genotype_file" if args.output_genotype_file is None: xlib.Message.print('error', '*** The output genotype data file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # check "tvi_list" if args.tvi_list is None or args.tvi_list == 'NONE': args.tvi_list = [] else: args.tvi_list = xlib.split_literal_to_string_list(args.tvi_list) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "ngshelper_database" if args.ngshelper_database is None: xlib.Message.print('error', '*** The NGShelper database is not indicated in the input arguments.') OK = False # check "alignment_file" if args.alignment_file is None: xlib.Message.print('error', '*** The alignment file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.alignment_file): xlib.Message.print('error', f'*** The file {args.alignment_file} does not exist.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Verity the input arguments data. ''' # initialize the control variable OK = True # check "fasta_file" if args.fasta_file is None: xlib.Message.print( 'error', '*** The input FASTA file is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.fasta_file): xlib.Message.print('error', f'*** The file {args.fasta_file} does not exist.') OK = False # check the output_file value if args.output_file is None: xlib.Message.print( 'error', '*** A output file where filtered transcripts will be saved is not indicated in the input arguments.' ) OK = False else: try: if not os.path.exists(os.path.dirname(args.output_file)): os.makedirs(os.path.dirname(args.output_file)) except Exception as e: xlib.Message.print('error', f'*** EXCEPTION: "{e}".') xlib.Message.print( 'error', f'*** The directory {os.path.dirname(args.output_file)} of the file {args.output_file} is not valid.' ) OK = False # check the minlen value if args.minlen is None: args.minlen = xlib.Const.DEFAULT_MINLEN elif not xlib.check_int(args.minlen, minimum=1): xlib.Message.print( 'error', '*** The minlen has to be a integer number greater than 0.') OK = False else: args.minlen = int(args.minlen) # check the maxlen value if args.maxlen is None: args.maxlen = xlib.Const.DEFAULT_MAXLEN elif not xlib.check_int(args.maxlen, minimum=1): xlib.Message.print( 'error', '*** The maxlen has to be a integer number greater than 0.') OK = False else: args.maxlen = int(args.maxlen) # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # check if maxlen value is greater or equal than minlen value if OK: if args.maxlen < args.minlen: xlib.Message.print( 'error', '*** The maxlen value has to be greater than or equal to minlen.' ) OK = False # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "input_vcf_file" if args.input_vcf_file is None: xlib.Message.print( 'error', '*** The VCF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.input_vcf_file): xlib.Message.print( 'error', f'*** The file {args.input_vcf_file} does not exist.') OK = False # check "purge_operation" is_ok_purge_operation = False if args.purge_operation is None: xlib.Message.print( 'error', '*** The purge operation is not indicated in the input arguments.') OK = False elif not xlib.check_code(args.purge_operation, xlib.get_vcf_purge_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The purge operation has to be {xlib.get_vcf_purge_code_list_text()}.' ) OK = False else: args.purge_operation = args.purge_operation.upper() is_ok_purge_operation = True # check "value" if args.value is None: xlib.Message.print( 'error', '*** The value to perform the purge operation is not indicated the input arguments.' ) OK = False # check "new_value" if args.new_value is None and is_ok_purge_operation and args.purge_operation == 'CHAVAR': xlib.Message.print( 'error', '*** The new value to perform the purge operation is not indicated the input arguments.' ) OK = False elif args.new_value is None: args.new_value = ' NONE' # check "output_purged_file" if args.output_purged_file is None: xlib.Message.print( 'error', '*** The purged file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Verity the input arguments data. ''' # initialize the control variable OK = True # check "cos_file" if args.cos_file is None: xlib.Message.print( 'error', '*** The input COS file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.cos_file): xlib.Message.print('error', f'*** The file {args.cos_file} does not exist.') OK = False # check "ssr_file" if args.ssr_file is None: xlib.Message.print( 'error', '*** The input SSR file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.ssr_file): xlib.Message.print('error', f'*** The file {args.ssr_file} does not exist.') OK = False # check the output_file value if args.output_file is None: xlib.Message.print( 'error', '*** A output file where filtered SSR will be saved is not indicated in the input arguments.' ) OK = False else: try: if not os.path.exists(os.path.dirname(args.output_file)): os.makedirs(os.path.dirname(args.output_file)) except Exception as e: xlib.Message.print('error', f'*** EXCEPTION: "{e}".') xlib.Message.print( 'error', f'*** The directory {os.path.dirname(args.output_file)} of the file {args.output_file} is not valid.' ) OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "app" if args.app is None: xlib.Message.print( 'error', '*** The application is not indicated in the input arguments.') OK = False elif not xlib.check_code( args.app, xlib.get_go_app_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The application has to be {xlib.get_go_app_code_list_text()}.' ) OK = False else: args.app = args.app.upper() # check "annotation_file" if args.annotation_file is None: xlib.Message.print( 'error', '*** The annotation file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.annotation_file): xlib.Message.print( 'error', f'*** The file {args.annotation_file} does not exist.') OK = False # check "ontology_file" if args.ontology_file is None: xlib.Message.print( 'error', '*** The ontology file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.ontology_file): xlib.Message.print( 'error', f'*** The file {args.ontology_file} does not exist.') OK = False # check "output_dir" if args.output_dir is None: xlib.Message.print( 'error', '*** The output directy is not indicated in the input arguments.') OK = False elif not os.path.isdir(args.output_dir): xlib.Message.print('error', '*** The output directy does not exist.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "annotation_file" if args.annotation_file is None: xlib.Message.print( 'error', '*** The annotation file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.annotation_file): xlib.Message.print( 'error', f'*** The file {args.annotation_file} does not exist.') OK = False # check "type" if args.type is None: xlib.Message.print( 'error', '*** The type of annotation file is not indicated in the input arguments.' ) OK = False elif not xlib.check_code( args.type, xlib.get_type_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The type of annotation file has to be {xlib.get_type_code_list_text()}.' ) OK = False else: args.type = args.type.upper() # check "header" if args.header is None: args.header = xlib.Const.DEFAULT_HEADER elif not xlib.check_code( args.header, xlib.get_header_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** header has to be {xlib.get_header_code_list_text()}.') OK = False else: args.header = args.header.upper() # check "record_number_per_file" if args.record_number_per_file is None: args.record_number_per_file = xlib.Const.DEFAULT_RNUM elif not xlib.check_int(args.record_number_per_file, minimum=1): xlib.Message.print( 'error', '*** The record number per splitted file has to be an integer number greater than 0.' ) OK = False else: args.record_number_per_file = int(args.record_number_per_file) # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Verity the input arguments data. ''' # initialize the control variable OK = True # check the assembly_software_code value if args.assembly_software_code is None: xlib.Message.print( 'error', '*** The assembly software that generated the transcritpme file is not indicated in the input arguments.' ) OK = False elif args.assembly_software_code not in [ xlib.Const.AS_TRINITY_CODE, xlib.Const.AS_SOAPDENOVOTRANS_CODE, xlib.Const.AS_GENERATED_BY_NGSCLOUD ]: xlib.Message.print( 'error', f'*** {args.assembly_software_code} is not a valid code of assembly software.' ) OK = False # check the transcriptome_file value if args.transcriptome_file is None: xlib.Message.print( 'error', '*** A transcritpme file in Fasta format is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.transcriptome_file): xlib.Message.print( 'error', f'*** The file {args.transcriptome_file} does not exist.') OK = False # check the score_file value if args.score_file is None: xlib.Message.print( 'error', '*** A score file where RSEM-EVAL (DETONATE package) saved the score of the transcriptome file is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.score_file): xlib.Message.print('error', f'*** The file {args.score_file} does not exist.') OK = False # check the output_file value if args.output_file is None: xlib.Message.print( 'error', '*** A output file where filtered transcripts will be saved is not indicated in the input arguments.' ) OK = False else: try: if not os.path.exists(os.path.dirname(args.output_file)): os.makedirs(os.path.dirname(args.output_file)) except Exception as e: xlib.Message.print( 'error', f'*** The directory {os.path.dirname(args.output_file)} of the file {args.output_file} is not valid.' ) OK = False # check the minlen value if args.minlen is None: args.minlen = xlib.Const.DEFAULT_MINLEN elif not xlib.check_int(args.minlen, minimum=1): xlib.Message.print( 'error', '*** The minlen has to be a integer number greater than 0.') OK = False else: args.minlen = int(args.minlen) # check the maxlen value if args.maxlen is None: args.maxlen = xlib.Const.DEFAULT_MAXLEN elif not xlib.check_int(args.maxlen, minimum=1): xlib.Message.print( 'error', '*** The maxlen has to be a integer number greater than 0.') OK = False else: args.maxlen = int(args.maxlen) # check the minFPKM value if args.minFPKM is None: args.minFPKM = xlib.Const.DEFAULT_MINFPKM elif not xlib.check_float(args.minFPKM, minimum=0.0): print( '*** FPKM has to be a float number greater than or equal to 0.0.') OK = False else: args.minFPKM = float(args.minFPKM) # check the minTPM value if args.minTPM is None: args.minTPM = xlib.Const.DEFAULT_MINTPM elif not xlib.check_float(args.minTPM, minimum=0.0): print( '*** FPKM has to be a float number greater than or equal to 0.0.') OK = False else: args.minTPM = float(args.minTPM) # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # check if maxlen value is greater or equal than minlen value if OK: if args.maxlen < args.minlen: xlib.Message.print( 'error', '*** The maxlen value has to be greater than or equal to minlen.' ) OK = False # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "vcf_file" if args.vcf_file is None: xlib.Message.print( 'error', '*** The input VCF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.vcf_file): xlib.Message.print('error', f'*** The file {args.vcf_file} does not exist.') OK = False # check "genome_file" if args.genome_file is None: xlib.Message.print( 'error', '*** The FASTA genome file is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.genome_file): xlib.Message.print('error', f'*** The file {args.genome_file} does not exist.') OK = False # check "flanking_region_file" if args.flanking_region_file is None: xlib.Message.print( 'error', '*** The FASTA file with flanking regions is not indicated in the input arguments.' ) OK = False # check "nucleotide_number" if args.nucleotide_number is None: args.nucleotide_number = xlib.Const.DEFAULT_NUCLEOTIDE_NUMBER elif not xlib.check_int(args.nucleotide_number, minimum=1): xlib.Message.print( 'error', 'The minimum combined depth across samples has to be an integer number greater than or equal to 1.' ) OK = False else: args.nucleotide_number = int(args.nucleotide_number) # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "simhyb_file" if args.simhyb_file is None: xlib.Message.print( 'error', '*** The SimHyb file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.simhyb_file): xlib.Message.print('error', f'*** The file {args.simhyb_file} does not exist.') OK = False # check "header_row_number" if args.header_row_number is None: xlib.Message.print( 'error', '*** The header row number in the SimHyb file is not indicated in the input arguments.' ) OK = False elif not xlib.check_int(args.header_row_number, minimum=0): xlib.Message.print( 'error', 'The header row number in the SimHyb file has to be an integer number greater than or equalt to 0.' ) OK = False else: args.header_row_number = int(args.header_row_number) # check "structure_file" if args.structure_file is None: xlib.Message.print( 'error', '*** The converted Structure file is not indicated in the input arguments.' ) OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "ngshelper_database" if args.ngshelper_database is None: xlib.Message.print('error', '*** The NGShelper database is not indicated in the input arguments.') OK = False # check "vcf_file" if args.vcf_file is None: xlib.Message.print('error', '*** The VCF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.vcf_file): xlib.Message.print('error', f'*** The file {args.vcf_file} does not exist.') OK = False # check "sample_file" if args.sample_file is None: xlib.Message.print('error', '*** The sample file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.sample_file): xlib.Message.print('error', f'*** The file {args.sample_file} does not exist.') OK = False # check "sp1_id" if args.sp1_id is None: xlib.Message.print('error', '*** The identification of the first species is not indicated in the input arguments.') OK = False # check "sp2_id" if args.sp2_id is None: xlib.Message.print('error', '*** The identification of the second species is not indicated in the input arguments.') OK = False # check "hybrid_id" if args.hybrid_id is None: args.hybrid_id = 'NONE' # check "imputed_md_id" if args.imputed_md_id is None: args.imputed_md_id = xlib.Const.DEFAULT_IMPUTED_MD_ID # check "new_md_id" if args.new_md_id is None: args.new_md_id = xlib.Const.DEFAULT_NEW_MD_ID # check "allele_transformation" if args.allele_transformation is None: args.allele_transformation = 'NONE' elif not xlib.check_code(args.allele_transformation, xlib.get_allele_transformation_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** The allele transformation has to be {xlib.get_allele_transformation_code_list_text()}.') OK = False else: args.allele_transformation = args.allele_transformation.upper() # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # check "tvi_list" if args.tvi_list is None or args.tvi_list == 'NONE': args.tvi_list = [] else: args.tvi_list = xlib.split_literal_to_string_list(args.tvi_list) # check the identification set if OK: if args.sp1_id == args.sp2_id or \ args.hybrid_id is not None and (args.sp1_id == args.hybrid_id or args.sp2_id == args.hybrid_id): xlib.Message.print('error', 'The identifications must be different.') OK = False # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "ngshelper_database" if args.ngshelper_database is None: xlib.Message.print( 'error', '*** The NGShelper database is not indicated in the input arguments.' ) OK = False # check "sp1_id" if args.sp1_id is None: xlib.Message.print( 'error', '*** The identification of the first species is not indicated in the input arguments.' ) OK = False # check "sp2_id" if args.sp2_id is None: xlib.Message.print( 'error', '*** The identification of the second species is not indicated in the input arguments.' ) OK = False # check "hybrid_id" if args.hybrid_id is None: args.hybrid_id = 'NONE' # check "max_separation" if args.max_separation is None: xlib.Message.print( 'error', '*** The maximum separation between variants of the same intergenic fragment is not indicated in the input arguments.' ) OK = False elif not xlib.check_int(args.max_separation, minimum=1): xlib.Message.print( 'error', 'The maximum separation between variants of the same intergenic fragment has to be a integer number greater than 1.' ) OK = False else: args.max_separation = int(args.max_separation) # check "output_dir" if args.output_dir is None: xlib.Message.print( 'error', '*** The output directy is not indicated in the input arguments.') OK = False elif not os.path.isdir(args.output_dir): xlib.Message.print('error', '*** The output directy does not exist.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # check "tsi_list" if args.tsi_list is None or args.tsi_list == 'NONE': args.tsi_list = [] else: args.tsi_list = xlib.split_literal_to_string_list(args.tsi_list) # check the identification set if OK: if args.sp1_id == args.sp2_id or (args.sp1_id == args.hybrid_id or args.sp2_id == args.hybrid_id): xlib.Message.print('error', 'The identifications must be different.') OK = False # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "input_vcf_file" if args.input_vcf_file is None: xlib.Message.print( 'error', '*** The VCF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.input_vcf_file): xlib.Message.print( 'error', f'*** The file {args.input_vcf_file} does not exist.') OK = False # check "sample_file" if args.sample_file is None: xlib.Message.print( 'error', '*** The sample file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.sample_file): xlib.Message.print('error', f'*** The file {args.sample_file} does not exist.') OK = False # check "fix" if args.fix is None: xlib.Message.print('error', '*** Fix is not indicated in the input arguments.') OK = False elif not xlib.check_code( args.fix, xlib.get_fix_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** fix has to be {xlib.get_fix_code_list_text()}.') OK = False else: args.fix = args.fix.upper() # check "scenario" if args.scenario is None: xlib.Message.print( 'error', '*** The scenario is not indicated in the input arguments.') OK = False elif not xlib.check_code(args.scenario, xlib.get_scenario_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The scenario has to be {xlib.get_scenario_code_list_text()}.' ) OK = False # check "min_aa_percentage" if args.min_aa_percentage is None: xlib.Message.print( 'error', '*** The minimum percent of alternative alleles per species is not indicated in the input arguments.' ) OK = False elif not xlib.check_float( args.min_aa_percentage, minimum=0.0, maximum=100.0): xlib.Message.print( 'error', 'The minimum percent of alternative alleles per species has to be a float number between 0.0 and 100.0.' ) OK = False else: args.min_aa_percentage = float(args.min_aa_percentage) # check "min_md_imputation_percentage" if args.min_md_imputation_percentage is None: xlib.Message.print( 'error', '*** The minimum percentage of missing data imputation to a new alternative allele per species is not indicated in the input arguments.' ) OK = False elif not xlib.check_float( args.min_md_imputation_percentage, minimum=0.0, maximum=100.0): xlib.Message.print( 'error', 'The minimum percentage of missing data imputation to a new alternative allele per species has to be a float number between 0.0 and 100.0.' ) OK = False else: args.min_md_imputation_percentage = float( args.min_md_imputation_percentage) # check "imputed_md_id" if args.imputed_md_id is None: args.imputed_md_id = xlib.Const.DEFAULT_IMPUTED_MD_ID # check "sp1_id" if args.sp1_id is None: xlib.Message.print( 'error', '*** The identification of the first species is not indicated in the input arguments.' ) OK = False # check "sp1_max_md_percentage" if args.sp1_max_md_percentage is None: xlib.Message.print( 'error', '*** The maximum percentage of missing data of the first species is not indicated in the input arguments.' ) OK = False elif not xlib.check_float( args.sp1_max_md_percentage, minimum=0.0, maximum=100.0): xlib.Message.print( 'error', 'The maximum percentage of missing data of the first species has to be a float number between 0.0 and 100.0.' ) OK = False else: args.sp1_max_md_percentage = float(args.sp1_max_md_percentage) # check "sp2_id" if args.sp2_id is None: xlib.Message.print( 'error', '*** The identification of the second species is not indicated in the input arguments.' ) OK = False # check "sp2_max_md_percentage" if args.sp2_max_md_percentage is None: xlib.Message.print( 'error', '*** The maximum percentage of missing data of the second species is not indicated in the input arguments.' ) OK = False elif not xlib.check_float( args.sp2_max_md_percentage, minimum=0.0, maximum=100.0): xlib.Message.print( 'error', 'The maximum percentage of missing data of the second species has to be a float number between 0.0 and 100.0.' ) OK = False else: args.sp2_max_md_percentage = float(args.sp2_max_md_percentage) # check "hybrid_id" if args.hybrid_id is None: args.hybrid_id = 'NONE' # check "min_afr_percentage" if args.min_afr_percentage is None: xlib.Message.print( 'error', '*** The minimum percentage of allele frequency per species is not indicated in the input arguments.' ) OK = False elif not xlib.check_float( args.min_afr_percentage, minimum=0.0, maximum=100.0): xlib.Message.print( 'error', 'The minimum percentage of allele frequency per species has to be a float number between 0.0 and 100.0.' ) OK = False else: args.min_afr_percentage = float(args.min_afr_percentage) # check "min_depth" if args.min_depth is None: args.min_depth = xlib.Const.DEFAULT_MIN_DEPTH elif not xlib.check_int(args.min_depth, minimum=1): xlib.Message.print( 'error', 'The minimum combined depth across samples has to be an integer number greater than or equal to 1.' ) OK = False else: args.min_depth = int(args.min_depth) # check "output_vcf_file" if args.output_vcf_file is None: xlib.Message.print( 'error', '*** The output VCF file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # check "tvi_list" if args.tvi_list is None or args.tvi_list == 'NONE': args.tvi_list = [] else: args.tvi_list = xlib.split_literal_to_string_list(args.tvi_list) # check the identification set if OK: if args.sp1_id == args.sp2_id or \ args.hybrid_id is not None and (args.sp1_id == args.hybrid_id or args.sp2_id == args.hybrid_id): xlib.Message.print('error', 'The identifications must be different.') OK = False # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "fasta_file_1" if args.fasta_file_1 is None: xlib.Message.print( 'error', '*** The first FASTA file is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.fasta_file_1): xlib.Message.print( 'error', f'*** The file {args.fasta_file_1} does not exist.') OK = False # check "fasta_file_2" if args.fasta_file_2 is None: xlib.Message.print( 'error', '*** The second FASTA file is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.fasta_file_2): xlib.Message.print( 'error', f'*** The file {args.fasta_file_2} does not exist.') OK = False # check "merged_file" if args.merged_file is None: xlib.Message.print( 'error', '*** The merged file is not indicated in the input arguments.') OK = False # check "merger_operation" if args.merger_operation is None: xlib.Message.print( 'error', '*** The merger operation is not indicated in the input arguments.' ) OK = False elif not xlib.check_code(args.merger_operation, xlib.get_fasta_merger_operation_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The merger operation has to be {xlib.get_fasta_merger_operation_code_list_text()}.' ) OK = False else: args.merger_operation = args.merger_operation.upper() # check "toa_transcriptome_relationship_file" if args.toa_transcriptome_relationship_file is None: args.toa_transcriptome_relationship_file = 'NONE' elif args.toa_transcriptome_relationship_file.upper() == 'NONE': args.toa_transcriptome_relationship_file = args.toa_transcriptome_relationship_file.upper( ) elif not os.path.isfile(args.toa_transcriptome_relationship_file): xlib.Message.print( 'error', f'*** The file {args.toa_transcriptome_relationship_file} does not exist.' ) OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "toa_database" if args.toa_database is None: xlib.Message.print( 'error', '*** The TOA database is not indicated in the input arguments.') OK = False # check "dataset_id" if args.dataset_id is None: xlib.Message.print( 'error', '*** The dataset identification is not indicated in the input arguments.' ) OK = False else: args.dataset_id = args.dataset_id.lower() # check "species_id" if args.species_id is None: xlib.Message.print( 'error', '*** The species identification is not indicated in the input arguments.' ) OK = False else: args.species_id = args.species_id.lower() # check "gene_desc_dir" if args.gene_desc_dir is None: xlib.Message.print( 'error', '*** The gene description file directoty is not indicated in the input arguments.' ) OK = False elif not os.path.isdir(args.gene_desc_dir): xlib.Message.print( 'error', f'*** The directory {args.gene_desc_dir} does not exist.') OK = False # check "interpro_file" if args.interpro_file is None: xlib.Message.print( 'error', '*** The InterPro file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.interpro_file): xlib.Message.print( 'error', f'*** The file {args.interpro_file} does not exist.') OK = False # check "go_file" if args.go_file is None: xlib.Message.print( 'error', '*** The Gene Ontology file is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.go_file): xlib.Message.print('error', f'*** The file {args.go_file} does not exist.') OK = False # check "mapman_file" if args.mapman_file is None: xlib.Message.print( 'error', '*** The MapMan file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.mapman_file): xlib.Message.print('error', f'*** The file {args.mapman_file} does not exist.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # initialize the list used to control variables with NONE values none_variable_list = [] # check "toa_database" if args.toa_database is None: xlib.Message.print('error', '*** The TOA database is not indicated in the input arguments.') OK = False # check "transcriptome_file" if args.transcriptome_file is None: xlib.Message.print('error', '*** The transcriptome file is not indicated in the input arguments.') OK = False elif args.transcriptome_file.upper() == 'NONE': args.transcriptome_file = args.transcriptome_file.upper() none_variable_list.append('transcriptome_file') elif not os.path.isfile(args.transcriptome_file): xlib.Message.print('error', f'*** The file {args.transcriptome_file} does not exist.') OK = False # check "peptide_file" if args.peptide_file is None: xlib.Message.print('error', '*** The peptide file is not indicated in the input arguments.') OK = False elif args.peptide_file.upper() == 'NONE': args.peptide_file = args.peptide_file.upper() none_variable_list.append('peptide_file') elif not os.path.isfile(args.peptide_file): xlib.Message.print('error', f'*** The file {args.peptide_file} does not exist.') OK = False # check "dataset_list" if args.dataset_list is None: xlib.Message.print('error', '*** The list of annotation databases is not indicated in the input arguments.') OK = False elif args.dataset_list.upper() == 'NONE': args.dataset_list = args.dataset_list.upper() none_variable_list.append('dataset_list') else: args.dataset_list = xlib.split_literal_to_string_list(args.dataset_list) # check "non_annotation_file_list" if args.non_annotation_file_list is None: xlib.Message.print('error', '*** The list of non annotated file paths is not indicated in the input arguments.') OK = False elif args.non_annotation_file_list.upper() == 'NONE': args.non_annotation_file_list = args.non_annotation_file_list.upper() none_variable_list.append('non_annotation_file_list') else: args.non_annotation_file_list = xlib.split_literal_to_string_list(args.non_annotation_file_list) for non_annotation_file in args.non_annotation_file_list: if not os.path.isfile(non_annotation_file): xlib.Message.print('error', f'*** The file {non_annotation_file} does not exist.') OK = False # check relationships between "transcriptome_file", "peptide_file", "dataset_list" and "non_annotation_file_list" if len(none_variable_list) not in [0, 4] and len(none_variable_list) == 1 and args.peptide_file != 'NONE': xlib.Message.print('error', '*** all values of "transcriptome_file", "peptide_file", "dataset_list" and "non_annotation_file_list" have to be distinct to NONE or all values have to be NONE.') OK = False # check "annotation_file" if args.annotation_file is None: xlib.Message.print('error', '*** The annotation file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.annotation_file): xlib.Message.print('error', f'*** The file {args.annotation_file} does not exist.') OK = False # check "type" if args.type is None: xlib.Message.print('error', '*** The type of annotation file is not indicated in the input arguments.') OK = False elif not xlib.check_code(args.type, xlib.get_type_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** The type of annotation file has to be {xlib.get_type_code_list_text()}.') OK = False else: args.type = args.type.upper() # check "stats_file" if args.stats_file is None: xlib.Message.print('error', '*** The statistics file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "toa_database" if args.toa_database is None: xlib.Message.print( 'error', '*** The TOA database is not indicated in the input arguments.') OK = False # check "dataset_id" if args.dataset_id is None: xlib.Message.print( 'error', '*** The dataset identification is not indicated in the input arguments.' ) OK = False else: args.dataset_id = args.dataset_id.lower() # check "blast_file_format" if args.blast_file_format is None: xlib.Message.print( 'error', '*** The BLAST file format is not indicated in the input arguments.' ) OK = False elif not xlib.check_code(args.blast_file_format, xlib.get_blast_file_format_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The BLAST file format has to be {xlib.get_blast_file_format_code_list_text()}.' ) OK = False # check "blast_file" if args.blast_file is None: xlib.Message.print( 'error', '*** The BLAST file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.blast_file): xlib.Message.print('error', f'*** The file {args.blast_file} does not exist.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "xml_file_list" if args.xml_file_list is None: xlib.Message.print( 'error', '*** The list of XML file paths is not indicated in the input arguments.' ) OK = False else: # initialize the XML file list xml_file_list = [] # split "xml_file_list" in a string values list xml_file_list = args.xml_file_list.split(',') # check if XML file exist for i in range(len(xml_file_list)): xml_file_list[i] = xml_file_list[i].strip() if not os.path.isfile(xml_file_list[i]): xlib.Message.print( 'error', f'*** The file {xml_file_list[i].strip()} does not exist.') OK = False # set the argument value args.xml_file_list = xml_file_list # check "toa_transcriptome_relationship_file" if args.toa_transcriptome_relationship_file is None: args.toa_transcriptome_relationship_file = 'NONE' elif args.toa_transcriptome_relationship_file.upper() == 'NONE': args.toa_transcriptome_relationship_file = args.toa_transcriptome_relationship_file.upper( ) elif not os.path.isfile(args.toa_transcriptome_relationship_file): xlib.Message.print( 'error', f'*** The file {args.toa_transcriptome_relationship_file} does not exist.' ) OK = False # check "toa_transdecoder_relationship_file" if args.toa_transdecoder_relationship_file is None: args.toa_transdecoder_relationship_file = 'NONE' elif args.toa_transdecoder_relationship_file.upper() == 'NONE': args.toa_transdecoder_relationship_file = args.toa_transdecoder_relationship_file.upper( ) elif args.toa_transdecoder_relationship_file.upper( ) != 'NONE' and args.toa_transcriptome_relationship_file.upper() == 'NONE': xlib.Message.print( 'error', '*** The TOA-TransDecoder identification relationships file has to be NONE when TOA-transcriptome identification relationships file is NONE.' ) OK = False elif not os.path.isfile(args.toa_transdecoder_relationship_file): xlib.Message.print( 'error', f'*** The file {args.toa_transdecoder_relationship_file} does not exist.' ) OK = False # check "merged_file" if args.merged_file is None: xlib.Message.print( 'error', '*** The merged file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "vcf_file" if args.vcf_file is None: xlib.Message.print( 'error', '*** The VCF file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.vcf_file): xlib.Message.print('error', f'*** The file {args.vcf_file} does not exist.') OK = False # check "sample_file" if args.sample_file is None: xlib.Message.print( 'error', '*** The sample file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.sample_file): xlib.Message.print('error', f'*** The file {args.sample_file} does not exist.') OK = False # check "sp1_id" if args.sp1_id is None: xlib.Message.print( 'error', '*** The identification of the first species is not indicated in the input arguments.' ) OK = False # check "sp2_id" if args.sp2_id is None: xlib.Message.print( 'error', '*** The identification of the second species is not indicated in the input arguments.' ) OK = False # check "hybrid_id" if args.hybrid_id is None: args.hybrid_id = 'NONE' # check "output_dir" if args.output_dir is None: xlib.Message.print( 'error', '*** The output directy is not indicated in the input arguments.') OK = False elif not os.path.isdir(args.output_dir): xlib.Message.print('error', '*** The output directy does not exist.') OK = False # check "variant_number_per_file" if args.variant_number_per_file is None: args.variant_number_per_file = xlib.Const.DEFAULT_VARIANT_NUMBER_PER_FILE elif not xlib.check_int(args.variant_number_per_file, minimum=1): xlib.Message.print( 'error', 'The variant number per file has to be an integer number greater than 0.' ) OK = False else: args.variant_number_per_file = int(args.variant_number_per_file) # check "allele_transformation" if args.allele_transformation is None: args.allele_transformation = 'NONE' elif not xlib.check_code(args.allele_transformation, xlib.get_allele_transformation_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** The allele transformation has to be {xlib.get_allele_transformation_code_list_text()}.' ) OK = False else: args.allele_transformation = args.allele_transformation.upper() # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # check "tvi_list" if args.tvi_list is None or args.tvi_list == 'NONE': args.tvi_list = [] else: args.tvi_list = xlib.split_literal_to_string_list(args.tvi_list) # check the identification set if OK: if args.sp1_id == args.sp2_id or \ args.hybrid_id is not None and (args.sp1_id == args.hybrid_id or args.sp2_id == args.hybrid_id): xlib.Message.print('error', 'The identifications must be different.') OK = False # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "toa_database" if args.toa_database is None: xlib.Message.print( 'error', '*** The TOA database is not indicated in the input arguments.') OK = False # check "ontology_file" if args.ontology_file is None: xlib.Message.print( 'error', '*** The ontology file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.ontology_file): xlib.Message.print( 'error', f'*** The file {args.ontology_file} does not exist.') OK = False # check "ec2go_file" if args.ec2go_file is None: xlib.Message.print( 'error', '*** The ec2go file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.ec2go_file): xlib.Message.print('error', f'*** The file {args.ec2go_file} does not exist.') OK = False # check "kegg2go_file" if args.kegg2go_file is None: xlib.Message.print( 'error', '*** The kegg2go file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.kegg2go_file): xlib.Message.print( 'error', f'*** The file {args.kegg2go_file} does not exist.') OK = False # check "metacyc2go_file" if args.metacyc2go_file is None: xlib.Message.print( 'error', '*** The metacyc2go file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.metacyc2go_file): xlib.Message.print( 'error', f'*** The file {args.metacyc2go_file} does not exist.') OK = False # check "interpro2go_file" if args.interpro2go_file is None: xlib.Message.print( 'error', '*** The interpro2go file is not indicated in the input arguments.' ) OK = False elif not os.path.isfile(args.interpro2go_file): xlib.Message.print( 'error', f'*** The file {args.interpro2go_file} does not exist.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "annotation_file_1" if args.annotation_file_1 is None: xlib.Message.print('error', '*** The first annotation file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.annotation_file_1): xlib.Message.print('error', f'*** The file {args.annotation_file_1} does not exist.') OK = False # check "type_1" if args.type_1 is None: xlib.Message.print('error', '*** The type of first annotation file is not indicated in the input arguments.') OK = False elif not xlib.check_code(args.type_1, xlib.get_type_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** The type of annotation file has to be {xlib.get_type_code_list_text()}.') OK = False else: args.type_1 = args.type_1.upper() # check "annotation_file_2" if args.annotation_file_2 is None: xlib.Message.print('error', '*** The second annotation file is not indicated in the input arguments.') OK = False elif args.annotation_file_2.upper() == 'NONE': args.annotation_file_2 = args.annotation_file_2.upper() elif not os.path.isfile(args.annotation_file_2): xlib.Message.print('error', f'*** The file {args.annotation_file_2} does not exist.') OK = False # check "type_2" if args.type_2 is None: xlib.Message.print('error', '*** The format of second annotation file is not indicated in the input arguments.') OK = False elif args.type_2.upper() == 'NONE' and args.annotation_file_2 != 'NONE': xlib.Message.print('error', '*** The format of second annotation file has to be NONE if the second annotation file is NONE') OK = False elif args.type_2.upper() == 'NONE' and args.annotation_file_2 == 'NONE': args.type_2 = args.type_2.upper() elif not xlib.check_code(args.type_2, xlib.get_type_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** The type of annotation file has to be {xlib.get_type_code_list_text()}.') OK = False else: args.type_2 = args.type_2.upper() # check "merger_file" if args.merger_file is None: xlib.Message.print('error', '*** The merged file is not indicated in the input arguments.') OK = False # check "merger_operation" if args.merger_operation is None: xlib.Message.print('error', '*** The merger operation is not indicated in the input arguments.') OK = False elif args.merger_operation.upper() == 'SAVE1' and args.annotation_file_2 != 'NONE': xlib.Message.print('error', '*** The merger operation SAVE1 is only valid when the second annotation file is NONE.') OK = False elif args.merger_operation.upper() != 'SAVE1' and not xlib.check_code(args.merger_operation, xlib.get_annotation_merger_operation_code_list(), case_sensitive=False) : xlib.Message.print('error', f'*** The merger operation has to be {xlib.get_annotation_merger_operation_code_list_text()}.') OK = False else: args.merger_operation = args.merger_operation.upper() # check "header" if args.header is None: args.header = xlib.Const.DEFAULT_HEADER elif not xlib.check_code(args.header, xlib.get_header_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** header has to be {xlib.get_header_code_list_text()}.') OK = False else: args.header = args.header.upper() # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "phase_dir" if args.phase_dir is None: xlib.Message.print('error', '*** The PHASE file directory is not indicated in the input arguments.') OK = False elif not os.path.isdir(args.phase_dir): xlib.Message.print('error', f'*** The directory {args.phase_dir} does not exist.') OK = False # check "phase_extension" if args.phase_extension is None: xlib.Message.print('error', '*** The extension of PHASE files is not indicated in the input arguments.') OK = False # check "sample_file" if args.sample_file is None: xlib.Message.print('error', '*** The sample file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.sample_file): xlib.Message.print('error', f'*** The file {args.sample_file} does not exist.') OK = False # check "sp1_id" if args.sp1_id is None: xlib.Message.print('error', '*** The identification of the first species is not indicated the input arguments.') OK = False # check "sp2_id" if args.sp2_id is None: xlib.Message.print('error', '*** The identification of the second species is not indicated in the input arguments.') OK = False # check "hybrid_id" if args.hybrid_id is None: args.hybrid_id = 'NONE' # check "structure_file" if args.structure_file is None: xlib.Message.print('error', '*** The converted Structure file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Verity the input arguments. ''' # initialize the control variable OK = True # check loci_file_path if args.loci_file_path is None: xlib.Message.print( 'error', '*** A loci file path is not indicated in the input arguments.') OK = False else: if not os.path.isfile(args.loci_file_path): xlib.Message.print( 'error', f'*** The file {args.loci_file_path} does not exist.') OK = False if not args.loci_file_path.endswith('.loci'): xlib.Message.print( 'error', f'*** The file {args.loci_file_path} does not end in ".loci".') OK = False # check stats_file_path if args.stats_file_path is None: xlib.Message.print( 'error', '*** A statistics path is not indicated in the input arguments.') OK = False else: if not args.stats_file_path.endswith('.csv'): xlib.Message.print( 'error', f'*** The file {args.stats_file_path} does not end in ".csv".') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code( args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code( args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print( 'error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('', 'P001')
def check_args(args): ''' Check the input arguments. ''' # initialize the control variable OK = True # check "input_file" if args.input_file is None: xlib.Message.print('error', '*** The input file is not indicated in the input arguments.') OK = False elif not os.path.isfile(args.input_file): xlib.Message.print('error', f'*** The file {args.input_file} does not exist.') OK = False # check "file_format" if args.file_format is None: xlib.Message.print('error', '*** The merger operation is not indicated in the input arguments.') OK = False elif not xlib.check_code(args.file_format, xlib.get_restored_file_format_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** The merger operation has to be {xlib.get_restored_file_format_code_list_text()}.') OK = False else: args.file_format = args.file_format.upper() # check "toa_transcriptome_relationship_file" if args.toa_transcriptome_relationship_file is None: xlib.Message.print('error', '*** The file with TOA-transcriptome identification relationships.') OK = False elif not os.path.isfile(args.toa_transcriptome_relationship_file): xlib.Message.print('error', f'*** The file {args.toa_transcriptome_relationship_file} does not exist.') OK = False # check "toa_transdecoder_relationship_file" if args.toa_transdecoder_relationship_file is None: xlib.Message.print('error', '*** The file path with TOA-TransDecoder identification relationships.') elif args.toa_transdecoder_relationship_file.upper() == 'NONE': args.toa_transdecoder_relationship_file = args.toa_transdecoder_relationship_file.upper() elif not os.path.isfile(args.toa_transdecoder_relationship_file): xlib.Message.print('error', f'*** The file {args.toa_transdecoder_relationship_file} does not exist.') OK = False # check "output_file" if args.output_file is None: xlib.Message.print('error', '*** The output file is not indicated in the input arguments.') OK = False # check "verbose" if args.verbose is None: args.verbose = xlib.Const.DEFAULT_VERBOSE elif not xlib.check_code(args.verbose, xlib.get_verbose_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** verbose has to be {xlib.get_verbose_code_list_text()}.') OK = False if args.verbose.upper() == 'Y': xlib.Message.set_verbose_status(True) # check "trace" if args.trace is None: args.trace = xlib.Const.DEFAULT_TRACE elif not xlib.check_code(args.trace, xlib.get_trace_code_list(), case_sensitive=False): xlib.Message.print('error', f'*** trace has to be {xlib.get_trace_code_list_text()}.') OK = False if args.trace.upper() == 'Y': xlib.Message.set_trace_status(True) # if there are errors, exit with exception if not OK: raise xlib.ProgramException('P001')