%prog cyntenator athaliana.athaliana.last athaliana.bed

    Prepare input for Cyntenator.
516396
def cyntenator(args):
    
    p = OptionParser(cyntenator.__doc__)
    opts, args = p.parse_args(args)

    if len(args) < 2:
        sys.exit(not p.print_help())

    lastfile = args[0]
    fp = open(lastfile)
    filteredlastfile = lastfile + ".blast"
    fw = open(filteredlastfile, "w")
    for row in fp:
        b = BlastLine(row)
        if b.query == b.subject:
            continue
        print("\t".join((b.query, b.subject, str(b.score))), file=fw)
    fw.close()

    bedfiles = args[1:]
    fp = open(lastfile)
    b = BlastLine(next(fp))
    subject = b.subject
    txtfiles = []
    for bedfile in bedfiles:
        order = Bed(bedfile).order
        if subject in order:
            db = op.basename(bedfile).split(".")[0][:20]
            logging.debug("Found db: {0}".format(db))
        txtfile = write_txt(bedfile)
        txtfiles.append(txtfile)

    db += ".txt"
    mm = MakeManager()
    for txtfile in txtfiles:
        outfile = txtfile + ".alignment"
        cmd = 'cyntenator -t "({0} {1})" -h blast {2} > {3}'\
                .format(txtfile, db, filteredlastfile, outfile)
        mm.add((txtfile, db, filteredlastfile), outfile, cmd)
    mm.write()
931001
def main(args, stop=False):
    
    daemon = AMQPDaemon(
        con_param=getConParams(
            settings.RABBITMQ_FTP_VIRTUALHOST
        ),
        queue=settings.RABBITMQ_FTP_INPUT_QUEUE,
        out_exch=settings.RABBITMQ_FTP_EXCHANGE,
        out_key=settings.RABBITMQ_FTP_OUTPUT_KEY,
        react_fn=reactToAMQPMessage,
        glob=globals()                # used in deserializer
    )

    if not stop and args.foreground:  # run at foreground
        daemon.run()
    else:
        daemon.run_daemon()
1060136
def main(argv=None):
    
    # Prepare arguments
    parser = argparse.ArgumentParser(
        prog="pelix.shell.xmpp",
        parents=[make_common_parser()],
        description="Pelix XMPP Shell",
    )

    group = parser.add_argument_group("XMPP options")
    group.add_argument("-j", "--jid", dest="jid", help="Jabber ID")
    group.add_argument("--password", dest="password", help="JID password")
    group.add_argument("-s", "--server", dest="server", help="XMPP server host")
    group.add_argument(
        "-p",
        "--port",
        dest="port",
        type=int,
        default=5222,
        help="XMPP server port",
    )
    group.add_argument(
        "--tls",
        dest="use_tls",
        action="store_true",
        help="Use a STARTTLS connection",
    )
    group.add_argument(
        "--ssl",
        dest="use_ssl",
        action="store_true",
        help="Use an SSL connection",
    )

    # Parse them
    args = parser.parse_args(argv)

    # Handle common arguments
    init = handle_common_arguments(args)

    # Quiet down the SleekXMPP logger
    if not args.verbose:
        logging.getLogger("sleekxmpp").setLevel(logging.WARNING)

    if not args.server and not args.jid:
        _logger.error("No JID nor server given. Abandon.")
        sys.exit(1)

    # Get the password if necessary
    password = args.password
    if args.jid and args.password is None:
        try:
            import getpass
        except ImportError:
            _logger.error(
                "getpass() unavailable: give a password in command line"
            )
        else:
            try:
                password = getpass.getpass()
            except getpass.GetPassWarning:
                pass

    # Get the server from the JID, if necessary
    server = args.server
    if not server:
        server = sleekxmpp.JID(args.jid).domain

    # Set the initial bundles
    bundles = [
        "pelix.ipopo.core",
        "pelix.shell.core",
        "pelix.shell.ipopo",
        "pelix.shell.console",
        "pelix.shell.xmpp",
    ]
    bundles.extend(init.bundles)

    # Use the utility method to create, run and delete the framework
    framework = pelix.framework.create_framework(
        remove_duplicates(bundles), init.properties
    )
    framework.start()

    # Instantiate a Remote Shell
    with use_ipopo(framework.get_bundle_context()) as ipopo:
        ipopo.instantiate(
            pelix.shell.FACTORY_XMPP_SHELL,
            "xmpp-shell",
            {
                "shell.xmpp.server": server,
                "shell.xmpp.port": args.port,
                "shell.xmpp.jid": args.jid,
                "shell.xmpp.password": password,
                "shell.xmpp.tls": args.use_tls,
                "shell.xmpp.ssl": args.use_ssl,
            },
        )

    # Instantiate configured components
    init.instantiate_components(framework.get_bundle_context())

    try:
        framework.wait_for_stop()
    except KeyboardInterrupt:
        framework.stop()
