def form_manage_toa_database(process_type): ''' Manage the TOA database. ''' # initialize the control variable OK = True # print the header clib.clear_screen() if process_type == xlib.get_toa_type_recreate(): clib.print_headers_with_environment( f'{xlib.get_toa_name()} - Recreate database') elif process_type == xlib.get_toa_type_rebuild(): clib.print_headers_with_environment( f'{xlib.get_toa_name()} - Rebuild database') # confirm the process run if OK: print(xlib.get_separator()) OK = clib.confirm_action( f'The {xlib.get_toa_name()} database is going to be {process_type}.' ) # run the process if OK: devstdout = xlib.DevStdOut(xtoa.manage_toa_database.__name__) OK = xtoa.manage_toa_database(process_type, devstdout, function=None) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_edit_pipeline_config_file(pipeline_type): ''' Edit a pipeline config file to change the parameters of each process. ''' # initialize the control variable OK = True # set the pipeline name if pipeline_type == xlib.get_toa_process_pipeline_nucleotide_code(): name = xlib.get_toa_process_pipeline_nucleotide_name() elif pipeline_type == xlib.get_toa_process_pipeline_aminoacid_code(): name = xlib.get_toa_process_pipeline_aminoacid_name() elif pipeline_type == xlib.get_toa_process_merge_annotations_code(): name = xlib.get_toa_process_merge_annotations_name() # print the header clib.clear_screen() clib.print_headers_with_environment(f'{name} - Edit config file') # get the config file if pipeline_type == xlib.get_toa_process_pipeline_nucleotide_code(): config_file = xtoa.get_nucleotide_pipeline_config_file() elif pipeline_type == xlib.get_toa_process_pipeline_aminoacid_code(): config_file = xtoa.get_aminoacid_pipeline_config_file() elif pipeline_type == xlib.get_toa_process_merge_annotations_code(): config_file = xtoa.get_annotation_merger_config_file() # edit the read transfer config file print(xlib.get_separator()) print(f'Editing the {name} config file ...') command = f'{xlib.get_editor()} {config_file}' rc = subprocess.call(command, shell=True) if rc != 0: print(f'*** ERROR: RC {rc} in command -> {command}') OK = False # check the config file if OK: print(xlib.get_separator()) print(f'Checking the {name} config file ...') if pipeline_type == xlib.get_toa_process_pipeline_nucleotide_code(): (OK, error_list) = xtoa.check_pipeline_config_file(pipeline_type, strict=False) elif pipeline_type == xlib.get_toa_process_pipeline_aminoacid_code(): (OK, error_list) = xtoa.check_pipeline_config_file(pipeline_type, strict=False) elif pipeline_type == xlib.get_toa_process_merge_annotations_code(): (OK, error_list) = xtoa.check_annotation_merger_config_file( strict=False) if OK: print('The file is OK.') else: print() for error in error_list: print(error) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_show_cluster_composing(): ''' Show cluster information of every node: OS, CPU number and memory. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Cluster operation - Show cluster composing') # get the cluster name print(xlib.get_separator()) if xec2.get_running_cluster_list(volume_creator_included=False) == []: print('WARNING: There is not any running cluster.') OK = False else: cluster_name = cinputs.input_cluster_name(volume_creator_included=False, help=True) # show the status of batch jobs if OK: devstdout = xlib.DevStdOut(xcluster.show_cluster_composing.__name__) xcluster.show_cluster_composing(cluster_name, devstdout, function=None) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def build_menu_toa_taxonomy(): ''' Build the menu NCBI Taxonomy. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment(xlib.get_toa_data_taxonomy_name()) # print the menu options print( 'Options:') print() print( ' 1. Download taxonomy data from NCBI server') print() print( ' X. Return to menu Genomic databases') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_manage_genomic_database(xlib.get_toa_type_download_data(), xlib.get_toa_data_taxonomy_code()) elif option == 'X': break
def form_list_keypairs(): ''' List the key pairs of a region. ''' # print the header clib.clear_screen() clib.print_headers_with_environment('Security - List key pairs') # get the key pair dictionary and the keypair names list keypairs_dict = xec2.get_keypair_dict(region_name) keypair_keys_list = sorted(keypairs_dict.keys()) # list keypairs print(xlib.get_separator()) if keypair_keys_list == []: print('WARNING: There is not any keypair created in the region {0}.'.format(region_name)) else: # set data width keypair_name_width = 25 fingerprint_width = 59 # set line template line_template = '{0:' + str(keypair_name_width) + '} {1:' + str(fingerprint_width) + '}' # print header print(line_template.format('Key Pair Name', 'Fingerprint')) print(line_template.format('=' * keypair_name_width, '=' * fingerprint_width)) # print detail lines for keypair_key in keypair_keys_list: keypair_name = keypairs_dict[keypair_key]['keypair_name'] fingerprint = keypairs_dict[keypair_key]['fingerprint'] print(line_template.format(keypair_name, fingerprint)) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_create_keypairs(): ''' Create the key pairs of a region. ''' # initialize the control variable OK = True # print the header and get the cluster name clib.clear_screen() clib.print_headers_with_environment('Security - Create key pairs') # get current region name region_name = xconfiguration.get_current_region_name() # confirm the creation of the key pairs print(xlib.get_separator()) OK = clib.confirm_action('The key pairs of the region {0} are going to be created.'.format(region_name)) # create key pairs if OK: print(xlib.get_separator()) print('The key pairs of the region {0} are been created ...'.format(region_name)) (OK, error_list) = xec2.create_keypairs(region_name) if OK: print('The key pairs and their corresponding local files have been created.') else: for error in error_list: print(error) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_restart_cluster(): ''' Restart a cluster. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Cluster operation - Restart cluster') # get the cluster name print(xlib.get_separator()) if xec2.get_running_cluster_list(volume_creator_included=False) == []: print('WARNING: There is not any running cluster.') OK = False else: cluster_name = cinputs.input_cluster_name(volume_creator_included=False, help=True) # confirm the restarting of the cluster if OK: print(xlib.get_separator()) OK = clib.confirm_action('The cluster is going to be restarted.') # stop the cluster if OK: devstdout = xlib.DevStdOut(xcluster.restart_cluster.__name__) OK = xcluster.restart_cluster(cluster_name, devstdout, function=None) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def build_menu_toa_refseq_plant(): ''' Build the menu NCBI RefSeq Plant. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment(xlib.get_toa_data_refseq_plant_name()) # print the menu options print( 'Options:') print() print( ' 1. Build proteome') print() print( ' X. Return to menu Genomic databases') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_manage_genomic_database(xlib.get_toa_type_build_proteome(), xlib.get_toa_data_refseq_plant_code()) elif option == 'X': break
def build_menu_metacyc_stats(): ''' Build the menu Statistics - MetaCyc. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment('Statistics - MetaCyc') # print the menu options print( 'Options:') print() print( ' 1. Frecuency distribution data') print( ' 2. # sequences per # ids data') print() print( ' X. Return to menu Statistics') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_view_ontologic_data_frecuency(stats_code='metacyc') elif option == '2': ctoa.form_view_x_per_y_data(stats_code='seq_per_metacyc') elif option == 'X': break
def build_menu_toa_go(): ''' Build the menu Gene Ontology. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment(xlib.get_toa_data_go_name()) # print the menu options print( 'Options:') print() print( ' 1. Download functional annotations from Gene Ontology server') print(f' 2. Load data into {xlib.get_toa_name()} database') print() print( ' X. Return to menu Genomic databases') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_manage_genomic_database(xlib.get_toa_type_download_data(), xlib.get_toa_data_go_code()) elif option == '2': ctoa.form_manage_genomic_database(xlib.get_toa_type_load_data(), xlib.get_toa_data_go_code()) elif option == 'X': break
def build_menu_toa_pipelines(): ''' Build the menu Pipelines. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment('Pipelines') # print the menu options print( 'Options:') print() print(f' 1. {xlib.get_toa_name()} {xlib.get_toa_process_pipeline_nucleotide_name()}') print(f' 2. {xlib.get_toa_name()} {xlib.get_toa_process_pipeline_aminoacid_name()}') print() print(f' 3. Annotation merger of {xlib.get_toa_name()} pipelines') print() print( ' X. Return to menu Main') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': build_menu_toa_nucleotide_pipeline() elif option == '2': build_menu_toa_aminoacid_pipeline() elif option == '3': build_menu_toa_annotation_merger() elif option == 'X': break
def form_remove_volume(): ''' Remove a volume in the current zone. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Volume operation - Remove volume') # get current zone name zone_name = xconfiguration.get_current_zone_name() # get the volume name print(xlib.get_separator()) volume_name = cinputs.input_volume_name(zone_name, template_name='', help=True, help_type='created') # confirm the removal of the volume print(xlib.get_separator()) OK = clib.confirm_action('The volume is going to be removed.') # remove the volume if OK: devstdout = xlib.DevStdOut(xvolume.remove_volume.__name__) OK = xvolume.remove_volume(volume_name, devstdout, function=None) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_open_terminal(): ''' Open a terminal windows of a cluster node. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Cloud control - Open a terminal') # get the cluster name and node name print(xlib.get_separator()) if xec2.get_running_cluster_list(volume_creator_included=False) != []: cluster_name = cinputs.input_cluster_name(volume_creator_included=False, help=True) node_name = cinputs.input_node_name(cluster_name, new=False, is_master_valid=True, help=True) else: print('WARNING: There is not any running cluster.') OK = False # confirm the terminal opening if OK: print(xlib.get_separator()) OK = clib.confirm_action('The terminal is going to be opened using StarCluster.') # open de terminal if OK: xcluster.open_terminal(cluster_name, node_name) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def build_menu_alignment_stats(): ''' Build the menu Statistics - Alignment. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment('Statistics - Alignment') # print the menu options print( 'Options:') print() print( ' 1. # HITs per # HSPs data') print() print( ' X. Return to menu Statistics') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_view_x_per_y_data(stats_code='hit_per_hsp') elif option == 'X': break
def build_menu_family_stats(): ''' Build the menu Statistics - Family. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment('Statistics - Family') # print the menu options print( 'Options:') print() print( ' 1. Frecuency distribution data') print() print( ' X. Return to menu Statistics') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_view_phylogenic_data_frecuency(stats_code='family') elif option == 'X': break
def build_menu_toa_annotation_merger(): ''' Build the menu annotation merger of TOA pipelines. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment(f'Annotation merger of {xlib.get_toa_name()} pipelines') # print the menu options print( 'Options:') print() print( ' 1. Recreate config file') print( ' 2. Edit config file') print() print( ' 3. Run process') print() print( ' X. Return to menu Pipelines') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_recreate_annotation_merger_config_file() elif option == '2': ctoa.form_edit_pipeline_config_file(xlib.get_toa_process_merge_annotations_code()) elif option == '3': ctoa.form_run_pipeline_process(xlib.get_toa_process_merge_annotations_code()) elif option == 'X': break
def build_menu_toa_stats(): ''' Build the menu Statistics. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment('Statistics') # print the menu options print( 'Options:') print() print( ' 1. Alignment') print() print( ' 2. Annotation datasets') print() print( ' 3. Species') print( ' 4. Family') print( ' 5. Phylum') print() print( ' 6. EC') print( ' 7. Gene Ontology') print( ' 8. InterPro') print( ' 9. KEGG') print( ' A. MapMan') print( ' B. MetaCyc') print() print( ' X. Return to menu Main') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': build_menu_alignment_stats() elif option == '2': build_menu_annotation_dataset_stats() elif option == '3': build_menu_species_stats() elif option == '4': build_menu_family_stats() elif option == '5': build_menu_phylum_stats() elif option == '6': build_menu_ec_stats() elif option == '7': build_menu_go_stats() elif option == '8': build_menu_interpro_stats() elif option == '9': build_menu_kegg_stats() elif option == 'A': build_menu_mapman_stats() elif option == 'B': build_menu_metacyc_stats() elif option == 'X': break
def form_view_submission_log(): ''' View the log of a submission. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Logs - View a submission log') # get the submission log submission_log_file = cinputs.input_submission_log_file() if submission_log_file == '': print('WARNING: There is not any submission log.') OK = False # view the log file if OK: text = 'Logs - View a submission log' OK = clib.view_file( os.path.join(xlib.get_log_dir(), submission_log_file), text) # show continuation message input('Press [Intro] to continue ...')
def build_menu_go_stats(): ''' Build the menu Statistics - Gene Ontology. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment('Statistics - Gene Ontology') # print the menu options print( 'Options:') print() print( ' 1. Frecuency distribution data per term') print( ' 2. Frecuency distribution data per namespace') print( ' 3. # sequences per # terms data') print() print( ' X. Return to menu Statistics') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_view_go_data_frecuency() elif option == '2': ctoa.form_view_phylogenic_data_frecuency(stats_code='namespace') elif option == '3': ctoa.form_view_x_per_y_data(stats_code='seq_per_go') elif option == 'X': break
def build_menu_toa_protein_gi(): ''' Build the menu NCBI Protein GenInfo identifier lists. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment(xlib.get_toa_data_viridiplantae_protein_gi_name()) # print the menu options print( 'Options:') print() print( ' 1. Build identifier list using NCBI server') print() print( ' X. Return to menu Genomic databases') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_manage_genomic_database(xlib.get_toa_type_build_gilist(), xlib.get_toa_data_viridiplantae_protein_gi_code()) elif option == 'X': break
def build_menu_toa_nr(): ''' Build the menu NCBI BLAST database NR. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment(xlib.get_toa_data_nr_name()) # print the menu options print( 'Options:') print() print( ' 1. Build database for BLAST+') print( ' 2. Build database for DIAMOND') print() print( ' X. Return to menu Genomic databases') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': ctoa.form_manage_genomic_database(xlib.get_toa_type_build_blastplus_db(), xlib.get_toa_data_nr_code()) elif option == '2': ctoa.form_manage_genomic_database(xlib.get_toa_type_build_diamond_db(), xlib.get_toa_data_nr_code()) elif option == 'X': break
def form_update_connection_data(): ''' Update the user id, access key id, secret access key and contact e-mail address in the NGScloud config file corresponding to the environment. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Configuration - Update connection data') # get basic AWS data and contact e-mail address from NGScloud config file (user_id, access_key_id, secret_access_key) = xconfiguration.get_basic_aws_data() email = xconfiguration.get_contact_data() # input the new AWS data and the contact e-mail address print(xlib.get_separator()) user_id = cinputs.input_user_id(user_id) access_key_id = cinputs.input_access_key_id(access_key_id) secret_access_key = cinputs.input_secret_access_key(secret_access_key) email = cinputs.input_email(email) # verify the AWS access key identification and the AWS secret access key print(xlib.get_separator()) print('Verifying the AWS access key identification and the AWS secret access key') OK = xec2.verify_aws_credentials(access_key_id, secret_access_key) if OK: print('The credentials are OK.') else: print('ERROR: The credentials are wrong. Please review your access key identification and secret access key in the AWS web.') # get the NGScloud config file if OK: ngscloud_config_file = xconfiguration.get_ngscloud_config_file() # confirm the connection data update in the NGScloud config file if OK: print(xlib.get_separator()) OK = clib.confirm_action('The file {0} is going to be update with the new connection data.'.format(ngscloud_config_file)) # save the options dictionary in the NGScloud config file if OK: print(xlib.get_separator()) print('The file {0} is being update with the new connection data ...'.format(ngscloud_config_file)) (OK, error_list) = xconfiguration.update_connection_data(user_id, access_key_id, secret_access_key) if OK: (OK, error_list) = xconfiguration.update_contact_data(email) if OK: print('The config file has been update.') else: for error in error_list: print(error) raise xlib.ProgramException('C001') # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_run_pipeline_process(pipeline_type): ''' Run a pipeline process with the parameters in the corresponding config file. ''' # initialize the control variable OK = True # set the pipeline name if pipeline_type == xlib.get_toa_process_pipeline_nucleotide_code(): name = xlib.get_toa_process_pipeline_nucleotide_name() elif pipeline_type == xlib.get_toa_process_pipeline_aminoacid_code(): name = xlib.get_toa_process_pipeline_aminoacid_name() elif pipeline_type == xlib.get_toa_process_merge_annotations_code(): name = xlib.get_toa_process_merge_annotations_name() # print the header clib.clear_screen() clib.print_headers_with_environment(f'{name} - Run process') # confirm the process run if OK: print(xlib.get_separator()) OK = clib.confirm_action(f'The {name} process is going to be run.') # run the process if OK: if pipeline_type == xlib.get_toa_process_pipeline_nucleotide_code(): devstdout = xlib.DevStdOut(xtoa.run_pipeline_process.__name__) OK = xtoa.run_pipeline_process(pipeline_type, devstdout, function=None) elif pipeline_type == xlib.get_toa_process_pipeline_aminoacid_code(): devstdout = xlib.DevStdOut(xtoa.run_pipeline_process.__name__) OK = xtoa.run_pipeline_process(pipeline_type, devstdout, function=None) elif pipeline_type == xlib.get_toa_process_merge_annotations_code(): devstdout = xlib.DevStdOut( xtoa.run_annotation_merger_process.__name__) OK = xtoa.run_annotation_merger_process(devstdout, function=None) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_kill_batch_job(): ''' Kill a batch job in the cluster. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Cluster operation - Kill batch job') # get the cluster name, experiment identification, read dataset identification and the file pattern print(xlib.get_separator()) if xec2.get_running_cluster_list(volume_creator_included=False) == []: print('WARNING: There is not any running cluster.') OK = False else: cluster_name = cinputs.input_cluster_name(volume_creator_included=False, help=True) # create the SSH client connection if OK: (OK, error_list, ssh_client) = xssh.create_ssh_client_connection(cluster_name, 'master') for error in error_list: print(error) # get the batch job identificaction if OK: batch_job_id = cinputs.input_batch_job_id(ssh_client, help=True) if batch_job_id == '': print('WARNING: There is not any batch job.') OK = False # confirm the kill of the batch job if OK: print(xlib.get_separator()) OK = clib.confirm_action('The batch job {0} is going to be killed.'.format(batch_job_id)) # kill the batch job if OK: devstdout = xlib.DevStdOut(xcluster.kill_batch_job.__name__) xcluster.kill_batch_job(cluster_name, batch_job_id, devstdout, function=None) # close the SSH client connection if OK: xssh.close_ssh_client_connection(ssh_client) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def form_list_templates(): ''' List the characteristics of the cluster templates. ''' # print the header clib.clear_screen() clib.print_headers_with_environment('Configuration - List cluster templates') # get the cluster template dictionary and the template name list template_dict = xconfiguration.get_template_dict() template_name_list = xconfiguration.get_template_name_list(volume_creator_included=False) # list cluster templates print(xlib.get_separator()) if template_name_list == []: print('WARNING: There is not any cluster template defined.') else: # set data width template_width = 30 instance_type_width = 13 vcpu_width = 5 memory_width = 12 use_width = 17 generation_width = 10 # set line template line_template = '{0:' + str(template_width) + '} {1:' + str(instance_type_width) + '} {2:>' + str(vcpu_width) + '} {3:>' + str(memory_width) + '} {4:' + str(use_width) + '} {5:' + str(generation_width) + '}' # print header print(line_template.format('Template name', 'Instance type', 'vCPUs', 'Memory (GiB)', 'Use', 'Generation')) print(line_template.format('=' * template_width, '=' * instance_type_width, '=' * vcpu_width, '=' * memory_width, '=' * use_width, '=' * generation_width)) # print detail lines for template_name in template_name_list: instance_type = template_dict[template_name]['master_instance_type'] vcpu = template_dict[template_name]['vcpu'] memory = template_dict[template_name]['memory'] use = template_dict[template_name]['use'] generation = template_dict[template_name]['generation'] print(line_template.format(template_name, instance_type, vcpu, memory, use, generation)) # show warnings about characteristics and pricing print(xlib.get_separator()) print('You can consult the characteristics of the EC2 intance types in:') print(' https://aws.amazon.com/ec2/instance-types/') print('and the EC2 pricing is detailed in:') print(' https://aws.amazon.com/ec2/pricing/') # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def build_menu_main(): ''' Build the menu Main. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment('Main') # print the menu options print( 'Options:') print() print( ' 1. Configuration') print() print( ' 2. Genomic databases') print() print( ' 3. Annotation pipelines') print() print( ' 4. Statistics') print() print( ' 5. Logs') print() print(f' X. Exit {xlib.get_short_project_name()}') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': build_menu_toa_configuration() elif option == '2': build_menu_toa_databases() elif option == '3': build_menu_toa_pipelines() elif option == '4': build_menu_toa_stats() elif option == '5': build_menu_logs() elif option == 'X': sure = '' print( '') while sure not in ['Y', 'N']: sure = input(f'Are you sure to exit {xlib.get_short_project_name()}? (y or n): ').upper() if sure == 'Y': break
def form_view_result_log(): ''' View the log of an experiment/process result. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment( 'Logs - View an experiment/process result log') # get the experiment identification if OK: experiment_id = cinputs.input_experiment_id() if experiment_id == '': print('WARNING: There is not any experiment/process data.') OK = False # get the result_dataset identification if OK: result_dataset_id = cinputs.input_result_dataset_id( experiment_id, xlib.get_all_applications_selected_code()) if result_dataset_id == '': print( f'WARNING: The experiment/process {experiment_id} does not have result datasets.' ) OK = False # get the dictionary of TOA configuration. if OK: toa_config_dict = xtoa.get_toa_config_dict() # get the log file name and build local and cluster paths if OK: log_file = f'{toa_config_dict["RESULT_DIR"]}/{experiment_id}/{result_dataset_id}/{xlib.get_run_log_file()}' # view the log file if OK: text = 'Logs - View an experiment/process log' OK = clib.view_file(log_file, text) # show continuation message input('Press [Intro] to continue ...')
def form_edit_data_file(data_file): ''' Edit a data file. ''' # initialize the control variable OK = True # get the head if data_file == xtoa.get_dataset_file(): head = f'{xlib.get_toa_name()} - Edit the file of genomic dataset' elif data_file == xtoa.get_species_file(): head = f'{xlib.get_toa_name()} - Edit the file of species' # print the header clib.clear_screen() clib.print_headers_with_environment(head) # edit the read transfer config file print(xlib.get_separator()) print(f'Editing the file {data_file} ...') command = f'{xlib.get_editor()} {data_file}' rc = subprocess.call(command, shell=True) if rc != 0: print(f'*** ERROR: Return code {rc} in command -> {command}') OK = False # check the data file if OK: print(xlib.get_separator()) print(f'Checking the file {data_file} ...') if data_file == xtoa.get_dataset_file(): (OK, error_list) = xtoa.check_dataset_file(strict=False) elif data_file == xtoa.get_species_file(): (OK, error_list) = xtoa.check_species_file(strict=False) if OK: print('The file is OK.') else: print() for error in error_list: print(error) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')
def build_menu_toa_basic_data(): ''' Build the menu Basic data. ''' while True: # print headers clib.clear_screen() clib.print_headers_with_environment(xlib.get_toa_data_basic_data_name()) # print the menu options print( 'Options:') print() print( ' 1. Recreate genomic dataset file') print( ' 2. Edit genomic file') print() print( ' 3. Recreate species file') print( ' 4. Edit species file') print() print( ' 5. Download other basic data') print() print(f' 6. Load data into {xlib.get_toa_name()} database') print() print( ' X. Return to menu Genomic databases') print() # get the selected option option = input('Input the selected option: ').upper() # process the selected option if option == '1': cbioinfoapp.form_recreate_data_file(xtoa.get_dataset_file()) elif option == '2': cbioinfoapp.form_edit_data_file(xtoa.get_dataset_file()) elif option == '3': cbioinfoapp.form_recreate_data_file(xtoa.get_species_file()) elif option == '4': cbioinfoapp.form_edit_data_file(xtoa.get_species_file()) elif option == '5': ctoa.form_manage_genomic_database(xlib.get_toa_type_download_data(), xlib.get_toa_data_basic_data_code()) elif option == '6': ctoa.form_manage_genomic_database(xlib.get_toa_type_load_data(), xlib.get_toa_data_basic_data_code()) elif option == 'X': break
def form_delink_volume_from_template(): ''' Delink a volume from a cluster template ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Configuration - Delink volume in a cluster template') # get current zone name zone_name = xconfiguration.get_current_zone_name() # get the template name and the volume name print(xlib.get_separator()) template_name = cinputs.input_template_name(volume_creator_included=False, help=True, is_all_possible=True) volume_name = cinputs.input_volume_name(zone_name, template_name, help=True, help_type='linked') # verify there is some volume linked to the cluster template if volume_name == '': print(xlib.get_separator()) print('*** WARNING: There is not any volume linked to the cluster template.') OK = False # confirm the exclusion of the volume if OK: print(xlib.get_separator()) if template_name == 'all': OK = clib.confirm_action('The volume {0} is going to be delinked from every template.'.format(volume_name)) else: OK = clib.confirm_action('The volume {0} is going to be delinked from the template {0}.'.format(volume_name, template_name)) # delink a volume in a cluster template if OK: print(xlib.get_separator()) print('The volume {0} is being delinked from the cluster template {1}.'.format(volume_name, template_name)) devstdout = xlib.DevStdOut(xconfiguration.delink_volume_from_template.__name__) (OK, error_list) = xconfiguration.delink_volume_from_template(template_name, volume_name, devstdout, function=None) # show continuation message print(xlib.get_separator()) input('Press [Intro] to continue ...')