root/galaxy-central/tools/rgenetics/rgfakePed_code.py

リビジョン 2, 1.6 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1import os, string, time
2from galaxy import datatypes
3from galaxy import app
4import galaxy.util
5
6#Provides Upload tool with access to list of available builds
7repospath = '/usr/local/galaxy/data/rg'
8builds = []
9#Read build names and keys from galaxy.util
10for dbkey, build_name in galaxy.util.dbnames:
11    builds.append((build_name,dbkey,False))
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#Return available builds
19def get_available_builds(defval='hg18'):
20    for i,x in enumerate(builds):
21        if x[1] == defval:
22           x = list(x)
23           x[2] = True
24           builds[i] = tuple(x)
25    return builds
26
27# Create link to files here
28def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
29    base_name = param_dict.get( 'title1', 'Null_Genotypes' )
30    base_name = base_name.encode()
31    outFormat = param_dict.get('outFormat','P')
32    s = string.whitespace + string.punctuation
33    ptran =  string.maketrans(s,'_'*len(s))
34    base_name = base_name.translate(ptran)
35    pname = "out_file1"
36    lookup = {'L':('linkped','lped'),'F':('FBAT','fped')}
37    # /usr/local/galaxy/data/rg/1/lped/
38    info = 'Null phenotypes created by rgfakePhe at %s' % timenow()
39    data = out_data[pname]
40    ftype,pext = lookup[outFormat]
41    data.name = '%s.%s' % (base_name,pext) # that's how they've been named in rgfakePhe.py
42    data.change_datatype(pext)
43    data.file_name = data.file_name
44    data.metadata.base_name = base_name
45    data.readonly = True
46    out_data[pname] = data
47    app.model.context.flush()
48
49
50
51
52
53
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。