def populate_combobox_experiment_id(self): ''' Populate data in "combobox_experiment_id". ''' # clear the value selected in the combobox self.wrapper_experiment_id.set('') # initialize the experiment identification list experiment_id_list = [] # get the experiment identifications command = 'ls {0}'.format(xlib.get_cluster_result_dir()) (OK, stdout, stderr) = xssh.execute_cluster_command(self.ssh_client, command) if OK: for line in stdout: line = line.rstrip('\n') if line != 'lost+found': experiment_id_list.append(line) # verify if there are any experimment identifications if experiment_id_list == []: message = 'The cluster has not experiment data.' tkinter.messagebox.showwarning('{0} - {1}'.format(xlib.get_project_name(), self.head), message) return # load the names of clusters which are running in the combobox self.combobox_experiment_id['values'] = experiment_id_list
def create_gmap_config_file(experiment_id='exp001', reference_dataset_id='NONE', reference_file='NONE', assembly_dataset_id='sdnt-170101-235959', assembly_type='CONTIGS'): ''' Create GMAP config file with the default options. It is necessary update the options in each run. ''' # initialize the control variable and the error list OK = True error_list = [] # set the app if assembly_dataset_id.startswith(xlib.get_soapdenovotrans_code()): assembly_software = xlib.get_soapdenovotrans_code() elif assembly_dataset_id.startswith(xlib.get_transabyss_code()): assembly_software = xlib.get_transabyss_code() elif assembly_dataset_id.startswith(xlib.get_trinity_code()): assembly_software = xlib.get_trinity_code() elif assembly_dataset_id.startswith(xlib.get_star_code()): assembly_software = xlib.get_star_code() elif assembly_dataset_id.startswith(xlib.get_cd_hit_est_code()): assembly_software = xlib.get_cd_hit_est_code() elif assembly_dataset_id.startswith(xlib.get_transcript_filter_code()): assembly_software = xlib.get_transcript_filter_code() # create the GMAP config file and write the default options try: if not os.path.exists(os.path.dirname(get_gmap_config_file())): os.makedirs(os.path.dirname(get_gmap_config_file())) with open(get_gmap_config_file(), mode='w', encoding='utf8') as file_id: file_id.write('{0}\n'.format('# You must review the information of this file and update the values with the corresponding ones to the current run.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# The reference file must be located in the cluster directory {0}/experiment_id/reference_dataset_id'.format(xlib.get_cluster_reference_dir()))) file_id.write('{0}\n'.format('# The assembly files must be located in the cluster directory {0}/experiment_id/assembly_dataset_id'.format(xlib.get_cluster_result_dir()))) file_id.write('{0}\n'.format('# The experiment_id, reference_dataset_id, reference_file and assembly_dataset_id are fixed in the identification section.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# You can consult the parameters of GMAP and their meaning in http://research-pub.gene.com/gmap/.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# In section "GMAP parameters", the key "other_parameters" allows you to input additional parameters in the format:')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# other_parameters = --parameter-1[=value-1][; --parameter-2[=value-2][; ...; --parameter-n[=value-n]]]')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# parameter-i is a parameter name of GMAP and value-i a valid value of parameter-i, e.g.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# other_parameters = --no-chimeras; --canonical-mode=2')) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# This section has the information identifies the experiment.')) file_id.write('{0}\n'.format('[identification]')) file_id.write('{0:<50} {1}\n'.format('experiment_id = {0}'.format(experiment_id), '# experiment identification')) file_id.write('{0:<50} {1}\n'.format('reference_dataset_id = {0}'.format(reference_dataset_id), '# reference dataset identification or NONE')) file_id.write('{0:<50} {1}\n'.format('reference_file = {0}'.format(reference_file), '# reference file name or NONE')) file_id.write('{0:<50} {1}\n'.format('assembly_software = {0}'.format(assembly_software), '# assembly software: {0} ({1}) or {2} ({3}) or {4} ({5}) or {6} ({7}) or {8} ({9}) or {10} ({11})'.format(xlib.get_soapdenovotrans_code(), xlib.get_soapdenovotrans_name(), xlib.get_transabyss_code(), xlib.get_transabyss_name(), xlib.get_trinity_code(), xlib.get_trinity_name(), xlib.get_star_code(), xlib.get_star_name(), xlib.get_cd_hit_est_code(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_code(), xlib.get_transcript_filter_name()))) file_id.write('{0:<50} {1}\n'.format('assembly_dataset_id = {0}'.format(assembly_dataset_id), '# assembly dataset identification')) file_id.write('{0:<50} {1}\n'.format('assembly_type = {0}'.format(assembly_type), '# CONTIGS or SCAFFOLDS in {0}; NONE in {1}, {2}, {3}, {4} and {5}'.format(xlib.get_soapdenovotrans_name(), xlib.get_transabyss_name(), xlib.get_trinity_name(), xlib.get_star_name(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_name()))) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# This section has the information to set the GMAP parameters')) file_id.write('{0}\n'.format('[GMAP parameters]')) file_id.write('{0:<50} {1}\n'.format('threads = 2', '# number of threads for use')) file_id.write('{0:<50} {1}\n'.format('kmer = NONE', '# kmer size to use in genome database or NONE (the program will find the highest available kmer size in the genome database)')) file_id.write('{0:<50} {1}\n'.format('sampling = NONE', '# Sampling to use in genome database or NONE (the program will find the smallest available sampling value in the genome database within selected k-mer size)')) file_id.write('{0:<50} {1}\n'.format('input-buffer-size = 1000', '# size of input buffer')) file_id.write('{0:<50} {1}\n'.format('output-buffer-size = 1000', '# size of buffer size in queries for output thread')) file_id.write('{0:<50} {1}\n'.format('prunelevel = 0', '# pruning level: 0 (no pruning) or 1 (poor seqs) or 2 (repetitive seqs) or 3 (poor and repetitive)')) file_id.write('{0:<50} {1}\n'.format('format = COMPRESS', '# format for output: COMPRESS or SUMMARY or ALIGN or PLS or GFF3_GENE or SPLICESITES or INTRONS or MAP_EXONS or MAP_RANGES or COORDS')) file_id.write('{0:<50} {1}\n'.format('other_parameters = NONE', '# additional parameters to the previous ones or NONE')) except: error_list.append('*** ERROR: The file {0} can not be recreated'.format(get_gmap_config_file())) OK = False # return the control variable and the error list return (OK, error_list)
def create_cd_hit_est_config_file(experiment_id='exp001', assembly_dataset_id='sdnt-170101-235959', assembly_type='CONTIGS'): ''' Create CD-HIT-EST config file with the default options. It is necessary update the options in each run. ''' # initialize the control variable and the error list OK = True error_list = [] # set the assembly software if assembly_dataset_id.startswith(xlib.get_soapdenovotrans_code()): assembly_software = xlib.get_soapdenovotrans_code() elif assembly_dataset_id.startswith(xlib.get_transabyss_code()): assembly_software = xlib.get_transabyss_code() elif assembly_dataset_id.startswith(xlib.get_trinity_code()): assembly_software = xlib.get_trinity_code() elif assembly_dataset_id.startswith(xlib.get_star_code()): assembly_software = xlib.get_star_code() elif assembly_dataset_id.startswith(xlib.get_cd_hit_est_code()): assembly_software = xlib.get_cd_hit_est_code() elif assembly_dataset_id.startswith(xlib.get_transcript_filter_code()): assembly_software = xlib.get_transcript_filter_code() # create the CD-HIT-EST config file and write the default options try: if not os.path.exists(os.path.dirname(get_cd_hit_est_config_file())): os.makedirs(os.path.dirname(get_cd_hit_est_config_file())) with open(get_cd_hit_est_config_file(), mode='w', encoding='utf8') as file_id: file_id.write('{0}\n'.format( '# You must review the information of this file and update the values with the corresponding ones to the current run.' )) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format( '# The assembly files must be located in the cluster directory {0}/experiment_id/assembly_dataset_id' .format(xlib.get_cluster_result_dir()))) file_id.write('{0}\n'.format( '# The experiment_id and assembly_dataset_id names are fixed in the identification section.' )) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format( '# You can consult the parameters of CD-HIT-EST (CD-HIT package) and their meaning in http://weizhong-lab.ucsd.edu/cd-hit/.' )) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format( '# In section "CD-HIT-EST parameters", the key "other_parameters" allows you to input additional parameters in the format:' )) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format( '# other_parameters = --parameter-1[=value-1][; --parameter-2[=value-2][; ...; --parameter-n[=value-n]]]' )) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format( '# parameter-i is a parameter name of CD-HIT-EST and value-i a valid value of parameter-i, e.g.' )) file_id.write('{0}\n'.format('#')) file_id.write( '{0}\n'.format('# other_parameters = --aS=0.9; --U=10')) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format( '# This section has the information identifies the assembly result dataset.' )) file_id.write('{0}\n'.format('[identification]')) file_id.write('{0:<50} {1}\n'.format( 'experiment_id = {0}'.format(experiment_id), '# experiment identification')) file_id.write('{0:<50} {1}\n'.format( 'assembly_software = {0}'.format(assembly_software), '# assembly software: {0} ({1}) or {2} ({3}) or {4} ({5}) or {6} ({7}) or {8} ({9}) or {10} ({11})' .format(xlib.get_soapdenovotrans_code(), xlib.get_soapdenovotrans_name(), xlib.get_transabyss_code(), xlib.get_transabyss_name(), xlib.get_trinity_code(), xlib.get_trinity_name(), xlib.get_star_code(), xlib.get_star_name(), xlib.get_cd_hit_est_code(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_code(), xlib.get_transcript_filter_name()))) file_id.write('{0:<50} {1}\n'.format( 'assembly_dataset_id = {0}'.format(assembly_dataset_id), '# assembly dataset identification')) file_id.write('{0:<50} {1}\n'.format( 'assembly_type = {0}'.format(assembly_type), '# CONTIGS or SCAFFOLDS in {0}; NONE in {1}, {2}, {3}, {4} and {5}' .format(xlib.get_soapdenovotrans_name(), xlib.get_transabyss_name(), xlib.get_trinity_name(), xlib.get_star_name(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_name()))) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format( '# This section has the information to set the CD-HIT-EST parameters' )) file_id.write('{0}\n'.format('[CD-HIT-EST parameters]')) file_id.write('{0:<50} {1}\n'.format( 'threads = 2', '# number of threads for use; with 0, all CPUs will be used')) file_id.write('{0:<50} {1}\n'.format( 'memory_limit = 800', '# memory limit (in MB) for the program; 0 for unlimitted')) file_id.write('{0:<50} {1}\n'.format( 'seq_identity_threshold = 0.9', '# sequence identity threshold')) file_id.write('{0:<50} {1}\n'.format('word_length = 5', '# word length')) file_id.write('{0:<50} {1}\n'.format( 'mask = NX', '# masking letters (e.g. -mask NX, to mask out both "N" and "X")' )) file_id.write('{0:<50} {1}\n'.format( 'match = 2', '# matching score (1 for T-U and N-N)')) file_id.write('{0:<50} {1}\n'.format('mismatch = -2', '# mismatching score')) file_id.write('{0:<50} {1}\n'.format( 'other_parameters = NONE', '# additional parameters to the previous ones or NONE')) except: error_list.append( '*** ERROR: The file {0} can not be recreated'.format( get_cd_hit_est_config_file())) OK = False # return the control variable and the error list return (OK, error_list)
def download_result_dataset(cluster_name, log, function=None): ''' Download the result dataset of a run from the cluster. ''' # initialize the control variable OK = True # get the read transfer config file result_transfer_config_file = get_result_transfer_config_file() # warn that the log window must not be closed if not isinstance(log, xlib.DevStdOut): log.write('This process might take several minutes. Do not close this window, please wait!\n') # get and validate the result transfer config file log.write('{0}\n'.format(xlib.get_separator())) log.write('The result transfer config file is been validating ...\n') if validate_result_transfer_config_file(strict=True): log.write('The config file is OK.\n') else: log.write('*** ERROR: The result transfer config file is not valid.\n') log.write('Please correct this file or recreate the config files.\n') OK = False # 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: log.write('{0}\n'.format(error)) # create the SSH transport connection if OK: (OK, error_list, ssh_transport) = xssh.create_ssh_transport_connection(cluster_name, 'master') for error in error_list: log.write('{0}\n'.format(error)) # create the SFTP client if OK: sftp_client = xssh.create_sftp_client(ssh_transport) # get the options dictionary if OK: result_transfer_options_dict = xlib.get_option_dict(result_transfer_config_file) # download the result dataset if OK: # get the sections list sections_list = [] for section in result_transfer_options_dict.keys(): sections_list.append(section) sections_list.sort() # get the experiment identification, run identification and local directory from the section "identification" experiment_id = result_transfer_options_dict['identification']['experiment_id'] result_dataset_id = result_transfer_options_dict['identification']['result_dataset_id'] status = result_transfer_options_dict['identification']['status'].lower() local_dir = result_transfer_options_dict['identification']['local_dir'] # download files when the status is uncompressed if status == 'uncompressed': # for each section "file-n" for section in sections_list: # verify than the section identification is like file-n if re.match('^file-[0-9]+$', section): # get the dataset subdirectory and file name dataset_subdirectory = result_transfer_options_dict[section]['dataset_subdirectory'] file_name = result_transfer_options_dict[section]['file_name'] # verify if the dataset subdirectory is created pathlib.Path(os.path.normpath('{0}/{1}'.format(local_dir, dataset_subdirectory))).mkdir(parents=True, exist_ok=True) # assign the cluster path and local path cluster_path = '{0}/{1}/{2}/{3}/{4}'.format(xlib.get_cluster_result_dir(), experiment_id, result_dataset_id, dataset_subdirectory, file_name) local_path = os.path.normpath('{0}/{1}/{2}'.format(local_dir, dataset_subdirectory, file_name)) # download the result file from the cluster log.write('{0}\n'.format(xlib.get_separator())) log.write('Downloading the file {0} to {1} ...\n'.format(cluster_path, local_dir)) (OK, error_list) = xssh.get_file(sftp_client, cluster_path, local_path) if OK: log.write('The file has been downloaded.\n') else: for error in error_list: log.write('{0}\n'.format(error)) break # download files when the status is compressed elif status == 'compressed': # assign the cluster path and local path cluster_path = '{0}/{1}/{2}'.format(xlib.get_cluster_result_dir(), experiment_id, result_dataset_id) local_path = '{0}/{1}'.format(local_dir, result_dataset_id) # download the result file from the cluster log.write('{0}\n'.format(xlib.get_separator())) log.write('Downloading the file {0} to {1} ...\n'.format(cluster_path, local_dir)) (OK, error_list) = xssh.get_file(sftp_client, cluster_path, local_path) if OK: log.write('The file has been downloaded.\n') else: for error in error_list: log.write('{0}\n'.format(error)) # close the SSH transport connection if OK: xssh.close_ssh_transport_connection(ssh_transport) # close the SSH client connection if OK: xssh.close_ssh_client_connection(ssh_client) # warn that the log window can be closed if not isinstance(log, xlib.DevStdOut): log.write('{0}\n'.format(xlib.get_separator())) log.write('You can close this window now.\n') # execute final function if function is not None: function() # return the control variable return OK
def create_result_transfer_config_file(experiment_id='exp001', result_dataset_id='trinity-160629-151313', status='uncompressed', selected_file_list=['./Trinity.fasta'], local_dir='./results'): ''' Create o recreate the result transfer config file. ''' # initialize the control variable and the error list OK = True error_list = [] # get the result transfer config file path result_transfer_config_file = get_result_transfer_config_file() # create the result transfer config file to download result files of a run try: if not os.path.exists(os.path.dirname(result_transfer_config_file)): os.makedirs(os.path.dirname(result_transfer_config_file)) with open(result_transfer_config_file, mode='w', encoding='utf8') as file_id: file_id.write('{0}\n'.format('# You must review the information of this file and update the values with the corresponding ones to the current transfer.')) file_id.write('{0}\n'.format('# The files will be copied from the cluster directory {0}/experiment_id/result_dataset_id.'.format(xlib.get_cluster_result_dir()))) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# This section has the information identifies the experiment.')) file_id.write('{0}\n'.format('[identification]')) file_id.write('{0:<50} {1}\n'.format('experiment_id = {0}'.format(experiment_id), '# experiment identification')) file_id.write('{0:<50} {1}\n'.format('result_dataset_id = {0}'.format(result_dataset_id), '# run identification')) file_id.write('{0:<50} {1}\n'.format('status = {0}'.format(status), '# result dataset status (it must be always {0})'.format(status))) file_id.write('{0:<50} {1}\n'.format('local_dir = {0}'.format(local_dir), '# local path where the file will be download')) if status == 'uncompressed': for i in range(len(selected_file_list)): file_id.write('{0}\n'.format('')) if i == 0: file_id.write('{0}\n'.format('# This section has the information of the first result file.')) file_id.write('{0}\n'.format('[file-{0}]'.format(i + 1))) file_id.write('{0:<50} {1}\n'.format('dataset_subdirectory = {0}'.format(os.path.dirname(selected_file_list[i])), '# subdirectory of result dataset')) file_id.write('{0:<50} {1}\n'.format('file_name = {0}'.format(os.path.basename(selected_file_list[i])), '# result file name')) if i == 0: file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# If there are more files, you must repeat the section file-1 with the data of each file.')) file_id.write('{0}\n'.format('# The section identification must be library-n (n is an integer not repeated)')) except: error_list.append('*** ERROR: The file {0} can not be created'.format(result_transfer_config_file)) OK = False # return the control variable and the error list return (OK, error_list)
def get_result_dataset_dict(cluster_name, experiment_id, status, passed_connection, ssh_client): ''' Get a dictionary with the result datasets of an experiment in the cluster. ''' # initialize the control variable and the error list OK = True error_list = [] # get the result directory in the cluster cluster_result_dir = xlib.get_cluster_result_dir() # initialize the dictionary of the result datasets result_dataset_dict = {} # create the SSH client connection if not passed_connection: (OK, error_list, ssh_client) = xssh.create_ssh_client_connection(cluster_name, 'master') # verify the result directory is created if OK: command = '[ -d {0} ] && echo RC=0 || echo RC=1'.format(cluster_result_dir) (OK, stdout, stderr) = xssh.execute_cluster_command(ssh_client, command) if stdout[len(stdout) - 1] != 'RC=0': error_list.append('*** ERROR: There is not any volume mounted in the result directory.\n') error_list.append('You must link a volume in the mounting point {0} for the template {1}.\n'.format(cluster_result_dir, cluster_name)) OK = False # get the dictionary of the result datasets if OK: if status == 'uncompressed': command = 'cd {0}/{1}; for list in `ls`; do ls -ld $list | grep -v ^- > /dev/null && echo $list; done;'.format(cluster_result_dir, experiment_id) elif status == 'compressed': command = 'cd {0}/{1}; for list in `ls`; do ls -ld $list | grep -v ^d > /dev/null && echo $list; done;'.format(cluster_result_dir, experiment_id) (OK, stdout, stderr) = xssh.execute_cluster_command(ssh_client, command) if OK: if status == 'uncompressed': input_pattern = '{0}-(.+)-(.+)' output_pattern = '{0} ({1} {2})' elif status == 'compressed': input_pattern = '{0}-(.+)-(.+).tar.gz' output_pattern = '{0} ({1} {2}) [compressed]' for line in stdout: line = line.rstrip('\n') if line != 'lost+found': result_dataset_id = line if result_dataset_id.startswith(xlib.get_cd_hit_est_code()+'-'): mo = re.match(input_pattern.format(xlib.get_cd_hit_est_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_cd_hit_est_name(), date, time) elif result_dataset_id.startswith(xlib.get_fastqc_code()+'-'): mo = re.match(input_pattern.format(xlib.get_fastqc_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_fastqc_name(), date, time) elif result_dataset_id.startswith(xlib.get_gzip_code()+'-'): mo = re.match(input_pattern.format(xlib.get_gzip_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_gzip_name(), date, time) elif result_dataset_id.startswith(xlib.get_insilico_read_normalization_code()+'-'): mo = re.match(input_pattern.format(xlib.get_insilico_read_normalization_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_insilico_read_normalization_name(), date, time) elif result_dataset_id.startswith(xlib.get_quast_code()+'-'): mo = re.match(input_pattern.format(xlib.get_quast_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_quast_name(), date, time) elif result_dataset_id.startswith(xlib.get_ref_eval_code()+'-'): mo = re.match(input_pattern.format(xlib.get_ref_eval_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_ref_eval_name(), date, time) elif result_dataset_id.startswith(xlib.get_rnaquast_code()+'-'): mo = re.match(input_pattern.format(xlib.get_rnaquast_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_rnaquast_name(), date, time) elif result_dataset_id.startswith(xlib.get_rsem_eval_code()+'-'): mo = re.match(input_pattern.format(xlib.get_rsem_eval_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_rsem_eval_name(), date, time) elif result_dataset_id.startswith(xlib.get_soapdenovotrans_code()+'-'): mo = re.match(input_pattern.format(xlib.get_soapdenovotrans_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_soapdenovotrans_name(), date, time) elif result_dataset_id.startswith(xlib.get_star_code()+'-'): mo = re.match(input_pattern.format(xlib.get_star_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_star_name(), date, time) elif result_dataset_id.startswith(xlib.get_transabyss_code()+'-'): mo = re.match(input_pattern.format(xlib.get_transabyss_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_transabyss_name(), date, time) elif result_dataset_id.startswith(xlib.get_transcript_filter_code()+'-'): mo = re.match(input_pattern.format(xlib.get_transcript_filter_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_transcript_filter_name(), date, time) elif result_dataset_id.startswith(xlib.get_transcriptome_blastx_code()+'-'): mo = re.match(input_pattern.format(xlib.get_transcriptome_blastx_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_transcriptome_blastx_name(), date, time) elif result_dataset_id.startswith(xlib.get_transrate_code()+'-'): mo = re.match(input_pattern.format(xlib.get_transrate_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_transrate_name(), date, time) elif result_dataset_id.startswith(xlib.get_trimmomatic_code()+'-'): mo = re.match(input_pattern.format(xlib.get_trimmomatic_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_trimmomatic_name(), date, time) elif result_dataset_id.startswith(xlib.get_trinity_code()+'-'): mo = re.match(input_pattern.format(xlib.get_trinity_code()), result_dataset_id) date = mo.group(1) time = mo.group(2) result_dataset_name = output_pattern.format(xlib.get_trinity_name(), date, time) else: result_dataset_name = result_dataset_id result_dataset_dict[result_dataset_id] = {'result_dataset_id': result_dataset_id, 'result_dataset_name': result_dataset_name} # close the SSH client connection if OK and not passed_connection: xssh.close_ssh_client_connection(ssh_client) # return the control variable, error list and dictionary of the result datasets return (OK, error_list, result_dataset_dict)
def create_quast_config_file(experiment_id='exp001', reference_dataset_id='NONE', reference_file='NONE', assembly_dataset_id='sdnt-170101-235959', assembly_type='CONTIGS'): ''' Create QUAST config file with the default options. It is necessary update the options in each run. ''' # initialize the control variable and the error list OK = True error_list = [] # set the app if assembly_dataset_id.startswith(xlib.get_soapdenovotrans_code()): assembly_software = xlib.get_soapdenovotrans_code() elif assembly_dataset_id.startswith(xlib.get_transabyss_code()): assembly_software = xlib.get_transabyss_code() elif assembly_dataset_id.startswith(xlib.get_trinity_code()): assembly_software = xlib.get_trinity_code() elif assembly_dataset_id.startswith(xlib.get_star_code()): assembly_software = xlib.get_star_code() elif assembly_dataset_id.startswith(xlib.get_cd_hit_est_code()): assembly_software = xlib.get_cd_hit_est_code() elif assembly_dataset_id.startswith(xlib.get_transcript_filter_code()): assembly_software = xlib.get_transcript_filter_code() # create the QUAST config file and write the default options try: if not os.path.exists(os.path.dirname(get_quast_config_file())): os.makedirs(os.path.dirname(get_quast_config_file())) with open(get_quast_config_file(), mode='w', encoding='utf8') as file_id: file_id.write('{0}\n'.format('# You must review the information of this file and update the values with the corresponding ones to the current run.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# The reference file must be located in the cluster directory {0}/experiment_id/reference_dataset_id'.format(xlib.get_cluster_reference_dir()))) file_id.write('{0}\n'.format('# The assembly files must be located in the cluster directory {0}/experiment_id/assembly_dataset_id'.format(xlib.get_cluster_result_dir()))) file_id.write('{0}\n'.format('# The experiment_id, reference_dataset_id, reference_file and assembly_dataset_id are fixed in the identification section.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# You can consult the parameters of QUAST and their meaning in http://quast.sourceforge.net/quast.html.')) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# This section has the information identifies the experiment.')) file_id.write('{0}\n'.format('[identification]')) file_id.write('{0:<50} {1}\n'.format('experiment_id = {0}'.format(experiment_id), '# experiment identification')) file_id.write('{0:<50} {1}\n'.format('reference_dataset_id = {0}'.format(reference_dataset_id), '# reference dataset identification or NONE')) file_id.write('{0:<50} {1}\n'.format('reference_file = {0}'.format(reference_file), '# reference file name or NONE')) file_id.write('{0:<50} {1}\n'.format('assembly_software = {0}'.format(assembly_software), '# assembly software: {0} ({1}) or {2} ({3}) or {4} ({5}) or {6} ({7}) or {8} ({9}) or {10} ({11})'.format(xlib.get_soapdenovotrans_code(), xlib.get_soapdenovotrans_name(), xlib.get_transabyss_code(), xlib.get_transabyss_name(), xlib.get_trinity_code(), xlib.get_trinity_name(), xlib.get_star_code(), xlib.get_star_name(), xlib.get_cd_hit_est_code(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_code(), xlib.get_transcript_filter_name()))) file_id.write('{0:<50} {1}\n'.format('assembly_dataset_id = {0}'.format(assembly_dataset_id), '# assembly dataset identification')) file_id.write('{0:<50} {1}\n'.format('assembly_type = {0}'.format(assembly_type), '# CONTIGS or SCAFFOLDS in {0}; NONE in {1}, {2}, {3}, {4} and {5}'.format(xlib.get_soapdenovotrans_name(), xlib.get_transabyss_name(), xlib.get_trinity_name(), xlib.get_star_name(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_name()))) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# This section has the information to set the QUAST parameters')) file_id.write('{0}\n'.format('[QUAST parameters]')) file_id.write('{0:<50} {1}\n'.format('threads = 2', '# number of threads for use')) except: error_list.append('*** ERROR: The file {0} can not be recreated'.format(get_quast_config_file())) OK = False # return the control variable and the error list return (OK, error_list)
def form_list_cluster_experiment_processes(): ''' List the processes of an experiment in the cluster. ''' # initialize the control variable OK = True # print the header clib.clear_screen() clib.print_headers_with_environment('Logs - List experiment processes in the cluster') # get the cluster 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) else: print('WARNING: There is not any running cluster.') OK = False # 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: log.write('{0}\n'.format(error)) # get experiment identification if OK: experiment_id = cinputs.input_experiment_id(ssh_client, help=True) if experiment_id == '': print('WARNING: The cluster {0} has not experiment data.'.format(cluster_name)) OK = False # get the result dataset list of the experiment if OK: command = 'cd {0}/{1}; for list in `ls`; do ls -ld $list | grep -v ^- > /dev/null && echo $list; done;'.format(xlib.get_cluster_result_dir(), experiment_id) (OK, stdout, stderr) = xssh.execute_cluster_command(ssh_client, command) if OK: result_dataset_id_list = [] for line in stdout: line = line.rstrip('\n') if line != 'lost+found': result_dataset_id_list.append(line) # print the result dataset identification list of the experiment if OK: print(xlib.get_separator()) if result_dataset_id_list == []: print('*** WARNING: There is not any result dataset of the experiment {0}.'.format(experiment_id)) else: result_dataset_id_list.sort() # set data width result_dataset_width = 25 bioinfo_app_width = 25 # set line template line_template = '{0:' + str(result_dataset_width) + '} {1:' + str(bioinfo_app_width) + '}' # print header print(line_template.format('Result dataset', 'Bioinfo app / Utility')) print(line_template.format('=' * result_dataset_width, '=' * bioinfo_app_width)) # print detail lines for result_dataset_id in result_dataset_id_list: if result_dataset_id.startswith(xlib.get_bedtools_code()+'-'): bioinfo_app_name = xlib.get_bedtools_name() elif result_dataset_id.startswith(xlib.get_blastplus_code()+'-'): bioinfo_app_name = xlib.get_blastplus_name() elif result_dataset_id.startswith(xlib.get_bowtie2_code()+'-'): bioinfo_app_name = xlib.get_bowtie2_name() elif result_dataset_id.startswith(xlib.get_busco_code()+'-'): bioinfo_app_name = xlib.get_busco_name() elif result_dataset_id.startswith(xlib.get_cd_hit_code()+'-'): bioinfo_app_name = xlib.get_cd_hit_est_name() elif result_dataset_id.startswith(xlib.get_cd_hit_code()+'-'): bioinfo_app_name = xlib.get_cd_hit_est_name() elif result_dataset_id.startswith(xlib.get_detonate_code()+'-'): bioinfo_app_name = xlib.get_detonate_name() elif result_dataset_id.startswith(xlib.get_emboss_code()+'-'): bioinfo_app_name = xlib.get_emboss_name() elif result_dataset_id.startswith(xlib.get_fastqc_code()+'-'): bioinfo_app_name = xlib.get_fastqc_name() elif result_dataset_id.startswith(xlib.get_gmap_code()+'-'): bioinfo_app_name = xlib.get_gmap_name() elif result_dataset_id.startswith(xlib.get_gmap_gsnap_code()+'-'): bioinfo_app_name = xlib.get_gmap_gsnap_name() elif result_dataset_id.startswith(xlib.get_gzip_code()+'-'): bioinfo_app_name = xlib.get_gzip_name() elif result_dataset_id.startswith(xlib.get_insilico_read_normalization_code()+'-'): bioinfo_app_name = xlib.get_insilico_read_normalization_name() elif result_dataset_id.startswith(xlib.get_miniconda3_code()+'-'): bioinfo_app_name = xlib.get_miniconda3_name() elif result_dataset_id.startswith(xlib.get_ngshelper_code()+'-'): bioinfo_app_name = xlib.get_ngshelper_name() elif result_dataset_id.startswith(xlib.get_quast_code()+'-'): bioinfo_app_name = xlib.get_quast_name() elif result_dataset_id.startswith(xlib.get_r_code()+'-'): bioinfo_app_name = xlib.get_r_name() elif result_dataset_id.startswith(xlib.get_ref_eval_code()+'-'): bioinfo_app_name = xlib.get_ref_eval_name() elif result_dataset_id.startswith(xlib.get_rnaquast_code()+'-'): bioinfo_app_name = xlib.get_rnaquast_name() elif result_dataset_id.startswith(xlib.get_rsem_code()+'-'): bioinfo_app_name = xlib.get_rsem_name() elif result_dataset_id.startswith(xlib.get_rsem_eval_code()+'-'): bioinfo_app_name = xlib.get_rsem_eval_name() elif result_dataset_id.startswith(xlib.get_samtools_code()+'-'): bioinfo_app_name = xlib.get_samtools_name() elif result_dataset_id.startswith(xlib.get_soapdenovotrans_code()+'-'): bioinfo_app_name = xlib.get_soapdenovotrans_name() elif result_dataset_id.startswith(xlib.get_star_code()+'-'): bioinfo_app_name = xlib.get_star_name() elif result_dataset_id.startswith(xlib.get_transabyss_code()+'-'): bioinfo_app_name = xlib.get_transabyss_name() elif result_dataset_id.startswith(xlib.get_transcript_filter_code()+'-'): bioinfo_app_name = xlib.get_transcript_filter_name() elif result_dataset_id.startswith(xlib.get_transcriptome_blastx_code()+'-'): bioinfo_app_name = xlib.get_transcriptome_blastx_name() elif result_dataset_id.startswith(xlib.get_transrate_code()+'-'): bioinfo_app_name = xlib.get_transrate_name() elif result_dataset_id.startswith(xlib.get_trimmomatic_code()+'-'): bioinfo_app_name = xlib.get_trimmomatic_name() elif result_dataset_id.startswith(xlib.get_trinity_code()+'-'): bioinfo_app_name = xlib.get_trinity_name() else: bioinfo_app_name = 'xxx' print(line_template.format(result_dataset_id, bioinfo_app_name)) # 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 create_busco_config_file(experiment_id='exp001', assembly_dataset_id='sdnt-170101-235959', assembly_type='CONTIGS'): ''' Create BUSCO config file with the default options. It is necessary update the options in each run. ''' # initialize the control variable and the error list OK = True error_list = [] # set the assembly software if assembly_dataset_id.startswith(xlib.get_soapdenovotrans_code()): assembly_software = xlib.get_soapdenovotrans_code() elif assembly_dataset_id.startswith(xlib.get_transabyss_code()): assembly_software = xlib.get_transabyss_code() elif assembly_dataset_id.startswith(xlib.get_trinity_code()): assembly_software = xlib.get_trinity_code() elif assembly_dataset_id.startswith(xlib.get_star_code()): assembly_software = xlib.get_star_code() elif assembly_dataset_id.startswith(xlib.get_cd_hit_est_code()): assembly_software = xlib.get_cd_hit_est_code() elif assembly_dataset_id.startswith(xlib.get_transcript_filter_code()): assembly_software = xlib.get_transcript_filter_code() # create the BUSCO config file and write the default options try: if not os.path.exists(os.path.dirname(get_busco_config_file())): os.makedirs(os.path.dirname(get_busco_config_file())) with open(get_busco_config_file(), mode='w', encoding='utf8') as file_id: file_id.write('{0}\n'.format('# You must review the information of this file and update the values with the corresponding ones to the current run.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# The reference file must be located in the cluster directory {0}/experiment_id/reference_dataset_id'.format(xlib.get_cluster_reference_dir()))) file_id.write('{0}\n'.format('# The assembly files must be located in the cluster directory {0}/experiment_id/assembly_dataset_id'.format(xlib.get_cluster_result_dir()))) file_id.write('{0}\n'.format('# The experiment_id and assembly_dataset_id names are fixed in the identification section.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# In section "BUSCO parameters", the key "augustus_options" allows you to input additional August parameters in the format:')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# augustus_options = --parameter-1[=value-1][; --parameter-2[=value-2][; ...; --parameter-n[=value-n]]]')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# parameter-i is a parameter name of Augustus and value-i a valid value of parameter-i, e.g.')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# augustus_options = --translation_table=6 --progress=true)')) file_id.write('{0}\n'.format('#')) file_id.write('{0}\n'.format('# You can consult the parameters of BUSCO and their meaning in http://busco.ezlab.org/.')) file_id.write('{0}\n'.format('# and August ones in http://bioinf.uni-greifswald.de/augustus/.')) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# This section has the information identifies the experiment.')) file_id.write('{0}\n'.format('[identification]')) file_id.write('{0:<50} {1}\n'.format('experiment_id = {0}'.format(experiment_id), '# experiment identification')) file_id.write('{0:<50} {1}\n'.format('assembly_software = {0}'.format(assembly_software), '# assembly software: {0} ({1}) or {2} ({3}) or {4} ({5}) or {6} ({7}) or {8} ({9}) or {10} ({11})'.format(xlib.get_soapdenovotrans_code(), xlib.get_soapdenovotrans_name(), xlib.get_transabyss_code(), xlib.get_transabyss_name(), xlib.get_trinity_code(), xlib.get_trinity_name(), xlib.get_star_code(), xlib.get_star_name(), xlib.get_cd_hit_est_code(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_code(), xlib.get_transcript_filter_name()))) file_id.write('{0:<50} {1}\n'.format('assembly_dataset_id = {0}'.format(assembly_dataset_id), '# assembly dataset identification')) file_id.write('{0:<50} {1}\n'.format('assembly_type = {0}'.format(assembly_type), '# CONTIGS or SCAFFOLDS in {0}; NONE in {1}, {2}, {3}, {4} and {5}'.format(xlib.get_soapdenovotrans_name(), xlib.get_transabyss_name(), xlib.get_trinity_name(), xlib.get_star_name(), xlib.get_cd_hit_est_name(), xlib.get_transcript_filter_name()))) file_id.write('{0}\n'.format('')) file_id.write('{0}\n'.format('# This section has the information to set the BUSCO parameters')) file_id.write('{0}\n'.format('[BUSCO parameters]')) file_id.write('{0:<50} {1}\n'.format('ncpu = 2', '# number of threads/cores for use')) file_id.write('{0:<50} {1}\n'.format('lineage_data = embryophyta_odb9', '# value to find the lineage data url in BUSCO web (e.g. embryophyta -> http://busco.ezlab.org/v2/datasets/embryophyta_odb9.tar.gz)')) file_id.write('{0:<50} {1}\n'.format('mode = tran', '# geno (genome assemblies, DNA) or tran (transcriptome assemblies, DNA) or prot (annotated gene sets, proteins)')) file_id.write('{0:<50} {1}\n'.format('evalue = 1e-03', '# E-value cutoff for BLAST searches')) file_id.write('{0:<50} {1}\n'.format('limit = 3', '# number of candidate regions to consider')) file_id.write('{0:<50} {1}\n'.format('species = NONE', '# identifier of existing Augustus species gene finding parameters or NONE')) file_id.write('{0:<50} {1}\n'.format('long = NO', '# Augustus optimization mode for self-training: YES or NO')) file_id.write('{0:<50} {1}\n'.format('augustus_options = NONE', '# additional parameters to August or NONE')) except: error_list.append('*** ERROR: The file {0} can not be recreated'.format(get_busco_config_file())) OK = False # return the control variable and the error list return (OK, error_list)
def execute(self, event=None): ''' Execute the list the result logs in the cluster. ''' # validate inputs OK = self.validate_inputs() if not OK: message = 'Some input values are not OK.' tkinter.messagebox.showerror('{0} - {1}'.format(xlib.get_project_name(), self.head), message) # get the run dictionary of the experiment if OK: # -- command = 'ls {0}/{1}'.format(xlib.get_cluster_result_dir(), self.wrapper_experiment_id.get()) command = 'cd {0}/{1}; for list in `ls`; do ls -ld $list | grep -v ^- > /dev/null && echo $list; done;'.format(xlib.get_cluster_result_dir(), self.wrapper_experiment_id.get()) (OK, stdout, stderr) = xssh.execute_cluster_command(self.ssh_client, command) if OK: result_dataset_dict = {} for line in stdout: line = line.rstrip('\n') if line != 'lost+found': result_dataset_id = line try: pattern = r'^(.+)\-(.+)\-(.+)$' mo = re.search(pattern, result_dataset_id) bioinfo_app_code = mo.group(1).strip() yymmdd = mo.group(2) hhmmss = mo.group(3) date = '20{0}-{1}-{2}'.format(yymmdd[:2], yymmdd[2:4], yymmdd[4:]) time = '{0}:{1}:{2}'.format(hhmmss[:2], hhmmss[2:4], hhmmss[4:]) except: bioinfo_app_code = 'xxx' date = '0000-00-00' time = '00:00:00' if result_dataset_id.startswith(xlib.get_bedtools_code()+'-'): bioinfo_app_name = xlib.get_bedtools_name() elif result_dataset_id.startswith(xlib.get_blastplus_code()+'-'): bioinfo_app_name = xlib.get_blastplus_name() elif result_dataset_id.startswith(xlib.get_bowtie2_code()+'-'): bioinfo_app_name = xlib.get_bowtie2_name() elif result_dataset_id.startswith(xlib.get_busco_code()+'-'): bioinfo_app_name = xlib.get_busco_name() elif result_dataset_id.startswith(xlib.get_cd_hit_code()+'-'): bioinfo_app_name = xlib.get_cd_hit_name() elif result_dataset_id.startswith(xlib.get_cd_hit_est_code()+'-'): bioinfo_app_name = xlib.get_cd_hit_est_name() elif result_dataset_id.startswith(xlib.get_detonate_code()+'-'): bioinfo_app_name = xlib.get_detonate_name() elif result_dataset_id.startswith(xlib.get_emboss_code()+'-'): bioinfo_app_name = xlib.get_emboss_name() elif result_dataset_id.startswith(xlib.get_fastqc_code()+'-'): bioinfo_app_name = xlib.get_fastqc_name() elif result_dataset_id.startswith(xlib.get_gmap_code()+'-'): bioinfo_app_name = xlib.get_gmap_name() elif result_dataset_id.startswith(xlib.get_gmap_gsnap_code()+'-'): bioinfo_app_name = xlib.get_gmap_gsnap_name() elif result_dataset_id.startswith(xlib.get_gzip_code()+'-'): bioinfo_app_name = xlib.get_gzip_name() elif result_dataset_id.startswith(xlib.get_insilico_read_normalization_code()+'-'): bioinfo_app_name = xlib.get_insilico_read_normalization_name() elif result_dataset_id.startswith(xlib.get_miniconda3_code()+'-'): bioinfo_app_name = xlib.get_miniconda3_name() elif result_dataset_id.startswith(xlib.get_ngshelper_code()+'-'): bioinfo_app_name = xlib.get_ngshelper_name() elif result_dataset_id.startswith(xlib.get_quast_code()+'-'): bioinfo_app_name = xlib.get_quast_name() elif result_dataset_id.startswith(xlib.get_r_code()+'-'): bioinfo_app_name = xlib.get_r_name() elif result_dataset_id.startswith(xlib.get_ref_eval_code()+'-'): bioinfo_app_name = xlib.get_ref_eval_name() elif result_dataset_id.startswith(xlib.get_rnaquast_code()+'-'): bioinfo_app_name = xlib.get_rnaquast_name() elif result_dataset_id.startswith(xlib.get_rsem_code()+'-'): bioinfo_app_name = xlib.get_rsem_name() elif result_dataset_id.startswith(xlib.get_rsem_eval_code()+'-'): bioinfo_app_name = xlib.get_rsem_eval_name() elif result_dataset_id.startswith(xlib.get_samtools_code()+'-'): bioinfo_app_name = xlib.get_samtools_name() elif result_dataset_id.startswith(xlib.get_soapdenovotrans_code()+'-'): bioinfo_app_name = xlib.get_soapdenovotrans_name() elif result_dataset_id.startswith(xlib.get_star_code()+'-'): bioinfo_app_name = xlib.get_star_name() elif result_dataset_id.startswith(xlib.get_transabyss_code()+'-'): bioinfo_app_name = xlib.get_transabyss_name() elif result_dataset_id.startswith(xlib.get_transcript_filter_code()+'-'): bioinfo_app_name = xlib.get_transcript_filter_name() elif result_dataset_id.startswith(xlib.get_transcriptome_blastx_code()+'-'): bioinfo_app_name = xlib.get_transcriptome_blastx_name() elif result_dataset_id.startswith(xlib.get_transrate_code()+'-'): bioinfo_app_name = xlib.get_transrate_name() elif result_dataset_id.startswith(xlib.get_trimmomatic_code()+'-'): bioinfo_app_name = xlib.get_trimmomatic_name() elif result_dataset_id.startswith(xlib.get_trinity_code()+'-'): bioinfo_app_name = xlib.get_trinity_name() else: bioinfo_app_name = 'xxx' result_dataset_dict[result_dataset_id] = {'experiment_id': self.wrapper_experiment_id.get(), 'result_dataset_id': result_dataset_id, 'bioinfo_app': bioinfo_app_name, 'date': date, 'time': time} # verify if there are any nodes running if OK: if result_dataset_dict == {}: message = 'There is not any run.' tkinter.messagebox.showwarning('{0} - {1}'.format(xlib.get_project_name(), self.head), message) # build the data list if OK: data_list = ['experiment_id', 'result_dataset_id', 'bioinfo_app', 'date', 'time'] # build the data dictionary if OK: data_dict = {} data_dict['experiment_id']= {'text': 'Experiment id. / Process', 'width': 200, 'aligment': 'left'} data_dict['result_dataset_id'] = {'text': 'Result dataset', 'width': 200, 'aligment': 'left'} data_dict['bioinfo_app'] = {'text': 'Bioinfo app / Utility', 'width': 200, 'aligment': 'left'} data_dict['date'] = {'text': 'Date', 'width': 80, 'aligment': 'right'} data_dict['time'] = {'text': 'Time', 'width': 80, 'aligment': 'right'} # create the dialog Table to show the nodes running if OK: dialog_table = gdialogs.DialogTable(self, 'Experiment runs in {0}/{1}'.format(xlib.get_cluster_result_dir(), self.wrapper_experiment_id.get()), 400, 900, data_list, data_dict, result_dataset_dict, 'view_result_logs', [self.wrapper_cluster_name.get()]) self.wait_window(dialog_table) # close the form if OK: self.close()