import os
import json
import sys


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

summary = []

for each in file_list:
    each_name = each.split('_methy')[0]
    each_dict = {}
    each_dict["type"] = "methylc"
    each_dict["url"] = "https://regmedsrv1.wustl.edu/Public_SPACE/yuz/Public_html/tao/EMandE5hmC/"+ each
    each_dict["name"] = each_name
    each_dict["options"] = {"height": 30, "isCombineStrands": "true"}
    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) 