236752
def main(args):
    
    args = parse_args(args)
    setup_logging(args.loglevel)
    _logger.debug("Starting crazy calculations...")
    print("The {}-th Fibonacci number is {}".format(args.n, fib(args.n)))
    _logger.info("Script ends here")
1020339
def bed(args):
    
    p = OptionParser(bed.__doc__)
    opts, args = p.parse_args(args)

    if len(args) < 2:
        sys.exit(not p.print_help())

    bedfile = args[0]
    bamfiles = args[1:]
    for bamfile in bamfiles:
        cmd = "bamToBed -i {0}".format(bamfile)
        sh(cmd, outfile=bedfile, append=True)
1273391
def main(args: Sequence[str] = None) -> int:
    

    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)-15s | %(levelname)-8s | %(message)s',
        datefmt='%Y-%m-%d %H:%M:%S')
    logging.getLogger('von_anchor').setLevel(logging.WARNING)
    logging.getLogger('indy').setLevel(logging.ERROR)

    if args is None:
        args = sys.argv[1:]

    if len(sys.argv) == 2:
        try:
            return do_wait(setnym(sys.argv[1]))
        except VonAnchorError as vax:
            print(str(vax))
            return 1
    else:
        usage()
        return 1
1277253
def main(command_line_args=None):
    ''''''
    log = None
    if not command_line_args:
        command_line_args = sys.argv
    try:
        start_time = time.time()
        args = parse_command_line_args(command_line_args)
        log = utils.Logger(args)
        command_validator.preflight(args, log)
        log.info('connor begins (v{})', __version__)
        log.info('logging to [{}]', args.log_file)
        utils.log_environment_info(log, args)
        bam_tags = bamtag.build_bam_tags()
        base_annotated_writer = writers.build_writer(args.input_bam,
                                                      args.annotated_output_bam,
                                                      bam_tags,
                                                      args)
        sort_filter_by_name = args.filter_order == 'name'
        annotated_writer = writers.LoggingWriter(base_annotated_writer,
                                                 log,
                                                 sort_filter_by_name)
        consensus_writer = writers.build_writer(args.input_bam,
                                                 args.output_bam,
                                                 bam_tags,
                                                 args)
        _dedup_alignments(args, consensus_writer, annotated_writer, log)
        annotated_writer.close(log)
        consensus_writer.close(log)
        warning = ' **See warnings above**' if log.warning_occurred else ''
        elapsed_time = int(time.time() - start_time)
        log.info("connor complete ({} seconds, {}mb peak memory).{}",
             elapsed_time,
             utils.peak_memory(),
             warning)
    except utils.UsageError as usage_error:
        message = "connor usage problem: {}".format(str(usage_error))
        print(message, file=sys.stderr)
        print("See 'connor --help'.", file=sys.stderr)
        sys.exit(1)
    except Exception: #pylint: disable=broad-except
        if log:
            show = log.error
        else:
            show = partial(print, file=sys.stderr)
        show("An unexpected error occurred")
        show(traceback.format_exc())
        exit(1)
1325741
def parse_command_line(args: List[str] = None, final: bool = True) -> List[str]:
    
    return options.parse_command_line(args, final=final)
