c2b8cff1ef6f9635d688e7dd2192651d2f9d08ac
[qpalma.git] / scripts / grid_alignment.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 createAlignmentFileFromPrediction import *
14
15 import grid_alignment
16
17 from Utils import split_file_join_results
18
19
20 def g_alignment(chunk_fn,result_fn):
21 create_alignment_file(chunk_fn,result_fn)
22
23
24 def create_and_submit():
25 jp = os.path.join
26
27 run_dir = '/fml/ag-raetsch/home/fabio/tmp/newest_run/alignment/run_enable_quality_scores_+_enable_splice_signals_+_enable_intron_length_+'
28 data_dir = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data'
29
30 chunks_fn = []
31 for fn in os.listdir(run_dir):
32 if fn.startswith('chunk'):
33 chunks_fn.append(fn)
34
35 functionJobs=[]
36
37 for chunk_fn in chunks_fn:
38 chunk_name = chunk_fn[:chunk_fn.find('.')]
39 result_fn = jp(data_dir,'%s.align_remap'%chunk_name)
40 chunk_fn = jp(run_dir,chunk_fn)
41
42 #pdb.set_trace()
43
44 current_job = KybJob(grid_alignment.g_alignment,[chunk_fn,result_fn])
45 current_job.h_vmem = '15.0G'
46 #current_job.express = 'True'
47
48 print "job #1: ", current_job.nativeSpecification
49
50 functionJobs.append(current_job)
51
52 processedFunctionJobs = processJobs(functionJobs)
53 print "ret fields AFTER execution on cluster"
54 for (i, job) in enumerate(processedFunctionJobs):
55 print "Job with id: ", i, "- ret: ", job.ret
56
57
58 if __name__ == '__main__':
59 #split_file_join_results('/fml/ag-raetsch/home/fabio/tmp/transcriptome_data/map.vm',10)
60 create_and_submit()