def formatGenomicCoordinate(value, pos=None):

    decimals = 0
    exps = ['', 'k', 'm', 'g', 't']
    suffix = ""

    value = int(value)
    format = "%%.%if%%s%s" % (int(decimals), suffix)

    for exp in xrange(len(exps) - 1, -1, -1):

        if value < 1000L ** (exp):
            continue
        else:
            return format % (float(value) / 1000L ** (exp), exps[exp])
            break
    else:
        return str(value)
dataset/ETHPy150Open CGATOxford/cgat/scripts/gff2plot.py/formatGenomicCoordinate/original