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

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

import galaxy-central

行番号 
1from galaxy import datatypes,model
2import sys,time,string,os,shutil
3
4def timenow():
5    """return current time as a string
6    """
7    return time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(time.time()))
8
9def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
10    """Sets the name of the html output file
11    """
12    killme = string.punctuation + string.whitespace
13    trantab = string.maketrans(killme,'_'*len(killme))
14    job_name = param_dict.get( 'title1', 'rgGRR' )
15    job_name = job_name.encode()
16    newname = '%s.html' % job_name.translate(trantab)
17    indatname = inp_data['i'].name
18    info = '%s Mean allele sharing on %s at %s' % (job_name,indatname,timenow())
19    ofname = 'out_file1'
20    data = out_data[ofname]
21    data.name = newname
22    data.info = info
23    out_data[ofname] = data
24    fromdir = data.extra_files_path
25    indat = inp_data['i']
26    indatname = indat.name
27    base_name = indat.metadata.base_name
28    todir = indat.extra_files_path # where the ldreduced stuff should be
29    ldfname = '%s_INDEP_THIN' % base_name # we store ld reduced and thinned data
30    ldout = os.path.join(todir,ldfname)
31    ldin = os.path.join(fromdir,ldfname)
32    if os.path.exists('%s.bed' % ldin) and not os.path.exists('%s.bed' % ldout): # copy ldreduced to input for next time
33        for ext in ['bim','bed','fam']:
34            src = '%s.%s' % (ldin,ext)
35            dest = '%s.%s' % (ldout,ext)
36            shutil.copy(src,dest)
37    app.model.context.flush()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。