+ added some testcases
[qpalma.git] / scripts / grid_alignment.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import cPickle
5 import sys
6 import time
7 import pdb
8 import os
9 import os.path
10 import math
11
12 from pythongrid import KybJob, Usage
13 from pythongrid import process_jobs, submit_jobs, collect_jobs, get_status
14
15 from createAlignmentFileFromPrediction import *
16
17 import grid_alignment
18
19 def g_alignment(chunk_fn,result_fn):
20 create_alignment_file(chunk_fn,result_fn)
21
22
23 def create_and_submit():
24 jp = os.path.join
25
26 #run_dir = '/fml/ag-raetsch/home/fabio/tmp/newest_run/alignment/run_enable_quality_scores_+_enable_splice_signals_+_enable_intron_length_+'
27 #run_dir = '/fml/ag-raetsch/home/fabio/tmp/newest_run/alignment/saved_run'
28 #run_dir = '/fml/ag-raetsch/home/fabio/tmp/sandbox/alignment'
29 #data_dir = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data'
30 #data_dir = '/fml/ag-raetsch/home/fabio/tmp/sandbox/alignment'
31
32 run_dir = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data/run_1/'
33 data_dir = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data/run_1/'
34
35 #run_dir = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data/run_2/'
36 #data_dir = '/fml/ag-raetsch/home/fabio/tmp/transcriptome_data/run_2/'
37
38 chunks_fn = []
39 for fn in os.listdir(run_dir):
40 if fn.startswith('chunk'):
41 chunks_fn.append(fn)
42
43 #chunks_fn = [\
44 #'chunk_0.predictions.pickle',\
45 #'chunk_4.predictions.pickle']
46
47 print chunks_fn
48
49 functionJobs=[]
50
51 for chunk_fn in chunks_fn:
52 chunk_name = chunk_fn[:chunk_fn.find('.')]
53 result_fn = jp(data_dir,'%s.align_remap'%chunk_name)
54 chunk_fn = jp(run_dir,chunk_fn)
55
56 #pdb.set_trace()
57
58 current_job = KybJob(grid_alignment.g_alignment,[chunk_fn,result_fn])
59 current_job.h_vmem = '15.0G'
60 current_job.express = 'True'
61
62 print "job #1: ", current_job.nativeSpecification
63
64 functionJobs = [current_job]
65 #functionJobs.append(current_job)
66 (sid, jobids) = submit_jobs(functionJobs)
67 time.sleep(10)
68
69 #break
70
71 if __name__ == '__main__':
72 create_and_submit()