Run GapFill command
971180
def run(self):
        """"""

        # Load compound information
        def compound_name(id):
            if id not in self._model.compounds:
                return id
            return self._model.compounds[id].properties.get('name', id)

        # Calculate penalty if penalty file exists
        penalties = {}
        if self._args.penalty is not None:
            for line in self._args.penalty:
                line, _, comment = line.partition('#')
                line = line.strip()
                if line == '':
                    continue
                rxnid, penalty = line.split(None, 1)
                penalties[rxnid] = float(penalty)

        core = set(self._mm.reactions)

        solver = self._get_solver(integer=True)
        default_comp = self._model.default_compartment
        epsilon = self._args.epsilon
        v_max = float(self._model.default_flux_limit)

        blocked = set()
        for compound in self._args.compound:
            if compound.compartment is None:
                compound = compound.in_compartment(default_comp)
            blocked.add(compound)

        if len(blocked) > 0:
            logger.info('Unblocking compounds: {}...'.format(
                ', '.join(text_type(c) for c in sorted(blocked))))
        else:
            logger.info(
                'Unblocking all compounds in model. Use --compound option to'
                ' unblock specific compounds.')
            blocked = set(self._mm.compounds)

        exclude = set()
        if self._model.biomass_reaction is not None:
            exclude.add(self._model.biomass_reaction)

        # Add exchange and transport reactions to database
        model_complete, weights = create_extended_model(
            self._model,
            db_penalty=self._args.db_penalty,
            ex_penalty=self._args.ex_penalty,
            tp_penalty=self._args.tp_penalty,
            penalties=penalties)

        implicit_sinks = not self._args.no_implicit_sinks

        logger.info('Searching for reactions to fill gaps')
        try:
            added_reactions, no_bounds_reactions = gapfill(
                model_complete, core, blocked, exclude, solver=solver,
                epsilon=epsilon, v_max=v_max, weights=weights,
                implicit_sinks=implicit_sinks,
                allow_bounds_expansion=self._args.allow_bounds_expansion)
        except GapFillError as e:
            self._log_epsilon_and_fail(epsilon, e)

        for reaction_id in sorted(self._mm.reactions):
            rx = self._mm.get_reaction(reaction_id)
            rxt = rx.translated_compounds(compound_name)
            print('{}\t{}\t{}\t{}'.format(reaction_id, 'Model', 0, rxt))

        for rxnid in sorted(added_reactions):
            rx = model_complete.get_reaction(rxnid)
            rxt = rx.translated_compounds(compound_name)
            print('{}\t{}\t{}\t{}'.format(
                rxnid, 'Add', weights.get(rxnid, 1), rxt))

        for rxnid in sorted(no_bounds_reactions):
            rx = model_complete.get_reaction(rxnid)
            rxt = rx.translated_compounds(compound_name)
            print('{}\t{}\t{}\t{}'.format(
                rxnid, 'Remove bounds', weights.get(rxnid, 1), rxt))
820639
def run
      command = ['flay', '--mass', @config['mass_threshold'].to_s, '--fuzzy', @config['fuzzy'].to_s]
      # Use a more liberal detection method
      command += ['--liberal'] if @config['liberal']
      messages = []
      # Run the command for each file
      applicable_files.each do |file|
        result = execute(command, args: [file])
        results = result.stdout.split("\n\n")
        results.shift
        unless results.empty?
          error_message = results.join("\n").gsub(/^\d+\)\s*/, '')
          message = Overcommit::Hook::Message.new(:error, nil, nil, error_message)
          messages << message
        end
      end
      messages
    end
153775
def run (self):
        """"""
        if self.all:
            # remove share directory
            directory = os.path.join("build", "share")
            if os.path.exists(directory):
                remove_tree(directory, dry_run=self.dry_run)
            else:
                log.warn("'%s' does not exist -- can't clean it", directory)
        clean.run(self)
