import os
import json

bed = os.listdir('.')

summary = []
for f in bed:
    if f.endswith('.sorted.gz'):
        each_dict = {}
        each_dict["type"] = "bed"
        each_dict["url"] = "http://regmedsrv1.wustl.edu/Public_SPACE/yuz/Public_html/hichip/tad_r2/"+f
        each_dict["name"] = f
        #each_dict["color"] = 'red'
        each_dict["options"] = {"color": 'green'}
        summary.append(each_dict)

summary = sorted(summary, key=lambda x: x['name'])
with open("tad_r2.json", "w") as write_file:
    json.dump(summary, write_file, indent=6) 


