1 | # for caco
|
---|
2 | # called as plinkCaCo.py $i $name $test $outformat $out_file1 $logf $map
|
---|
3 | from galaxy import datatypes
|
---|
4 | import time,string,sys
|
---|
5 |
|
---|
6 | def timenow():
|
---|
7 | """return current time as a string
|
---|
8 | """
|
---|
9 | return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time()))
|
---|
10 |
|
---|
11 | def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
|
---|
12 | """Sets the name of the data"""
|
---|
13 | job_name = param_dict.get( 'name', 'RgCaCo' ).encode()
|
---|
14 | killme = string.punctuation + string.whitespace
|
---|
15 | trantab = string.maketrans(killme,'_'*len(killme))
|
---|
16 | title = job_name.translate(trantab)
|
---|
17 | indatname = inp_data['i'].name
|
---|
18 | outxls = ['tabular','%s_CaCo.xls' % job_name]
|
---|
19 | logtxt = ['txt','%s_CaCo_log.txt' % job_name]
|
---|
20 | ggout = ['gff','%s_CaCo_topTable.gff' % job_name]
|
---|
21 | lookup={}
|
---|
22 | lookup['out_file1'] = outxls
|
---|
23 | lookup['logf'] = logtxt
|
---|
24 | lookup['gffout'] = ggout
|
---|
25 | info = '%s rgCaCo from %s at %s' % (job_name,indatname,timenow())
|
---|
26 | for name in lookup.keys():
|
---|
27 | data = out_data[name]
|
---|
28 | data_type,newname = lookup[name]
|
---|
29 | data.name = newname
|
---|
30 | data.info = info
|
---|
31 | out_data[name] = data
|
---|
32 | app.model.context.flush()
|
---|
33 |
|
---|
34 |
|
---|
35 | def get_test_opts():
|
---|
36 | """return test options"""
|
---|
37 | dat = [('Armitage test for trend chisq. Does NOT assume HWE!','TREND',True),
|
---|
38 | ('Allelic (A vs a) chisq. assumes HWE','ALLELIC',False),
|
---|
39 | ('Genotype (AA vs Aa vs aa)chisq. assumes HWE','GENO',False),
|
---|
40 | ('Dominant model (AA/Aa vs aa) chisq. assumesWE','DOM',False),
|
---|
41 | ('Recessive (AA vs Aa/aa) chisq. assumes HWE','REC',False)]
|
---|
42 | dat.reverse()
|
---|
43 | return dat
|
---|
44 |
|
---|
45 |
|
---|