def ParseTargets(targetfile):
    """ Return list of targets, each is dict with region and name """
    x = []

    with open(targetfile, "r") as f:
        for line in f:
            items = line.strip().split("\t")
            if len(items) != 4:
                message("invalid target file. should have 4 columns", "error")
            chrom, start, end, name = items
            region = "%s:%s"%(chrom, start)
            x.append({"name": name, "region": region, "coords": (chrom, int(start), int(end))})
        line = f.readline()

    with open(targetfile, "r") as f:
        line = f.readline()

    return x
dataset/ETHPy150Open mgymrek/pybamview/pybamview/utils.py/ParseTargets/original