168153
function fillInit() {
    console.log('\nThis utility will generate a resume.json file in your current working directory.');
    console.log('Fill out your name and email to get started, or leave the fields blank.');
    console.log('All fields are optional.\n');
    console.log('Press ^C at any time to quit.');

    read({
        prompt: 'name: '
    }, function(er, name) {
        if (er) {
            console.log();
            process.exit();
        }

        read({
            prompt: 'email: '
        }, function(er, email) {
            if (er) {
                console.log();
                process.exit();
            }

            resumeJson.basics.name = name;
            resumeJson.basics.email = email;

            fs.writeFileSync(process.cwd() + '/resume.json', JSON.stringify(resumeJson, undefined, 2));

            console.log('\nYour resume.json has been created!'.green);
            console.log('');
            console.log('To generate a formatted .html .md .txt or .pdf resume from your resume.json');
            console.log('type: `resume export [someFileName]` including file extension eg: `resume export myresume.html`');
            console.log('\nYou can optionally specify an available theme for html and pdf resumes using the --theme flag.');
            console.log('Example: `resume export myresume.pdf --theme flat`');
            console.log('Or simply type: `resume export` and follow the prompts.');
            console.log('');

            process.exit();
            callback(true);
        });
    });
}
47063
function run(command, auth, options, async, done, msgSuccess, msgSuccessAsync, msgFailure) {

        var args,
            flags,
            field,
            i,
            childProcess;

        // Pass auth.
        command = command.replace('{auth}', auth ? format('--email=%s --passin ', auth.email) : '');

        // Evaluate arguments to pass.
        args = '';
        for (field in options.args) {
            args += format('--%s=%s ', field, options.args[field]);
        }

        // Evaluate flags to pass.
        flags = '';
        for (i = 0; i < options.flags.length; ++i) {
            flags += format('--%s ', options.flags[i]);
        }

        command = command.replace('{args}', args).replace('{flags}', flags).replace('{path}', options.path);

        // Passin.
        if (auth) {
            command = format('echo %s | %s', auth.password, command);
        }

        // Run it asynchronously
        if (async) {
            command = COMMAND_ASYNC.
                replace('{command}', command).
                replace('{redirect}', options.asyncOutput ? '' : REDIRECT_DEVNULL);
        }

        grunt.log.debug(command);

        // Run the command.
        childProcess = exec(command, {}, function () {});

        // Listen to output
        if (options.stdout) {
            childProcess.stdout.on('data', function (d) {
                grunt.log.write(d);
            });
        }

        // Listen to errors.
        if (options.stderr) {
            childProcess.stderr.on('data', function (d) {
                grunt.log.error(d);
            });
        }

        // Listen to exit.
        childProcess.on('exit', function (code) {
            if (options.stdout) {
                if (code === 0 && async) {
                    grunt.log.subhead(
                        msgSuccessAsync ||
                        options.asyncOutput && 'Output from asynchronous operation follows.' ||
                        'Unable to determine success of asynchronous operation. For debugging please disable async mode or enable asyncOutput.'
                    );
                } else if (code === 0) {
                    grunt.log.ok(msgSuccess || 'Action executed successfully.');
                }
            }

            if (options.stderr && code !== 0) {
                grunt.log.error(msgFailure || 'Error executing the action.');
            }

            done();
        });

    }
726257
function run(opts, cb){
  opts.extensions = opts.extensions ? opts.extensions + ',.jsx' : '.jsx';

  // glob-all fixes windows glob issues and provides array support
  // i.e. jsxhint ['jsx/**/*','!scripts/**/*','scripts/outlier.jsx']
  runGlob(opts.args, {nodir: true}, function(err, globbed) {
    if (err) return cb(err);

    // Reassign the globbed files back to opts.args, so it looks like we just
    // fed jshint a big list of files.
    opts.args = globbed;
    var files = jshintcli.gather(opts);

    if (opts.useStdin) {
      jsxhint.transformStream(process.stdin, jsxhintOptions, opts, cb);
    } else {
      jsxhint.transformFiles(files, jsxhintOptions, opts, cb);
    }
  });
}
958463
def run(cmd, *args, **kwargs):
    """"""
    log.info('> ' + list2cmdline(cmd))
    kwargs.setdefault('cwd', here)
    kwargs.setdefault('shell', sys.platform == 'win32')
    if not isinstance(cmd, list):
        cmd = cmd.split()
    return check_call(cmd, *args, **kwargs)
928558
def run_treefix(input, stree_file, smap_file, a_ext=".fasta", \
                o_ext=".dnd", n_ext = ".treefix.dnd", **kwargs):
    
    cl = TreeFixCommandline(input=input, \
            stree_file=stree_file, smap_file=smap_file, a_ext=a_ext, \
            o=o_ext, n=n_ext, **kwargs)
    outtreefile = input.rsplit(o_ext, 1)[0] + n_ext
    print("TreeFix:", cl, file=sys.stderr)
    r, e = cl.run()

    if e:
        print("***TreeFix could not run", file=sys.stderr)
        return None
    else:
        logging.debug("new tree written to {0}".format(outtreefile))
        return outtreefile
