当前位置: 首页>>代码示例>>Python>>正文


Python GooeyParser.add_subparsers方法代码示例

本文整理汇总了Python中gooey.GooeyParser.add_subparsers方法的典型用法代码示例。如果您正苦于以下问题:Python GooeyParser.add_subparsers方法的具体用法?Python GooeyParser.add_subparsers怎么用?Python GooeyParser.add_subparsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gooey.GooeyParser的用法示例。


在下文中一共展示了GooeyParser.add_subparsers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_subparsers [as 别名]
def main():

    parser = GooeyParser(
        prog='', 
        description="Detecting rare cell-types from single-cell "
            "gene expression data", 
        epilog="Contributors: Lan Jiang, "
            "Qian Zhu and Gregory Giecold.\nFor further help or information, "
            "please contact us at [email protected],"
            "[email protected] or [email protected]")
                    
    subparsers = parser.add_subparsers(dest='datatype', 
        help="Type of your input genomics dataset")
    
    qPCR_parser = subparsers.add_parser('qpcr')
    qPCR_parser.add_argument('Input', type=str, widget='FileChooser',
        help='Select a file to process:')
    qPCR_parser.add_argument('-e', '--epsilon', nargs='?',
        type=float, const=0.25, default=0.25, 
        help='DBSCAN epsilon parameter:')
    qPCR_parser.add_argument('-m', '--minPts', nargs='?',
        type=int, const=5, default=5,
        help='DBSCAN minPts parameter:')
    qPCR_parser.add_argument('-O', '--Output', nargs='?', type=str,
        default=path.join(getcwd(), 'GiniClust_results'),
        help="Specify GiniClust's output directory:")
    
    RNASeq_parser = subparsers.add_parser('rna')
    RNASeq_parser.add_argument('Input', type=str, widget='FileChooser',
        help='Select a file to process:')
    RNASeq_parser.add_argument('-e', '--epsilon', nargs='?',
        type=float, const=0.5, default=0.5, 
        help='DBSCAN epsilon parameter:')
    RNASeq_parser.add_argument('-m', '--minPts', nargs='?',
        type=int, const=3, default=3,
        help='DBSCAN minPts parameter:')
    RNASeq_parser.add_argument('-O', '--Output', nargs='?', type=str,
        default=path.join(getcwd(), 'GiniClust_results'),
        help="Specify GiniClust's output directory:")
    
    command = 'Rscript'
    path2Rscript = path.join(getcwd(), 'GiniClust_Main.R')

    args = parser.parse_args()
    
    if args.datatype == 'qpcr':
        datatype_str = 'qPCR'
    else:
        datatype_str = 'RNA-seq'
        
    cmd = [command, path2Rscript]
    cmd += ['-f', args.Input, '-t', datatype_str, '-o', args.Output, '-e', str(args.epsilon), '-m', str(args.minPts)]
    subprocess.check_output(cmd, universal_newlines=True)
开发者ID:lanjiangboston,项目名称:GiniClust,代码行数:55,代码来源:GiniClust.py

示例2: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_subparsers [as 别名]
def main():
    settings_msg = 'Subparser example demonstating bundled configurations ' \
                   'for Siege, Curl, and FFMPEG'
    parser = GooeyParser(description=settings_msg)
    parser.add_argument('--verbose', help='be verbose', dest='verbose',
                        action='store_true', default=False)
    subs = parser.add_subparsers(help='commands', dest='command')

    curl_parser = subs.add_parser(
        'curl', help='curl is a tool to transfer data from or to a server')
    curl_parser.add_argument('Path',
                             help='URL to the remote server',
                             type=str, widget='FileChooser')
    curl_parser.add_argument('--connect-timeout',
                             help='Maximum time in seconds that you allow curl\'s connection to take')
    curl_parser.add_argument('--user-agent',
                             help='Specify the User-Agent string ')
    curl_parser.add_argument('--cookie',
                             help='Pass the data to the HTTP server as a cookie')
    curl_parser.add_argument('--dump-header', type=argparse.FileType,
                             help='Write the protocol headers to the specified file')
    curl_parser.add_argument('--progress-bar', action="store_true",
                             help='Make curl display progress as a simple progress bar')
    curl_parser.add_argument('--http2', action="store_true",
                             help='Tells curl to issue its requests using HTTP 2')
    curl_parser.add_argument('--ipv4', action="store_true",
                             help=' resolve names to IPv4 addresses only')

    # ########################################################
    siege_parser = subs.add_parser(
        'siege', help='Siege is an http/https regression testing and benchmarking utility')
    siege_parser.add_argument('--get',
                              help='Pull down headers from the server and display HTTP transaction',
                              type=str)
    siege_parser.add_argument('--concurrent',
                              help='Stress the web server with NUM number of simulated users',
                              type=int)
    siege_parser.add_argument('--time',
                              help='allows you to run the test for a selected period of time',
                              type=int)
    siege_parser.add_argument('--delay',
                              help='simulated user is delayed for a random number of seconds between one and NUM',
                              type=int)
    siege_parser.add_argument('--message',
                              help='mark the log file with a separator',
                              type=int)

    # ########################################################
    ffmpeg_parser = subs.add_parser(
        'ffmpeg', help='A complete, cross-platform solution to record, convert and stream audio and video')
    ffmpeg_parser.add_argument('Output',
                               help='Pull down headers from the server and display HTTP transaction',
                               widget='FileSaver', type=argparse.FileType)
    ffmpeg_parser.add_argument('--bitrate',
                               help='set the video bitrate in kbit/s (default = 200 kb/s)',
                               type=str)
    ffmpeg_parser.add_argument('--fps',
                               help='set frame rate (default = 25)',
                               type=str)
    ffmpeg_parser.add_argument('--size',
                               help='set frame size. The format is WxH (default 160x128)',
                               type=str)
    ffmpeg_parser.add_argument('--aspect',
                               help='set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)',
                               type=str)
    ffmpeg_parser.add_argument('--tolerance',
                               help='set video bitrate tolerance (in kbit/s)',
                               type=str)
    ffmpeg_parser.add_argument('--maxrate',
                               help='set min video bitrate tolerance (in kbit/s)',
                               type=str)
    ffmpeg_parser.add_argument('--bufsize',
                               help='set ratecontrol buffere size (in kbit)',
                               type=str)

    parser.parse_args()

    display_message()