869415
def process_arguments():
    
    parser = argparse.ArgumentParser(description="Extract a table from the "
                                                 "given text")
    parser.add_argument("text", type=argparse.FileType('r'),
                        help="the text to analyse")
    parser.add_argument("--prefix", "-p", type=natural, default=0,
                        dest="prefix", help="if not 0, the maximum length of "
                                            "prefixes to consider when "
                                            "choosing the next character "
                                            "(default: 0)")
    parser.add_argument("--flatten", "-f", action="store_true", default=False,
                        dest="flatten", help="flatten the table")
    parser.add_argument("--check", "-c", action="store_true", default=False,
                        dest="check", help="also check that the table is "
                                           "complete")
    parser.add_argument("--output", "-o", type=argparse.FileType('wb'),
                        default=None, dest="output",
                        help="the output destination; "
                             "if missing, print the table")
    return parser.parse_args()
229528
def do_p(self, arg):
        
        try:
            self.message(bdb.safe_repr(self._getval(arg)))
        except Exception:
            pass
768112
def main() -> None:
    
    logging.basicConfig(level=logging.DEBUG)
    parser = argparse.ArgumentParser()
    parser.add_argument("inputfile", nargs="?", help="Input file name")
    parser.add_argument(
        "--availability", nargs='*',
        help="File extensions to check availability for (use a '.' prefix, "
             "and use the special extension 'None' to check the fallback "
             "processor")
    parser.add_argument(
        "--plain", action="store_true",
        help="Keep it plain: minimize layout (e.g. of tables) and maximize "
             "the likelihood of source sentence flowing properly in the "
             "output (e.g. for natural language processing).")
    parser.add_argument(
        "--width", type=int, default=DEFAULT_WIDTH,
        help="Word wrapping width (default {})".format(DEFAULT_WIDTH))
    parser.add_argument(
        "--min-col-width", type=int, default=DEFAULT_MIN_COL_WIDTH,
        help="Minimum column width for tables (default {})".format(
            DEFAULT_MIN_COL_WIDTH))
    args = parser.parse_args()
    if args.availability:
        for ext in args.availability:
            if ext.lower() == 'none':
                ext = None
            available = is_text_extractor_available(ext)
            print("Extractor for extension {} present: {}".format(ext,
                                                                  available))
        return
    if not args.inputfile:
        parser.print_help(sys.stderr)
        return
    config = TextProcessingConfig(
        width=args.width,
        min_col_width=args.min_col_width,
        plain=args.plain,
    )
    result = document_to_text(filename=args.inputfile, config=config)
    if result is None:
        return
    else:
        print(result)
723000
def bed(args):
    
    p = OptionParser(bed.__doc__)
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    idsfile, = args
    ids = set(x.strip() for x in open(idsfile))
    data = get_bed_from_phytozome(list(ids))

    pf = idsfile.rsplit(".", 1)[0]
    bedfile = pf + ".bed"
    fw = open(bedfile, "w")
    for i, row in enumerate(data):
        row = row.strip()
        if row == "":
            continue

        print(row, file=fw)

    logging.debug("A total of {0} records written to `{1}`.".format(i + 1, bedfile))
414663
def main(args, stop=False):
    
    daemon = AMQPDaemon(
        con_param=getConParams(
            settings.RABBITMQ_CALIBRE_VIRTUALHOST
        ),
        queue=settings.RABBITMQ_CALIBRE_INPUT_QUEUE,
        out_exch=settings.RABBITMQ_CALIBRE_EXCHANGE,
        out_key=settings.RABBITMQ_CALIBRE_OUTPUT_KEY,
        react_fn=reactToAMQPMessage,
        glob=globals()                # used in deserializer
    )

    if not stop and args.foreground:  # run at foreground
        daemon.run()
    else:
        daemon.run_daemon()
