Mercurial > repos > greg > queue_genotype_workflow
comparison queue_genotype_workflow.py @ 4:163ecfba5961 draft
Uploaded
author | greg |
---|---|
date | Tue, 19 Nov 2019 09:34:57 -0500 |
parents | d00c4cc7e8c2 |
children | b7212fe2d597 |
comparison
equal
deleted
inserted
replaced
3:36f8098ff528 | 4:163ecfba5961 |
---|---|
105 def get_history_dataset_id_by_name(gi, history_id, dataset_name, outputfh): | 105 def get_history_dataset_id_by_name(gi, history_id, dataset_name, outputfh): |
106 # Use the Galaxy API to get the bcftools merge dataset id | 106 # Use the Galaxy API to get the bcftools merge dataset id |
107 # from the current history. | 107 # from the current history. |
108 outputfh.write("\nSearching for history dataset named %s.\n" % str(dataset_name)) | 108 outputfh.write("\nSearching for history dataset named %s.\n" % str(dataset_name)) |
109 history_dataset_dicts = get_history_datasets(gi, history_id) | 109 history_dataset_dicts = get_history_datasets(gi, history_id) |
110 for name, hd_dict in history_dataset_dicts.items(): | 110 for name, hd_dict in list(history_dataset_dicts.items()): |
111 name = name.lower() | 111 name = name.lower() |
112 if name.startswith(dataset_name.lower()): | 112 if name.startswith(dataset_name.lower()): |
113 outputfh.write("Found dataset named %s.\n" % str(dataset_name)) | 113 outputfh.write("Found dataset named %s.\n" % str(dataset_name)) |
114 return hd_dict['id'] | 114 return hd_dict['id'] |
115 return None | 115 return None |
169 # Map the history datasets to the input datasets for the workflow. | 169 # Map the history datasets to the input datasets for the workflow. |
170 workflow_inputs = {} | 170 workflow_inputs = {} |
171 outputfh.write("\nMapping datasets from history to workflow %s.\n" % workflow_name) | 171 outputfh.write("\nMapping datasets from history to workflow %s.\n" % workflow_name) |
172 steps_dict = workflow_dict.get('steps', None) | 172 steps_dict = workflow_dict.get('steps', None) |
173 if steps_dict is not None: | 173 if steps_dict is not None: |
174 for step_index, step_dict in steps_dict.items(): | 174 for step_index, step_dict in list(steps_dict.items()): |
175 # Dicts that define dataset inputs for a workflow | 175 # Dicts that define dataset inputs for a workflow |
176 # look like this. | 176 # look like this. |
177 # "0": { | 177 # "0": { |
178 # "tool_id": null, | 178 # "tool_id": null, |
179 # "tool_version": null, | 179 # "tool_version": null, |
209 annotation = step_dict.get('annotation', None) | 209 annotation = step_dict.get('annotation', None) |
210 if tool_id is None and tool_type == 'data_input' and annotation is not None: | 210 if tool_id is None and tool_type == 'data_input' and annotation is not None: |
211 annotation_check = annotation.lower() | 211 annotation_check = annotation.lower() |
212 # inputs is a list and workflow input datasets | 212 # inputs is a list and workflow input datasets |
213 # have no inputs. | 213 # have no inputs. |
214 for input_hda_name, input_hda_dict in history_datasets.items(): | 214 for input_hda_name, input_hda_dict in list(history_datasets.items()): |
215 input_hda_name_check = input_hda_name.lower() | 215 input_hda_name_check = input_hda_name.lower() |
216 if input_hda_name_check.find(annotation_check) >= 0: | 216 if input_hda_name_check.find(annotation_check) >= 0: |
217 workflow_inputs[step_index] = {'src': 'hda', 'id': input_hda_dict['id']} | 217 workflow_inputs[step_index] = {'src': 'hda', 'id': input_hda_dict['id']} |
218 outputfh.write(" - Mapped dataset %s from history to workflow input dataset with annotation %s.\n" % (input_hda_name, annotation)) | 218 outputfh.write(" - Mapped dataset %s from history to workflow input dataset with annotation %s.\n" % (input_hda_name, annotation)) |
219 break | 219 break |
236 def update_workflow_params(workflow_dict, dbkey, outputfh): | 236 def update_workflow_params(workflow_dict, dbkey, outputfh): |
237 parameter_updates = None | 237 parameter_updates = None |
238 name = workflow_dict['name'] | 238 name = workflow_dict['name'] |
239 outputfh.write("\nChecking for tool parameter updates for workflow %s using dbkey %s.\n" % (name, dbkey)) | 239 outputfh.write("\nChecking for tool parameter updates for workflow %s using dbkey %s.\n" % (name, dbkey)) |
240 step_dicts = workflow_dict.get('steps', None) | 240 step_dicts = workflow_dict.get('steps', None) |
241 for step_id, step_dict in step_dicts.items(): | 241 for step_id, step_dict in list(step_dicts.items()): |
242 tool_id = step_dict['tool_id'] | 242 tool_id = step_dict['tool_id'] |
243 if tool_id is None: | 243 if tool_id is None: |
244 continue | 244 continue |
245 # Handle reference_source entries | 245 # Handle reference_source entries |
246 if tool_id.find('affy2vcf') > 0: | 246 if tool_id.find('affy2vcf') > 0: |