Exemple #1
0
	def _run(self, data):
		output_choice = 'display'
		(boolean_var, fileupload_parameters) = utils.get_boolean_file_params(service_dir+'/' + tool.replace('-','_') +'.yml')
		exclude = fileupload_parameters + ['content-type']
		for x in fileupload_parameters:
			exclude = exclude + [x + '_string', x + '_string_type']
		command = utils.perl_scripts + '/' + tool
		result_dir = utils.make_tmp_dir(tool)
		
		for param in data:
		    if param in boolean_var:
		        if data[param] == True:
		            command += ' -' + param
		        elif data[param] == False:
		            continue
		    elif data[param] is not None and data[param] != '' and param not in exclude:
		        if 'uth_' in param:
		            uth_type = param.split('_', 1)
		            command += ' -uth ' + uth_type[1] + ' ' + str(data[param])
		        elif 'lth_' in param:
		            lth_type = param.split('_', 1)
		            command += ' -lth ' + lth_type[1] + ' ' + str(data[param])
		        else:  
		            command += ' -' + param + ' ' + str(data[param])
		command += utils.parse_fileupload_parameters(data, fileupload_parameters, tool, result_dir, ',')
		return utils.run_command(command, output_choice, tool, 'text', result_dir)
Exemple #2
0
 def parse_arg(self, code, parser):
     tmp_dir = make_tmp_dir(self._data_dir)
     js_path = hash_val(code) + '.js'
     js_path = os.path.join(tmp_dir, js_path)
     write(js_path, code)
     ast_path = parser.parse(js_path)
     return tmp_dir, ast_path
Exemple #3
0
	def _run(self, data):
		output_choice = 'display'
		(boolean_var, fileupload_parameters) = utils.get_boolean_file_params(service_dir+'/' + tool.replace('-','_') +'.yml')
		exclude = fileupload_parameters + ['content-type']
		for x in fileupload_parameters:
			exclude = exclude + [x + '_string', x + '_string_type']
		exclude += ['markov_order']
		command = utils.rsat_bin + '/' + tool
		result_dir = utils.make_tmp_dir(tool)
		
		for param in data:
		    if param in boolean_var:
		        if data[param] == True:
		            command += ' -' + param
		        elif data[param] == False:
		            continue
		    elif data[param] is not None and data[param] != '' and param not in exclude:
		        if param == 'org' and data[param] is not None and data[param] != '':
		            len = 1
		            if 'markov_order' in data and data['markov_order'] is not None and data['markov_order'] != '':
		                len = data['markov_order'] + 1 
		            command += ' -bgfile ' + utils.get_backgroundfile(data['org'], len) + '.gz'
		        elif 'uth_' in param:
		            uth_type = param.split('_', 1)
		            command += ' -uth ' + uth_type[1] + ' ' + str(data[param])
		        elif 'lth_' in param:
		            lth_type = param.split('_', 1)
		            command += ' -lth ' + lth_type[1] + ' ' + str(data[param])
		        else:  
		            command += ' -' + param + ' ' + str(data[param])
		command += utils.parse_fileupload_parameters(data, fileupload_parameters, tool, result_dir, ',')
		return utils.run_command(command, output_choice, tool, 'ft', result_dir)
    def _run(self, data):
        output_choice = 'display'
        (boolean_var, fileupload_parameters
         ) = utils.get_boolean_file_params(service_dir + '/' +
                                           tool.replace('-', '_') + '.yml')
        exclude = fileupload_parameters + ['content-type']
        for x in fileupload_parameters:
            exclude = exclude + [x + '_string', x + '_string_type']
        command = utils.perl_scripts + '/' + tool
        result_dir = utils.make_tmp_dir(tool)

        for param in data:
            if param in boolean_var:
                if data[param] == True:
                    command += ' -' + param
                elif data[param] == False:
                    continue
            elif data[param] is not None and data[
                    param] != '' and param not in exclude:
                command += ' -' + param + ' ' + str(data[param])
        command += utils.parse_fileupload_parameters(data,
                                                     fileupload_parameters,
                                                     tool, result_dir, ',')
        command += ' -o ' + result_dir + '/position_analysis.tab'
        return utils.run_command_background(command, tool, result_dir,
                                            'position_analysis_index.html')
