6dc82f8c917ffb66f8386e233f588fecab528e8b
[qpalma.git] / scripts / qpalma_pipeline.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # Written (W) 2008 Fabio De Bona
10 # Copyright (C) 2008 Max-Planck-Society
11
12 #
13 # This file contains the main interface to the QPalma pipeline.
14 #
15 #
16 #
17
18 from optparse import OptionParser
19
20 from qpalma.gridtools import ApproximationTask,PreprocessingTask
21 from qpalma.gridtools import AlignmentTask,PostprocessingTask
22
23 def create_option_parser():
24 parser = OptionParser()
25
26 #
27 parser.add_option("-ci", "--check_and_init", help="check configuration and initialize directories")
28
29 #
30 parser.add_option("-r", "--run", help="write report to FILE", metavar="FILE")
31
32 #
33 parser.add_option("-xx", "--clear", action="store_false", dest="verbose", help="cleanup directories delete all created data")
34
35 return parser
36
37
38
39
40 class System:
41 """
42 This class wraps the outer loop of the qpalma project
43
44 It is responsible for:
45
46 - loading and checking the config file(s)
47 - setting up the different pipeline modules
48 - run the experiment and report the results
49
50 """
51
52 def __init__(self):
53 """
54 """
55 parser = create_option_parser()
56 (options, args) = parser.parse_args()
57
58
59 def run(self):
60
61 # Before creating a candidate spliced read dataset we have to first filter
62 # the matches from the first seed finding run.
63
64 grid_heuristic()
65
66 # approx_task = ApproximationTask(...)
67 # approx_task.createJobs()
68 # approx_task.submit()
69 # approx_task.checkIfTaskFinished()
70
71 # After filtering combine the filtered matches from the first run and the
72 # found matches from the second run to a full dataset
73
74 createNewDataset
75
76 # pre_task = PreprocessingTask(...)
77 # pre_task.createJobs()
78 # pre_task.submit()
79
80 # Now that we have a dataset we can perform the accurate alignments for this
81 # data
82
83 grid_predict()
84
85 # align_task = AlignmentTask(...)
86 # align_task.createJobs()
87 # align_task.submit()
88
89 # The results of the above alignment step can be converted to a data format
90 # needed for further postprocessing
91
92 grid_alignment()
93
94 # post_task = PostprocessingTask(...)
95 # post_task.createJobs()
96 # post_task.submit()
97
98
99 if __name__ == '__main__':
100 system_obj = System()
101 system_obj.run()