|
1 | 1 | from .Protocol import TellSeq |
2 | | -from os.path import join, abspath, exists |
3 | | -from os import walk |
| 2 | +from os.path import join, exists |
4 | 3 | from sequence_processing_pipeline.Pipeline import Pipeline, InstrumentUtils |
5 | 4 | from .Assays import Metagenomic |
6 | 5 | from .Assays import ASSAY_NAME_METAGENOMIC |
7 | 6 | from .Workflows import Workflow |
8 | 7 | from .FailedSamplesRecord import FailedSamplesRecord |
9 | | -from collections import defaultdict |
10 | 8 |
|
11 | 9 |
|
12 | 10 | class TellSeqMetagenomicWorkflow(Workflow, Metagenomic, TellSeq): |
@@ -77,107 +75,3 @@ def determine_steps_to_skip(self): |
77 | 75 | msg = "%s doesn't have job completed" % join(out_dir, |
78 | 76 | directory) |
79 | 77 | raise ValueError(msg) |
80 | | - |
81 | | - def execute_pipeline(self): |
82 | | - ''' |
83 | | - Executes steps of pipeline in proper sequence. |
84 | | - :return: None |
85 | | - ''' |
86 | | - |
87 | | - # perform some (re)initialization steps on (re)startup. |
88 | | - self.pre_check() |
89 | | - |
90 | | - # this is performed even in the event of a restart. |
91 | | - self.generate_special_map() |
92 | | - |
93 | | - # even if a job is being skipped, it's being skipped because it was |
94 | | - # determined that it already completed successfully. Hence, |
95 | | - # increment the status because we are still iterating through them. |
96 | | - |
97 | | - self.update_status("Converting data", 1, 9) |
98 | | - |
99 | | - # convert_raw_to_fastq() now performs its own checking of skip_steps. |
100 | | - # convert_raw_to_fastq() now performs its own write to fsr reports. |
101 | | - # This means fsr reports will be accurate even on restarts. |
102 | | - self.convert_raw_to_fastq() |
103 | | - |
104 | | - self.integrate_results() |
105 | | - |
106 | | - self.generate_sequence_counts() |
107 | | - |
108 | | - self.update_status("Performing quality control", 2, 9) |
109 | | - self.quality_control() |
110 | | - |
111 | | - self.update_status("Generating reports", 3, 9) |
112 | | - self.generate_reports() |
113 | | - |
114 | | - self.update_status("Generating preps", 4, 9) |
115 | | - self.generate_prep_file() |
116 | | - |
117 | | - # moved final component of genprepfilejob outside of object. |
118 | | - # obtain the paths to the prep-files generated by GenPrepFileJob |
119 | | - # w/out having to recover full state. |
120 | | - tmp = join(self.pipeline.output_path, 'GenPrepFileJob', 'PrepFiles') |
121 | | - |
122 | | - self.has_replicates = False |
123 | | - |
124 | | - prep_paths = [] |
125 | | - self.prep_file_paths = defaultdict(list) |
126 | | - |
127 | | - for root, dirs, files in walk(tmp): |
128 | | - for _file in files: |
129 | | - # breakup the prep-info-file into segments |
130 | | - # (run-id, project_qid, other) and cleave |
131 | | - # the qiita-id from the project_name. |
132 | | - qid = _file.split('.')[1].split('_')[-1] |
133 | | - |
134 | | - if _file.endswith('.tsv'): |
135 | | - _path = abspath(join(root, _file)) |
136 | | - prep_paths.append(_path) |
137 | | - self.prep_file_paths[qid].append(_path) |
138 | | - |
139 | | - for _dir in dirs: |
140 | | - if _dir == '1': |
141 | | - # if PrepFiles contains the '1' directory, then it's a |
142 | | - # given that this sample-sheet contains replicates. |
143 | | - self.has_replicates = True |
144 | | - |
145 | | - # currently imported from Assay although it is a base method. it |
146 | | - # could be imported into Workflows potentially, since it is a post- |
147 | | - # processing step. All pairings of assay and instrument type need to |
148 | | - # generate prep-info files in the same format. |
149 | | - self.overwrite_prep_files(prep_paths) |
150 | | - |
151 | | - # for now, simply re-run any line below as if it was a new job, even |
152 | | - # for a restart. functionality is idempotent, except for the |
153 | | - # registration of new preps in Qiita. These will simply be removed |
154 | | - # manually. |
155 | | - |
156 | | - # post-processing steps are by default associated with the Workflow |
157 | | - # class, since they deal with fastq files and Qiita, and don't depend |
158 | | - # on assay or instrument type. |
159 | | - self.update_status("Generating sample information", 5, 9) |
160 | | - self.sifs = self.generate_sifs() |
161 | | - |
162 | | - # post-processing step. |
163 | | - self.update_status("Registering blanks in Qiita", 6, 9) |
164 | | - if self.update: |
165 | | - self.update_blanks_in_qiita() |
166 | | - |
167 | | - self.update_status("Loading preps into Qiita", 7, 9) |
168 | | - if self.update: |
169 | | - self.update_prep_templates() |
170 | | - |
171 | | - # before we load preps into Qiita we need to copy the fastq |
172 | | - # files n times for n preps and correct the file-paths each |
173 | | - # prep is pointing to. |
174 | | - self.load_preps_into_qiita() |
175 | | - |
176 | | - self.fsr.generate_report() |
177 | | - |
178 | | - self.update_status("Generating packaging commands", 8, 9) |
179 | | - self.generate_commands() |
180 | | - |
181 | | - self.update_status("Packaging results", 9, 9) |
182 | | - if self.update: |
183 | | - self.execute_commands() |
0 commit comments