[2] | 1 | import os, string, time
|
---|
| 2 | from galaxy import datatypes
|
---|
| 3 | from galaxy import app
|
---|
| 4 | import galaxy.util
|
---|
| 5 |
|
---|
| 6 | #Provides Upload tool with access to list of available builds
|
---|
| 7 | repospath = '/usr/local/galaxy/data/rg'
|
---|
| 8 | builds = []
|
---|
| 9 | #Read build names and keys from galaxy.util
|
---|
| 10 | for dbkey, build_name in galaxy.util.dbnames:
|
---|
| 11 | builds.append((build_name,dbkey,False))
|
---|
| 12 |
|
---|
| 13 | def 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
|
---|
| 19 | def 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
|
---|
| 28 | def 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 |
|
---|