import os
import json
import sys


file_list = sorted([each for each in os.listdir('.') if each.endswith("bg.gz")])

summary = []

for each in file_list:
    each_name = each.split('Star_')[1].split('.')[0]
    each_dict = {}
    each_dict["type"] = "bedgraph"
    each_dict["url"] = "https://regmedsrv1.wustl.edu/Public_SPACE/yuz/Public_html/tao/rnaseq_tao/all_batches/"+ each
    each_dict["name"] = each_name
    each_dict["options"] = {"color": "blue","background": "#C0E3CC"}
    summary.append(each_dict)
    
summary = sorted(summary, key=lambda x: x['name'])
with open("format1.json", "w") as write_file:
    json.dump(summary, write_file, indent=6) 

