给个例子:

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

OptionParser的更多相关文章

  1. Python中optionParser模块的使用方法[转]

    本文以实例形式较为详尽的讲述了Python中optionParser模块的使用方法,对于深入学习Python有很好的借鉴价值.分享给大家供大家参考之用.具体分析如下: 一般来说,Python中有两个内 ...

  2. Python OptionParser学习

    from optparse import OptionParser import sys def main(): p = OptionParser() p.add_option('-n','--nam ...

  3. 转-Python optionParser模块的使用方法

    Python  有两个内建的模块用于处理命令行参数: 一个是  getopt,<Deep in python>一书中也有提到,只能简单处理 命令行参数: 另一个是  optparse,它功 ...

  4. Python的参数模块OptionParser说明

    可以替代getopt的一个模块 from optparse import OptionParser #  生成一个实例 parser = OptionParser(usage="%prog ...

  5. python基础之 optparse.OptionParser

    optparse是专门用来在命令行添加选项的一个模块. 首先来看一段示例代码 from optparse import OptionParser MSG_USAGE = "myprog[ - ...

  6. python OptionParser模块

    Python中强大的选项处理模块. #!/usr/bin/python from optparse import OptionParser parser = OptionParser() parser ...

  7. python中的optionParser模块

    Python 有两个内建的模块用于处理命令行参数:一个是 getopt,<Deep in python>一书中也有提到,只能简单处理 命令行参数:另一个是 optparse,它功能强大,而 ...

  8. OptionParser命令参数介绍及使用

    使用optionParse解析命令行参数分以下几个步骤: 创建parser实例 使用add_option添加我们要处理的命令行参数 得到解析sys.argv后的options对象,查看用户的输入 代码 ...

  9. Python模块: 命令行解析optionparser

    Python 有两个内建的模块用于处理命令行参数:一个是 getopt,<Deep in python>一书中也有提到,只能简单处理 命令行参数:另一个是 optparse,它功能强大,而 ...

随机推荐

  1. POJ 3249 拓扑排序+DP

    貌似是道水题.TLE了几次.把所有的输入输出改成scanf 和 printf ,有吧队列改成了数组模拟.然后就AC 了.2333333.... Description: MR.DOG 在找工作的过程中 ...

  2. 创建论坛Discuz

    下载discuz! mkdir /data/wwwcd /data/wwwwget  http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GB ...

  3. 关于Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)的问题

    找不到mysql socket的问题,我最近碰到了好多次重装系统以前,我的mysql,apache,php都是自己编译安装的,当时并没有碰到这些问题,重装系统以后,我的mysql是通过yum安装的,a ...

  4. Jquery.Page.js 分页插件的使用

    1.简单直接贴代码 需要引用以下样式和脚本 <link href="~/Scripts/Page/pager.css" rel="stylesheet" ...

  5. 基于SOCK4网络协议的代理服务器端代码示例

    //********************************************************************** #include <stdio.h> #i ...

  6. Android再次激活Activity时触发事件用于列表重新读取载入

    @Override protected void onResume(){ super.onResume(); getList(); } 重载 onResume() 方法

  7. 在T-SQL中访问远程数据库(openrowset、opendatasource、openquery)

    1.  启用Ad Hoc Distributed Queries 在使用openrowset/opendatasource前要先启用Ad Hoc Distributed Queries服务,因为这个服 ...

  8. Windows Server 2012 R2 设置

    一.任务栏左下角启动服务器管理器,然后进行设置.1.登录不显示服务器管理器 2.本地服务器,看到右边的IE增强的安全配置,如图所示,关闭两项内容.这样就关闭了IE增强安全提示框. 3.“工具”菜单,启 ...

  9. C++11的new concepts (move semantic)

    MoveConstructible 和MoveAssignable MoveConstructible Specifies that an instance of the type can be mo ...

  10. rcc

    一.在STM32中,有五个时钟源,为HSI.HSE.LSI.LSE.PLL.   全名: high  speed  external ①HSI是高速内部时钟,RC振荡器,频率为8MHz. ②HSE是高 ...