def remove_pipeline_copies(self): pipelines = self._config.get("Pipelines", {}).keys() pipelines_to_remove = [] pipeline_renamings = {} for index1, pipeline1 in enumerate(pipelines): if pipeline1 in pipelines_to_remove: continue for pipeline2 in pipelines[index1+1:]: if pipeline2 in pipelines_to_remove: continue difference = jsonTools.JsonDict.deepdiff(self._config["Pipelines"][pipeline1], self._config["Pipelines"][pipeline2]) if len(difference[0]) == 0 and len(difference[1]) == 0: pipelines_to_remove.append(pipeline2) new_name = tools.find_common_string(pipeline_renamings.get(pipeline1, pipeline1), pipeline_renamings.get(pipeline2, pipeline2)) pipeline_renamings[pipeline1] = new_name.strip("_").replace("__", "_") for pipeline in pipelines_to_remove: self._config["Pipelines"].pop(pipeline) for old_name, new_name in pipeline_renamings.iteritems(): self._config["Pipelines"][new_name] = self._config["Pipelines"].pop(old_name)
def remove_pipeline_copies(self): pipelines = self._config.get("Pipelines", {}).keys() pipelines_to_remove = [] pipeline_renamings = {} for index1, pipeline1 in enumerate(pipelines): if pipeline1 in pipelines_to_remove: continue for pipeline2 in pipelines[index1+1:]: if pipeline2 in pipelines_to_remove: continue difference = jsonTools.JsonDict.deepdiff(self._config["Pipelines"][pipeline1], self._config["Pipelines"][pipeline2]) if len(difference[0]) == 0 and len(difference[1]) == 0: pipelines_to_remove.append(pipeline2) new_name = tools.find_common_string(pipeline_renamings.get(pipeline1, pipeline1), pipeline_renamings.get(pipeline2, pipeline2)) # Needed for systematic shifts that are only applied to certain samples. # In that case we do not want an extra pipeline with the same configuration # as the nominal one. if "Down" not in new_name or "Up" not in new_name: new_name = new_name.replace(new_name.split("_")[-1], "") # Add "nominal" to pipelines without systematic shifts if new_name.endswith("_"): new_name += "nominal" elif "_" not in new_name: new_name += "_nominal" pipeline_renamings[pipeline1] = new_name.strip("_").replace("__", "_") for pipeline in pipelines_to_remove: self._config["Pipelines"].pop(pipeline) for old_name, new_name in pipeline_renamings.iteritems(): self._config["Pipelines"][new_name] = self._config["Pipelines"].pop(old_name)
def remove_pipeline_copies(self): pipelines = self._config.get("Pipelines", {}).keys() pipelines_to_remove = [] pipeline_renamings = {} for index1, pipeline1 in enumerate(pipelines): if pipeline1 in pipelines_to_remove: continue for pipeline2 in pipelines[index1+1:]: if pipeline2 in pipelines_to_remove: continue difference = jsonTools.JsonDict.deepdiff(self._config["Pipelines"][pipeline1], self._config["Pipelines"][pipeline2]) if len(difference[0]) == 0 and len(difference[1]) == 0: pipelines_to_remove.append(pipeline2) new_name = tools.find_common_string(pipeline_renamings.get(pipeline1, pipeline1), pipeline_renamings.get(pipeline2, pipeline2)) if new_name.endswith("_"): new_name += "nominal" elif "_" not in new_name: new_name += "_nominal" pipeline_renamings[pipeline1] = new_name.strip("_").replace("__", "_") for pipeline in pipelines_to_remove: self._config["Pipelines"].pop(pipeline) for old_name, new_name in pipeline_renamings.iteritems(): self._config["Pipelines"][new_name] = self._config["Pipelines"].pop(old_name)