Exemple #5
0
 def _run(self, data):
     output_choice = 'display'
     (boolean_var, fileupload_parameters
      ) = utils.get_boolean_file_params(service_dir + '/' +
                                        tool.replace('-', '_') + '.yml')
     exclude = fileupload_parameters + ['content-type']
     for x in fileupload_parameters:
         exclude = exclude + [x + '_string', x + '_string_type']
     command = utils.perl_scripts + '/' + tool
     result_dir = utils.make_tmp_dir(tool)
     for param in data:
         if param in boolean_var:
             if data[param] == True:
                 command += ' -' + param
             elif data[param] == False:
                 continue
         elif data[param] is not None and data[
                 param] != '' and param not in exclude:
             if param == 'return':
                 return_fields = data[param].split(',')
                 for i in return_fields:
                     command += ' -return ' + i.strip()
             elif param == 'q':
                 q_fields = data[param].split(',')
                 for i in q_fields:
                     command += ' -q ' + i.strip()
             else:
                 command += ' -' + param + ' ' + str(data[param])
     command += utils.parse_fileupload_parameters(data,
                                                  fileupload_parameters,
                                                  tool, result_dir, ',')
     return utils.run_command(command, output_choice, tool, 'tab',
                              result_dir)
Exemple #6
0
    def _run(self, data):
        output_choice = 'display'
        (boolean_var, fileupload_parameters
         ) = utils.get_boolean_file_params(service_dir + '/' +
                                           tool.replace('-', '_') + '.yml')
        exclude = fileupload_parameters + ['content-type']
        for x in fileupload_parameters:
            exclude = exclude + [x + '_string', x + '_string_type']
        command = utils.rsat_bin + '/' + tool
        result_dir = utils.make_tmp_dir(tool)

        options_var = [
            'maxspacing', 'minspacing', 'sites', 'collect', 'seedmatrix',
            'strand'
        ]
        for param in data:
            if param in boolean_var:
                if data[param] == True:
                    if param == 'zoops':
                        command += ' --zoops'
                    else:
                        command += ' -' + param
                elif data[param] == False:
                    continue
            elif data[param] is not None and data[
                    param] != '' and param not in exclude:
                if param in options_var:
                    command += ' ---' + param + '=' + str(data[param])
                else:
                    command += ' -' + param + ' ' + str(data[param])
        command += utils.parse_fileupload_parameters(data,
                                                     fileupload_parameters,
                                                     tool, result_dir, ',')
        return utils.run_command(command, output_choice, tool, 'tab',
                                 result_dir)
    def _run(self, data):
        output_choice = 'display'
        (boolean_var, fileupload_parameters
         ) = utils.get_boolean_file_params(service_dir + '/' +
                                           tool.replace('-', '_') + '.yml')
        exclude = fileupload_parameters + ['content-type']
        for x in fileupload_parameters:
            exclude = exclude + [x + '_string', x + '_string_type']
        command = utils.perl_scripts + '/' + tool
        result_dir = utils.make_tmp_dir(tool)

        matrix_title = dict()
        matrix_format = dict()

        for param in data:
            if 'matrix_title_' in param and data[param] != '':
                p = re.compile('matrix_title_(\d)')
                num = p.search(param)
                matrix_title[int(num.group(1)) - 1] = data[param]
            elif 'matrix_format_' in param and data[param] != '':
                p = re.compile('matrix_format_(\d)')
                num = p.search(param)
                matrix_format[int(num.group(1)) - 1] = data[param]
            elif param == 'o':
                command += ' -o ' + result_dir + '/' + data[param]
            elif param in boolean_var:
                if data[param] == True:
                    command += ' -' + param
                elif data[param] == False:
                    continue
            elif data[param] is not None and data[
                    param] != '' and param not in exclude:
                if 'uth_' in param:
                    uth_type = param.split('_', 1)
                    command += ' -uth ' + uth_type[1] + ' ' + str(data[param])
                elif 'lth_' in param:
                    lth_type = param.split('_', 1)
                    command += ' -lth ' + lth_type[1] + ' ' + str(data[param])
                else:
                    command += ' -' + param + ' ' + str(data[param])
        upload_str = utils.parse_fileupload_parameters(data,
                                                       fileupload_parameters,
                                                       tool, result_dir, ',')
        upload_str = re.sub(r"matrix_\d+", "matrix", upload_str)
        matrix_file = re.split('\s*-matrix\s*', upload_str)
        upload_str = ''
        for key in matrix_title:
            if matrix_title[key] != '':
                upload_str += ' -matrix ' + matrix_title[
                    key] + ' ' + matrix_file[key +
                                             1] + ' ' + matrix_format[key]
        command += upload_str
        command += ' -outdir ' + result_dir + ' -prefix ' + tool
        return utils.run_command_background(command, tool, result_dir,
                                            data['o'] + '_SUMMARY.html')