139183
def run(files, temp_folder, arg=None):
    ""
    try:
        import pylint
    except ImportError:
        return NO_PYLINT_MSG

    # set default level of threshold
    arg = arg or SCORE

    py_files = filter_python_files(files)
    if not py_files:
        return False

    str_py_files = " ".join(py_files)
    cmd = "{0} {1}".format(PYLINT_CMD, str_py_files)
    output = bash(cmd).value()

    if 'rated' not in output:
        return False
    score = float(re.search("(\d.\d\d)/10", output).group(1))
    if score >= float(arg):
        return False
    return ("Pylint appreciated your {0} as {1},"
        "required threshold is {2}".format(PYLINT_TARGET, score, arg)
        )
174836
def run(input_file, options):
    """"""

    options.logger = log
    generator.Generator(input_file, **options.__dict__).execute()
406002
function runGlob(args, opts, cb) {
  var dotIdx = args.indexOf('.');
  if (dotIdx !== -1) {
    args.splice(dotIdx, 1);
  }
  glob(args, opts, function(err, globbed) {
    if (Array.isArray(globbed) && dotIdx !== -1) globbed.push('.');
    cb(err, globbed);
  });
}
887887
function run (command, opts, conf) {
  // Use "new Promise" to isolate process and catch any error
  return new Promise(function (resolve, reject) {
    if (command.config) {
      opts = command.config(opts, conf);
    }

    Promise.cast(command.run(opts.argv, opts, conf)).then(resolve, reject);
  });
}
678553
def _run(passedArgs=None, stderr=None, stdout=None, exitFn=None):
    

    description = """Finds the next available file-name in a sequence.

    This program will create a file of zero size and will output the path to it
    on STDOUT. No files which exist will be altered in this operation and
    concurrent invocations of this program will return separate files. In case
    of conflict, this program will attempt to generate a new file name up to
    'maxattempts' number of times before failing. (See --max-attempts)

    The sequence will start from the base argument (See --base, default: 0).

    This program will look for the next file in the sequence ignoring any gaps.
    Hence, if the files "a.0.txt" and "a.3.txt" exist, then the next file
    returned will be "a.4.txt" when called with prefix="a." and suffix=".txt".

    Returns:
        Path of the file which follows the provided pattern and can be opened
        for writing.

        Otherwise, it prints an error (wrong path, drive full, illegal
        character in filename, etc.) to stderr and exits with a non-zero error
        code.
    """

    argParser = _argparse.ArgumentParser(
            description=description,
            formatter_class=_argparse.RawTextHelpFormatter)

    argParser.add_argument('prefix',
                           help='Prefix for the sequence of files.')
    argParser.add_argument('suffix',
                           help='Suffix for the sequence of files.',
                           nargs='?',
                           default='')
    argParser.add_argument('folder',
                           help='The folder where the file will be created.',
                           nargs='?',
                           default=_os.getcwd())
    argParser.add_argument('-m', '--max-attempts',
                           help='Number of attempts to make before giving up.',
                           default=10)
    argParser.add_argument('-b', '--base',
                           help='From where to start counting (default: 0).',
                           default=0)

    passedArgs = passedArgs if passedArgs is not None else _sys.argv[1:]
    args = argParser.parse_args(passedArgs)

    stdout = _sys.stdout if stdout is None else stdout
    stderr = _sys.stderr if stderr is None else stderr

    try:
        nextFile = findNextFile(args.folder, prefix=args.prefix,
                                suffix=args.suffix,
                                maxattempts=args.max_attempts,
                                base=args.base)
        # The newline will be converted to the correct platform specific line
        # ending as `sys.stdout` is opened in non-binary mode.
        # Hence, we do not need to explicitly print out `\r\n` for Windows.
        stdout.write(nextFile + u'\n')
    except OSError as e:
        stderr.write(_os.strerror(e.errno) + u'\n')
        _sys.exit(e.errno)
