view data_manager/extract.py @ 0:4e3bbaa0b70f draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_fetch_busco/ commit 32f1099f18b41bf1efd1a039daf732809c77269e
author iuc
date Tue, 22 Apr 2025 13:12:07 +0000
parents
children
line wrap: on
line source

import json
import os
import re
import sys

busco_db = os.path.join(sys.argv[1], "lineages")
busco_db_value = sys.argv[2]
dmjson = sys.argv[3]

content = []
for d in os.scandir(busco_db):
    if not d.is_dir():
        continue
    if not os.path.exists(os.path.join(d, "dataset.cfg")):
        continue
    name = re.sub(r"_odb\d+", "", d.name)
    name = name.replace("_", " ").capitalize()
    content.append({'value': d.name, 'name': name, 'db_value': busco_db_value})

with open(dmjson, "w") as fh:
    json.dump({"data_tables": {"busco_database_options": content}}, fh)

print(f'{len(content)} x busco_db\n')