677185
def get_transition(self,  # suppress(too-many-arguments)
                       line,
                       line_index,
                       column,
                       is_escaped,
                       *args,
                       **kwargs):
        """"""
        del line_index
        del args
        del kwargs

        wait_until_len = len(self._waiting_until)
        if (_token_at_col_in_line(line,
                                  column,
                                  self._waiting_until,
                                  wait_until_len) and
                not _is_escaped(line, column, is_escaped)):
            return (InTextParser(), 1, None)

        return (self, 1, None)
332661
def main():
    
    try:
        # A bit of a hack: We want to load the plugins (specified via the mode
        # and health parameter) in order to add their arguments to the argument
        # parser. But this means we first need to look into the CLI arguments
        # to find them ... before looking at the arguments. So we first perform
        # a manual search through the argument list for this purpose only.
        args = sys.argv[1:]

        # Loading the watcher plugin
        mode_name = utils.param_extract(args, "-m", "--mode", default=None)
        if mode_name:
            watcher_plugin_class = \
                load_plugin(mode_name, watcher.WATCHER_DEFAULT_PLUGIN_MODULE)
        else:
            watcher_plugin_class = None

        # Loading the health monitor plugin
        health_check_name = \
            utils.param_extract(args, "-H", "--health",
                                default=monitor.MONITOR_DEFAULT_PLUGIN)
        if health_check_name:
            health_plugin_class = \
                load_plugin(health_check_name,
                            monitor.MONITOR_DEFAULT_PLUGIN_MODULE)
        else:
            health_plugin_class = None

        # Provide complete arg parsing for vpcrouter and all plugin classes.
        conf = _parse_args(sys.argv[1:],
                           watcher_plugin_class, health_plugin_class)

        if not health_plugin_class or not watcher_plugin_class:
            logging.error("Watcher plugin or health monitor plugin class "
                          "are missing.")
            sys.exit(1)

        _setup_logging(conf)

        # If we are on an EC2 instance then some data is already available to
        # us. The return data items in the meta data match some of the command
        # line arguments, so we can pass this through to the parser function to
        # provide defaults for those parameters. Specifically: VPC-ID and
        # region name.
        if not conf['vpc_id'] or not conf['region_name']:
            meta_data = get_ec2_meta_data()
            if 'vpc_id' not in meta_data or 'region_name' not in meta_data:
                logging.error("VPC and region were not explicitly specified "
                              "and can't be auto-discovered.")
                sys.exit(1)
            else:
                conf.update(meta_data)

        try:
            info_str = "vpc-router (%s): mode: %s (%s), " \
                       "health-check: %s (%s)" % \
                       (vpcrouter.__version__,
                        conf['mode'], watcher_plugin_class.get_version(),
                        health_check_name, health_plugin_class.get_version())
            logging.info("*** Starting %s ***" % info_str)
            CURRENT_STATE.versions = info_str

            http_srv = http_server.VpcRouterHttpServer(conf)
            CURRENT_STATE._vpc_router_http = http_srv

            watcher.start_watcher(conf,
                                  watcher_plugin_class, health_plugin_class)
            http_srv.stop()
            logging.info("*** Stopping vpc-router ***")
        except Exception as e:
            import traceback
            traceback.print_exc()
            logging.error(e.message)
            logging.error("*** Exiting")
    except Exception as e:
        print "\n*** Error: %s\n" % e.message

    sys.exit(1)
350007
def parse_command_line(self):
        """"""
        result = _Distribution.parse_command_line(self)
        if self.features:
            self._finalize_features()
        return result
780754
def main(args, stop=False):
    
    daemon = AMQPDaemon(
        con_param=getConParams(
            settings.RABBITMQ_PDFGEN_VIRTUALHOST
        ),
        queue=settings.RABBITMQ_PDFGEN_INPUT_QUEUE,
        out_exch=settings.RABBITMQ_PDFGEN_EXCHANGE,
        out_key=settings.RABBITMQ_PDFGEN_OUTPUT_KEY,
        react_fn=reactToAMQPMessage,
        glob=globals()                # used in deserializer
    )

    if not stop and args.foreground:  # run at foreground
        daemon.run()
    else:
        daemon.run_daemon()