1295754
def _run_tool(cmd, use_container=True, work_dir=None, log_file=None):
    
    if isinstance(cmd, (list, tuple)):
        cmd = " ".join([str(x) for x in cmd])
    cmd = utils.local_path_export(at_start=use_container) + cmd
    if log_file:
        cmd += " 2>&1 | tee -a %s" % log_file
    try:
        print("Running: %s" % cmd)
        subprocess.check_call(cmd, shell=True)
    finally:
        if use_container and work_dir:
            _chown_workdir(work_dir)
1254926
def regularrun(
    shell,
    prompt_template="default",
    aliases=None,
    envvars=None,
    extra_commands=None,
    speed=1,
    test_mode=False,
    commentecho=False,
):
    
    loop_again = True
    command_string = regulartype(prompt_template)
    if command_string == TAB:
        loop_again = False
        return loop_again
    run_command(
        command_string,
        shell,
        aliases=aliases,
        envvars=envvars,
        extra_commands=extra_commands,
        test_mode=test_mode,
    )
    return loop_again
745611
def fill(args):
    
    p = OptionParser(fill.__doc__)
    p.add_option("--stretch", default=3, type="int",
                 help="MAX_STRETCH to pass to FillFragments [default: %default]")
    p.set_cpus()

    opts, args = p.parse_args(args)

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

    fastb, = args
    assert fastb == "frag_reads_corr.fastb"

    pcfile = "frag_reads_corr.k28.pc.info"
    nthreads = " NUM_THREADS={0}".format(opts.cpus)
    maxstretch = " MAX_STRETCH={0}".format(opts.stretch)
    if need_update(fastb, pcfile):
        cmd = "PathReads READS_IN=frag_reads_corr"
        cmd += nthreads
        sh(cmd)

    filledfastb = "filled_reads.fastb"
    if need_update(pcfile, filledfastb):
        cmd = "FillFragments PAIRS_OUT=frag_reads_corr_cpd"
        cmd += " PRECORRECT_LIBSTATS=True"
        cmd += maxstretch
        cmd += nthreads
        sh(cmd)

    filledfasta = "filled_reads.fasta"
    if need_update(filledfastb, filledfasta):
        cmd = "Fastb2Fasta IN=filled_reads.fastb OUT=filled_reads.fasta"
        sh(cmd)
161490
def bed(args):
    
    from jcvi.formats.obo import validate_term

    p = OptionParser(bed.__doc__)
    p.add_option("--gaps", default=False, action="store_true",
            help="Only print bed lines for gaps [default: %default]")
    p.add_option("--nogaps", default=False, action="store_true",
            help="Do not print bed lines for gaps [default: %default]")
    p.add_option("--bed12", default=False, action="store_true",
            help="Produce bed12 formatted output [default: %default]")
    p.add_option("--component", default=False, action="store_true",
            help="Generate bed file for components [default: %default]")
    p.set_outfile()
    g1 = OptionGroup(p, "GFF specific parameters",
            "Note: If not specified, output will be in `bed` format")
    g1.add_option("--gff", default=False, action="store_true",
            help="Produce gff3 formatted output. By default, ignores " +\
                 "AGP gap lines. [default: %default]")
    g1.add_option("--source", default="MGSC",
            help="Specify a gff3 source [default: `%default`]")
    g1.add_option("--feature", default="golden_path_fragment",
            help="Specify a gff3 feature type [default: `%default`]")
    p.add_option_group(g1)
    p.set_SO_opts()

    opts, args = p.parse_args(args)

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

    if opts.component:
        opts.nogaps = True

    # If output format is gff3 and 'verifySO' option is invoked, validate the SO term
    if opts.gff and opts.verifySO:
        validate_term(opts.feature, method=opts.verifySO)

    agpfile, = args
    agp = AGP(agpfile)
    fw = must_open(opts.outfile, "w")
    if opts.gff:
        print("##gff-version 3", file=fw)

    for a in agp:
        if opts.nogaps and a.is_gap:
            continue
        if opts.gaps and not a.is_gap:
            continue
        if opts.bed12:
            print(a.bed12line, file=fw)
        elif opts.gff:
            print(a.gffline(gff_source=opts.source, gff_feat_type=opts.feature), file=fw)
        elif opts.component:
            name = "{0}:{1}-{2}".\
                        format(a.component_id, a.component_beg, a.component_end)
            print("\t".join(str(x) for x in (a.component_id, a.component_beg - 1,
                                a.component_end, name,
                                a.component_type, a.orientation)), file=fw)
        else:
            print(a.bedline, file=fw)
    fw.close()

    return fw.name