Mercurial > repos > iuc > tb_profiler_collate
view replace_id_field_with_element_id.py @ 0:5b218b5eedb6 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/tb-profiler commit 7dba70c70c9fe33353a0fd21803b11cfddc42c32
| author | iuc |
|---|---|
| date | Tue, 21 Oct 2025 10:24:27 +0000 |
| parents | |
| children |
line wrap: on
line source
import json import os import re import sys input_file = sys.argv[1] output_file = sys.argv[2] safe_file_name = re.sub(r'[^\w\-_\.]', '_', os.path.basename(output_file)) if not safe_file_name.endswith(".results.json"): safe_file_name += ".results.json" file_id = os.path.splitext(safe_file_name)[0] with open(input_file, "r") as f: data = json.load(f) if data.get("id") == "tbprofiler": data["id"] = file_id with open(safe_file_name, "w") as f: json.dump(data, f, indent=4) print(f"Copied {input_file} -> {safe_file_name}, updated id = {file_id}")