开发者ID:chriskiehl,项目名称:GooeyExamples,代码行数:80,代码来源:subparser_demo.py

示例3: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_subparsers [as 别名]
def main():
  description_msg = 'Initiate batch downloads GPS collar data' \
                    ' for commonly used collar websites'
  
  parser = GooeyParser(description=description_msg)
#  parser.add_argument('--verbose', help='output detailed text describing operation while executing',
#                      action='store_true', default=False)
  subs = parser.add_subparsers(help='commands', dest='command')
  


  tellus_parser = subs.add_parser('tellus', help='http://tellus.televilt.se')
  vectronic_parser = subs.add_parser('vectronic',help='http://www.vectronic-wildlife.com')
  sirtrack_parser = subs.add_parser('sirtrack',help='https://data.sirtrack.com')
  
  #### Sirtrack     #####
#Usage: sirtrack.rb [options]
#    -u, --username user              Username
#    -p, --password password          Password
#    -d, --dir dir                    Directory
#    -h, --help                       Displays Help
#    -v, --[no-]verbose               Run verbosely
#    -x, --csv [CSV_FILENAME]         Translate to single CSV/TXT
#                                      (using filename if supplied)
#    -z, --debug                      Run in debug mode


  sirtrack_parser.add_argument('username', type=str,
                               help='User name for your account', 
                               default='[email protected]')
  sirtrack_parser.add_argument('password', type=str,
                               help='Password for your account (not secure)')
  sirtrack_parser.add_argument('-d', '--dir', type=str,
                               help='Directory in which to download data files',
                               default='data')
#  sirtrack_parser.add_argument('-b', '--begin', type=str, widget='DateChooser',
#                                help='beginning date to retrieve data from')          
#  sirtrack_parser.add_argument('-e', '--end', type=str, widget='DateChooser',
#                                help='ending date to retrieve data from')                            
  # sirtrack_parser.add_argument('-h', '--help', dest='help', action="store_true",
  #                               help='Display help with command options')
  sirtrack_filename = 'sirtrack' + time.strftime("%Y%m%d") + '.txt' 
#  sirtrack_parser.add_argument('-x', '--csv', type=str, 
#                               help='Translate to a single CSV/TXT file',
#                               default=sirtrack_filename)
  sirtrack_parser.add_argument('-v', '--verbose', action='store_true',
                                help='output details of downloading process', default=True) 
                            
  #### Vectronic   #### 
  # Usage: vectronic.rb [options]
    # -u, --username user              Username
    # -D, --database [database]        db name
    # -p, --password password          Password
    # -d, --dir dir                    Directory
    # -h, --help                       Displays Help
    # -b, --begin [date]               Beginning date to retrieve data
    # -e, --end [date]                 Ending date to retrieve data
    # -v, --[no-]verbose               Run verbosely
    # -x, --csv [CSV_FILENAME]         Translate to CSV/TXT
                            
  vectronic_parser.add_argument('username', type=str,
                               help='User name for your account', default='snbs')
  vectronic_parser.add_argument('password', type=str,
                               help='Password for your account (not secure)')
  vectronic_parser.add_argument('database', type=str,
                                help='database name',default='sierrabighorn')
  vectronic_parser.add_argument('-d', '--dir', type=str, widget="DirChooser",
                               help='Directory in which to download data files', default='data')
  vectronic_parser.add_argument('-b', '--begin', type=str, widget='DateChooser',
                                help='beginning date to retrieve data from')          
  vectronic_parser.add_argument('-e', '--end', type=str, widget='DateChooser',
                                help='ending date to retrieve data from')                                       
  vectronic_filename = 'vectronic_' + time.strftime("%Y%m%d") + '.txt'                            
  vectronic_parser.add_argument('-x', '--csv', type=str, help='Translate to a single CSV/TXT file. Enter name of file.',
                               default=vectronic_filename)                            
                                
  vectronic_parser.add_argument('-v', '--verbose', action='store_true',
                                help='output details of downloading process', default=True)                             
                               
  
  #### Vectronic    #####
  
  #### Tellus       #####
