def iterateMacs2Peaks(infile):
    '''iterate over peaks.xls file and return parsed data.

    pvalues and fdr are converted to values between 0 and 1
    from their -log10 values.
    '''

    for row in CSV.DictReader(infile, dialect='excel-tab'):
        # these are 1-based coordinates
        # macs can have negative start coordinates
        # start
        try:
            yield Macs2Peak._make(
                (row['chr'],
                 max(int(row['start']) - 1, 0),
                 int(row['end']),
                 int(row['length']),
                 float(row['pileup']),
                 math.pow(10, -float(row['-log10(pvalue)'])),
                 float(row['fold_enrichment']),
                 math.pow(10, -float(row['-log10(qvalue)'])),
                 row['name']))
        except __HOLE__, msg:
            raise KeyError("%s: %s" % (msg, row))
dataset/ETHPy150Open CGATOxford/cgat/CGAT/WrapperMACS.py/iterateMacs2Peaks