Exemple #8
0
	def _run(self,data):
		output_choice = 'display'
		fileupload_parameters = ['i']
		exclude = fileupload_parameters + ['content-type']
		for x in fileupload_parameters:
			exclude = exclude + [x + '_string', x + '_string_type']
		command = utils.perl_scripts + '/' + tool
		result_dir = utils.make_tmp_dir(tool)
		for param in data:
			if data[param] is not None and data[param] != '' and param not in exclude:
				command += ' -' + param + ' ' + str(data[param])
		command += utils.parse_fileupload_parameters(data, fileupload_parameters, tool, result_dir, ',') 
		return utils.run_command(command, output_choice, tool, 'fasta', result_dir) 
Exemple #9
0
 def _run(self,data):
     output_choice = 'display'        
     (boolean_var, fileupload_parameters) = utils.get_boolean_file_params(service_dir+'/' + tool.replace('-','_') +'.yml')
     exclude = fileupload_parameters + ['content-type']
     for x in fileupload_parameters:
         exclude = exclude + [x + '_string', x + '_string_type']
         
     result_dir = utils.make_tmp_dir(tool)
     command = utils.perl_scripts + '/' + tool
     
     for param in data:
         if param in boolean_var:
             if data[param] == True:
                 command += ' -' + param
             elif data[param] == False:
                 continue
         elif data[param] is not None and data[param] != '' and not param in exclude:
             command += ' -' + param + ' ' + str(data[param])
     command += utils.parse_fileupload_parameters(data, fileupload_parameters, tool, result_dir, ',') 
     return utils.run_command(command, output_choice, tool, data['out_format'], result_dir)
Exemple #10
0
    def _run(self, data):
        output_choice = 'display'
        (boolean_var, fileupload_parameters
         ) = utils.get_boolean_file_params(service_dir + '/' +
                                           tool.replace('-', '_') + '.yml')
        exclude = fileupload_parameters + ['content-type']
        for x in fileupload_parameters:
            exclude = exclude + [x + '_string', x + '_string_type']
        # background model
        exclude += ['markov_order', 'org', 'seq_type', 'seq_type_2']
        command = utils.perl_scripts + '/' + tool
        result_dir = utils.make_tmp_dir(tool)

        for param in data:
            if param in boolean_var:
                if data[param] == True:
                    command += ' -' + param
                elif data[param] == False:
                    continue
            elif param == 'seq_type' and data[
                    param] is not None and data[param] != '':
                seq_file = utils.parse_fileupload_parameters(
                    data, ['seq_file'], tool, result_dir, ',')
                seq_file_ops = seq_file.strip().split(' ')
                command += ' -seq ' + data['seq_type'] + ' ' + seq_file_ops[1]
            elif param == 'seq_type_2' and data[
                    param] is not None and data[param] != '':
                seq_file = utils.parse_fileupload_parameters(
                    data, ['seq_file_2'], tool, result_dir, ',')
                seq_file_ops = seq_file.strip().split(' ')
                command += ' -seq ' + data['seq_type_2'] + ' ' + seq_file_ops[1]
            elif param == 'perm' and data[
                    param] is not None and data[param] != '':
                command += ' -perm ' + data['seq_type'] + ' ' + str(
                    data[param])
            elif param == 'plot' and data[
                    param] is not None and data[param] != '':
                command += ' -plot ' + data['seq_type'] + ' ' + data[param]
            elif param == 'perm_2' and data[
                    param] is not None and data[param] != '':
                command += ' -perm ' + data['seq_type_2'] + ' ' + str(
                    data[param])
            elif param == 'plot_2' and data[
                    param] is not None and data[param] != '':
                command += ' -plot ' + data['seq_type_2'] + ' ' + data[param]
            elif param == 'org' and data[
                    param] is not None and data[param] != '':
                len = 1
                if 'markov_order' in data and data[
                        'markov_order'] is not None and data[
                            'markov_order'] != '':
                    len = data['markov_order'] + 1
                command += ' -bgfile ' + utils.get_backgroundfile(
                    data['org'], len) + '.gz'
            elif data[param] is not None and data[
                    param] != '' and param not in exclude:
                command += ' -' + param + ' ' + str(data[param])
        command += utils.parse_fileupload_parameters(data,
                                                     ['m', 'ms', 'bgfile'],
                                                     tool, result_dir, ',')
        command += ' -o ' + result_dir + '/' + tool
        return utils.run_command_background(command, tool, result_dir,
                                            tool + '_synthesis.html')