def read_bed(bed):
    """Read bed file."""
    bed_data = {}
    f = open(bed, "r")
    for line in f:
        bed_info = line[:-1].split("\t")
        chrom = bed_info[0]
        chromStart = int(bed_info[1])
        chromEnd = int(bed_info[2])
        name = bed_info[3]
        blockSizes = [int(x) for x in bed_info[10].split(',') if x != '']
        bed_data[name] = (chrom, chromStart, chromEnd, blockSizes)
    f.close()
    return bed_data