给个例子:
from optparse import OptionParser
msg_usage = 'usage: %prog [-W] windows size [-H] h island size [-I] input your map file [-O] output file name'
descr = '''Correct SNPs used for constructing genetic map...
Why default h_size is 6?
Fistly, for example, aaaaaaaaaaaaaaaabbbbbbbbbbbbbb will generate 6 h.
secondly, for examplem aaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhaaaaaaaaaa will generate at least 7 when num
of h larger than 9, when num of h is 5-8, no h will be generated.
Caveat: default was setted 6 above when the window size is 15.
The question still not settled yet is what the size of h will be seted when windows size is
not 15...
'''
optparser = OptionParser(usage = msg_usage, description = descr)
optparser.add_option('-W', '--win_size', dest = 'winsize', default = 15,
help = 'The size of sliding window, default is 15.')
optparser.add_option('-H', '--h_island', dest = 'hisland', default = 6,
help = 'The length of h_island you need to split, default\
is 6')
optparser.add_option('-I', '--input', dest = 'inputfile',
help = 'Input your file need to tackle')
optparser.add_option('-O', '--output', dest = 'outputfile',
help = 'Your output file name')
options, args = optparser.parse_args()
if __name__ == "__main__":
W = int(options.winsize)
H = int(options.hisland)
I = options.inputfile
O = options.outputfile
main(I, W, H, O)
by freemao
FAFU
free_mao@qq.com