1 | # before running the qc, need to rename various output files |
---|
2 | import time,string |
---|
3 | |
---|
4 | def timenow(): |
---|
5 | """return current time as a string |
---|
6 | """ |
---|
7 | return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time())) |
---|
8 | |
---|
9 | def get_out_formats(): |
---|
10 | """return options for formats""" |
---|
11 | dat = [['ucsc genome graphs','gg',True],['ucsc track','wig',False],['tab delimited','xls',False]] |
---|
12 | dat = [(x[0],x[1],x[2]) for x in dat] |
---|
13 | return dat |
---|
14 | |
---|
15 | |
---|
16 | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr): |
---|
17 | """Sets the name of the data |
---|
18 | <command interpreter="python2.4"> |
---|
19 | rgTDT.py -i $i.extra_files_path/$i.metadata.base_name -o $title -f $outformat -r $out_file1 -l $logf |
---|
20 | </command> |
---|
21 | |
---|
22 | """ |
---|
23 | dbk = param_dict.get('dbkey','hg18') |
---|
24 | job_name = param_dict.get( 'title1', 'rgTDTtest1' ) |
---|
25 | killme=string.punctuation+string.whitespace |
---|
26 | trantab = string.maketrans(killme,'_'*len(killme)) |
---|
27 | job_name = job_name.encode().translate(trantab) |
---|
28 | outxls = ['tabular','%s_TDT.xls' % job_name] |
---|
29 | logtxt = ['txt','%s_TDT_log.txt' % job_name] |
---|
30 | ggout = ['gg','%s_TDT_topTable.gff' % job_name] |
---|
31 | lookup={} |
---|
32 | lookup['out_file1'] = outxls |
---|
33 | lookup['logf'] = logtxt |
---|
34 | lookup['gffout'] = ggout |
---|
35 | info = 'rgTDT run at %s' % timenow() |
---|
36 | for name in lookup.keys(): |
---|
37 | data = out_data[name] |
---|
38 | data_type,newname = lookup[name] |
---|
39 | data.name = newname |
---|
40 | data.info = info |
---|
41 | data.dbkey = dbk |
---|
42 | out_data[name] = data |
---|
43 | app.model.context.flush() |
---|