def read_domains_from_bedfile(bedfile):
    """Read domains from bed with three first columns "chr start end" file
    and return as a list [[chr, start1, end1], ...]"""
    with open(bedfile) as bed:
        line = bed.readline()
        domains = []
        while line:
            lline = line.strip().split()
            domains.append((lline[0], int(lline[1]), int(lline[2])))
            line = bed.readline()
    return domains