+ minor changes to support transcriptome data
[qpalma.git] / scripts / grid_heuristic.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import cPickle
5 import sys
6 import pdb
7 import os
8 import os.path
9 import math
10
11 from pythongrid import Job, KybJob, MethodJob, processJobs, Usage, processJobsLocally
12
13 from PipelineHeuristic import *
14
15 import grid_heuristic
16
17 from Utils import split_file_join_results
18
19 def g_heuristic(run_fname,data_fname,param_fname,result_fname):
20 #print run_fname,data_fname,param_fname,result_fname
21 ph1 = PipelineHeuristic(run_fname,data_fname,param_fname,result_fname)
22 ph1.filter()
23
24
25 return 'finished filtering set %s.' % data_fname
26
27 def create_and_submit():
28 jp = os.path.join
29
30 run_dir = '/fml/ag-raetsch/home/fabio/tmp/newest_run/alignment/run_enable_quality_scores_+_enable_splice_signals_+_enable_intron_length_+'
31 data_dir = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data'
32
33 run_fname = jp(run_dir,'run_obj.pickle')
34 data_fname = jp(data_dir,'map.vm')
35 param_fname = jp(run_dir,'param_526.pickle')
36
37 functionJobs=[]
38
39 for idx in range(10):
40 data_fname = jp(data_dir,'map.vm.part_%d'%idx)
41 result_fname = jp(data_dir,'map.vm.part_%d.heuristic'%idx)
42
43 current_job = KybJob(grid_predict.g_heuristic,[run_fname,data_fname,param_fname,result_fname])
44 current_job.h_vmem = '25.0G'
45 #current_job.express = 'True'
46
47 print "job #1: ", current_job.nativeSpecification
48
49 functionJobs.append(current_job)
50
51 processedFunctionJobs = processJobs(functionJobs)
52 print "ret fields AFTER execution on cluster"
53 for (i, job) in enumerate(processedFunctionJobs):
54 print "Job with id: ", i, "- ret: ", job.ret
55
56
57 if __name__ == '__main__':
58 #split_file_join_results('/fml/ag-raetsch/home/fabio/tmp/transcriptome_data/map.vm',10)
59 create_and_submit()