#  Usage: tellus.rb [options]
#    -u, --username user              Username
#    -p, --password password          Password
#    -d, --dir dir                    Directory
#    -h, --help                       Displays Help
#    -b, --begin [date]               Beginning date to retrieve data
#    -e, --end [date]                 Ending date to retrieve data
#    -v, --[no-]verbose               Run verbosely
#    -x, --csv [CSV_FILENAME]         Translate to single CSV/TXT
#                                      (using filename if supplied)
#    -z, --debug                      Run in debug mode
  tellus_parser.add_argument('username', type=str,
                               help='User name for your account', default='[email protected]')
  tellus_parser.add_argument('password', type=str,
                               help='Password for your account (not secure)')
  tellus_parser.add_argument('-d', '--dir', type=str, widget="DirChooser",
                               help='Directory in which to download data files', default='data')
#.........这里部分代码省略.........
开发者ID:rgzn,项目名称:collar-dl,代码行数:103,代码来源:collar-dl.py

示例4: main

# 需要导入模块: from gooey import GooeyParser [as 别名]
# 或者: from gooey.GooeyParser import add_subparsers [as 别名]
def main():
    parser = GooeyParser()
    subs = parser.add_subparsers(help='commands', dest='command')

    parser_one = subs.add_parser('parser1', prog="Parser 1")
    parser_one.add_argument('--textfield', default=2, widget="TextField")
    parser_one.add_argument('--textarea', default="oneline twoline", widget='Textarea')
    parser_one.add_argument('--password', default="hunter42", widget='PasswordField')
    parser_one.add_argument('--commandfield', default="cmdr", widget='CommandField')
    parser_one.add_argument('--dropdown',
                        choices=["one", "two"], default="two", widget='Dropdown')
    parser_one.add_argument('--listboxie',
                        nargs='+',
                        default=['Option three', 'Option four'],
                        choices=['Option one', 'Option two', 'Option three',
                                 'Option four'],
                        widget='Listbox',
                        gooey_options={
                            'height': 300,
                            'validate': '',
                            'heading_color': '',
                            'text_color': '',
                            'hide_heading': True,
                            'hide_text': True,
                        }
                        )
    parser_one.add_argument('-c', '--counter', default=3, action='count',
                        widget='Counter')
    #
    parser_one.add_argument("-o", "--overwrite", action="store_true",
                        default=True,
                        widget='CheckBox')

    ### Mutex Group ###
    verbosity = parser_one.add_mutually_exclusive_group(
        required=True,
        gooey_options={
            'initial_selection': 1
        }
    )
    verbosity.add_argument(
        '--mutexone',
        default=True,
        action='store_true',
        help="Show more details")

    verbosity.add_argument(
        '--mutextwo',
        default='mut-2',
        widget='TextField')

    parser_one.add_argument("--filechooser", default="fc-value", widget='FileChooser')
    parser_one.add_argument("--filesaver", default="fs-value", widget='FileSaver')
    parser_one.add_argument("--dirchooser", default="dc-value", widget='DirChooser')
    parser_one.add_argument("--datechooser", default="2015-01-01", widget='DateChooser')

    parser_two = subs.add_parser('parser2', prog="parser 2")
    parser_two.add_argument('--textfield', default=2, widget="TextField")
    parser_two.add_argument('--textarea', default="oneline twoline",
                            widget='Textarea')
    parser_two.add_argument('--password', default="hunter42", widget='PasswordField')
    parser_two.add_argument('--commandfield', default="cmdr", widget='CommandField')
    parser_two.add_argument('--dropdown',
                            choices=["one", "two"], default="two", widget='Dropdown')
    parser_two.add_argument('--listboxie',
                            nargs='+',
                            default=['Option three', 'Option four'],
                            choices=['Option one', 'Option two', 'Option three',
                                     'Option four'],
                            widget='Listbox',
                            gooey_options={
                                'height': 300,
                                'validate': '',
                                'heading_color': '',
                                'text_color': '',
                                'hide_heading': True,
                                'hide_text': True,
                            }
                            )
    parser_two.add_argument('-c', '--counter', default=3, action='count',
                            widget='Counter')
    #
    parser_two.add_argument("-o", "--overwrite", action="store_true",
                            default=True,
                            widget='CheckBox')

    ### Mutex Group ###
    verbosity = parser_two.add_mutually_exclusive_group(
        required=True,
        gooey_options={
            'initial_selection': 1
        }
    )
    verbosity.add_argument(
        '--mutexone',
        default=True,
        action='store_true',
        help="Show more details")

    verbosity.add_argument(
#.........这里部分代码省略.........
开发者ID:arunkgupta,项目名称:Gooey,代码行数:103,代码来源:all_widgets_subparser.py


注:本文中的gooey.GooeyParser.add_subparsers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。