

def main():
    usage = 'usage: %prog [options]'
    description = 'Sort and format wiggle file.'
    optparser = OptionParser(version='%prog 0.1', description=description, usage=usage, add_help_option=False)
    optparser.add_option('-h', '--help', action='help', help='Show this help message and exit.')
    optparser.add_option('-i', '--input', dest='input', type='string', help='wiggle file for input')
    optparser.add_option('-o', '--output', dest='output', help='wiggle output file.')
    (options, args) = optparser.parse_args()
    if ((not options.input) or (not options.output)):
        optparser.print_help()
        sys.exit(1)
    info('#1 read wiggle track from first wiggle file')
    wiginput = WiggleIO.WiggleIO(options.input).build_wigtrack()
    info('#1 finish reading wiggle file')
    info('#2 sorting')
    wiginput.sort()
    info('#3 write wiggle file')
    ofhd = open(options.output, 'w')
    wiginput.write_wig(ofhd, name='reformatted wiggle file')
    info('#4 finished!')

dataset/ETHPy150Open taoliu/taolib/Scripts/wiggle_reformat.py main/original