/tools/rgenetics/rgQC_code.py
Python | 38 lines | 36 code | 0 blank | 2 comment | 0 complexity | ccf8932589590836eec11749696497cc MD5 | raw file
1""" 2# after running the qc, need to rename various output files 3 <data format="html" name="html_file" /> 4 <data format="txt" name="log_file" parent="html_file" /> 5 <data format="tabular" name="marker_file" parent="html_file" /> 6 <data format="tabular" name="subject_file" parent="html_file" /> 7 <data format="tabular" name="freq_file" parent="html_file" /> 8 </outputs> 9""" 10from galaxy import datatypes,model 11import sys,time 12 13def timenow(): 14 """return current time as a string 15 """ 16 return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time())) 17 18 19def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr): 20 """Change data file names 21 22 """ 23 job_name = param_dict.get( 'out_prefix', 'rgQCdefault' ) 24 html = ['html','%s.html' % job_name] 25 lookup={} 26 lookup['html_file'] = html 27 info = '%s QC report by rgQC at %s' % (job_name,timenow()) 28 for aname in lookup.keys(): 29 data = out_data[aname] 30 data_type,newname = lookup[aname] 31 data = app.datatypes_registry.change_datatype(data, data_type) 32 data.name = newname 33 data.info = info 34 out_data[aname] = data 35 app.model.context.flush() 36 37 38